SDK
SDK Android v3.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 #

JSONObject userContent = new JSONObject()
  // A "profile" field is required to bind a user to an existing profile
  .put("profileIds", new JSONArray().put("admin"))
  // The "local" authentication strategy requires a password
  .put("password", "secret password")
  // You can also set custom fields to your user
  .put("firstname", "John")
  .put("lastname", "Doe");
// Using the KuzzleSecurity factory:
User user = kuzzle.security.user("user ID", userContent);
// Or directly with the constructor:
User user = new User(kuzzle.security, "user ID", userContent);