Skip to main content

Assigning Users to Tenants and Setting Roles

After a tenant has been created, you can then associate the self-signed up user with the tenant.

Please append the following to the tenant creation source code:

        // Tenant user association
// Last name: the 'lastname' entered on the page
// First name: the 'firstname' entered on the page
$create_tenant_user_param = new CreateTenantUserParam();
'memo' => $validated['memo'],
$auth_api_client->createTenantUser($tenant->getId(), $create_tenant_user_param, $auth_api_client::FETCH_RESPONSE);

Please use the CreateTenantUserParam object.

setAttributes sets the attribute information of the tenant defined in Defining Additional Attributes for a Tenant.

Next, set the role.

Please append the following code:

        // Role setting
$create_tenant_user_roles_param = new CreateTenantUserRolesParam();
$auth_api_client->createTenantUserRoles($tenant->getId(), $request['userinfo']['id'], getenv('DEFAULT_SAASUSER_ENV'), $create_tenant_user_roles_param);

Please use the CreateTenantUserRolesParam object.

setRoleNames allows you to specify multiple roles.

The values that can be specified are the "Role Name" that you created in Role Definition.

You can check whether the tenant user was registered via API in "SaaS Operation Console > User Management".