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 #

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

Other protocols #

{
  "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.

{
  "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"]
        }
      ]
    }
  }
}