SDK
SDK Javascript v5.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

Constructors #

Instantiates a new User object, which is a representation of a Kuzzle user and is linked to a security Profile. #

User(Security, id, content, [meta]) #

ArgumentsTypeDescription
SecuritySecurityAn instantiated Security object
idstringUnique user identifier
contentJSON ObjectUser content
metaJSON ObjectUser metadata

Note: this constructor won't make any call to Kuzzle.


Properties #

Property nameTypeDescriptionget/set
contentJSON objectRaw user contentget
idstringUnique profile identifierget
metaJSON objectUser metadataget

Return Value #

Returns the User object.

Usage #

/*
  Constructors are not exposed in the JS/Node SDK.
  User objects are returned by Security.user method:
  */
  var userContent = {
    // A "profile" field is required to bind a user to an existing profile
    profileIds: ['admin'],
    // The "local" authentication strategy requires a password
    password: 'secretPassword',
    // You can also set custom fields to your user
    firstname: 'John',
    lastname: 'Doe'
  };
var user = kuzzle.security.user('myuser', userContent);