Official Plugins (Kuzzle v2.x)
multi-tenancy v1.x
2

create #

Creates a new user for a tenant

See also security:createUser

User can only act on tenant they belongs.


Query Syntax #

HTTP #

Copied to clipboard!
URL: http://kuzzle:7512/_/multi-tenancy/tenant/:tenantId/users[?_id=<kuid>][&refresh=<refresh>][&profile=<profile name>]
Method: POST
Body:
Copied to clipboard!
{
  "content": {
    // custom content
  },
  "credentials": {
    // user credentials
  }
}

Other protocols #

Copied to clipboard!
{
  "controller": "multi-tenancy/user",
  "action": "create",

  "_id": "<optionnal kuid>",
  "profile": "<profile name>",
  "tenantId": "<tenant ID>",

  "body": {
    "content": {
      // custom content
    },
    "credentials": {
      // user credentials
    }
  }
}

Arguments #

  • profile: Profile name
  • tenantId: Tenant ID

Optional: #

  • _id: Optionnal user kuid, will be generated otherwise
  • refresh: if set to wait_for, Kuzzle will not respond until documents are indexed
  • updateIfExists: (local credential strategy only) will update existing user and add the tenant corresponding profile if username and email matches without updating others fields (password, custom content ...). It calls addProfile under the hood if requirements are met.

Body properties #

User custom content and credentials like for the security:createUser API action.

It's not possible to manually set the profileIds or the tenants properties.


Response #

Returns the user who have been created.

Copied to clipboard!
{
  "status": 200,
  "error": null,
  "action": "create",
  "controller": "multi-tenancy/user",
  "requestId": "<unique request identifier>",
  "result": {
    "_id": "<kuid>",
    "content": {
      "profileIds": ["teacher-liia-moderator"],
      "tenants": [
        {
          "group": "teacher",
          "name": "liia",
          "index": "tenant-teacher-liia",
          "profiles": ["moderator"]
        }
      ]
    }
  }
}