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])

Arguments Type Description
Security Security An instantiated Security object
id string Unique user identifier
content JSON Object User content
meta JSON Object User metadata

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


Properties

Property name Type Description get/set
content JSON object Raw user content get
id string Unique profile identifier get
meta JSON object User metadata get

Return Value

Returns the User object.

Usage

Copied to clipboard!
/*
  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);