UserService
This service provides methods for managing users and user groups.
Methods¶
assignUserToUserGroup() ¶
Assigns a new user group to the user.
If the user is already in the given user group this method does nothing.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$user | User | - | - |
$userGroup | UserGroup | - | - |
Tags
checkUserCredentials() ¶
Checks if credentials are valid for provided User.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$user | User | - | - |
$credentials | string | - | - |
Return values
bool
createUser() ¶
Create a new user. The created user is published by this method.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$userCreateStruct | UserCreateStruct | - |
the data used for creating the user |
$parentGroups | array<string|int, mixed> | - |
the groups of type UserGroup which are assigned to the user after creation |
Return values
Tags
createUserGroup() ¶
Creates a new user group using the data provided in the ContentCreateStruct parameter.
|
|
In 4.x in the content type parameter in the profile is ignored
- the content type is determined via configuration and can be set to null. The returned version is published.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$userGroupCreateStruct | UserGroupCreateStruct | - |
a structure for setting all necessary data to create this user group |
$parentGroup | UserGroup | - | - |
Return values
Tags
deleteUser() ¶
This method deletes a user.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$user | User | - | - |
Return values
array<string|int, int>
Affected Location Id's (List of Locations of the Content that was deleted)
Tags
deleteUserGroup() ¶
Removes a user group.
|
|
the users which are not assigned to other groups will be deleted.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$userGroup | UserGroup | - | - |
Return values
array<string|int, int>
Affected Location Id's (List of Locations of the Content that was deleted)
Tags
expireUserToken() ¶
Expires user token with user hash.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$hash | string | - | - |
getPasswordInfo() ¶
Returns information about password for a given user.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$user | User | - | - |
Return values
isUser() ¶
Checks if Content is a user.
|
|
@since 7.4
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$content | Content | - | - |
Return values
bool
isUserGroup() ¶
Checks if Content is a user group.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$content | Content | - | - |
Return values
bool
loadSubUserGroups() ¶
Loads the sub groups of a user group.
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$userGroup | UserGroup | - | - |
$offset | int | 0 |
the start offset for paging |
$limit | int | 25 |
the number of user groups returned |
$prioritizedLanguages | array<string|int, string> | [] |
Used as prioritized language code on translated properties of returned object. |
Return values
array<string|int, UserGroup>
Tags
loadUser() ¶
Loads a user.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$userId | mixed | - | - |
$prioritizedLanguages | array<string|int, string> | [] |
Used as prioritized language code on translated properties of returned object. |
Return values
Tags
loadUserByEmail() ¶
Loads a user for the given email.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
string | - | - | |
$prioritizedLanguages | array<string|int, string> | [] |
Used as prioritized language code on translated properties of returned object. |
Return values
Tags
loadUserByLogin() ¶
Loads a user for the given login.
|
|
Since 6.1 login is case-insensitive across all storage engines and database backends, like was the case with mysql before in Ibexa 3.x/4.x/5.x.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$login | string | - | - |
$prioritizedLanguages | array<string|int, string> | [] |
Used as prioritized language code on translated properties of returned object. |
Return values
Tags
loadUserByToken() ¶
Loads a user with user hash key.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$hash | string | - | - |
$prioritizedLanguages | array<string|int, string> | [] | - |
Return values
loadUserGroup() ¶
Loads a user group for the given id.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$id | int | - | - |
$prioritizedLanguages | array<string|int, string> | [] |
Used as prioritized language code on translated properties of returned object. |
Return values
Tags
loadUserGroupByRemoteId() ¶
Loads a user group for the given remote id.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$remoteId | string | - | - |
$prioritizedLanguages | array<string|int, string> | [] |
Used as prioritized language code on translated properties of returned object. |
Return values
Tags
loadUserGroupsOfUser() ¶
Loads the user groups the user belongs to.
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$user | User | - | - |
$offset | int | 0 |
the start offset for paging |
$limit | int | 25 |
the number of user groups returned |
$prioritizedLanguages | array<string|int, string> | [] |
Used as prioritized language code on translated properties of returned object. |
Return values
array<string|int, UserGroup>
Tags
loadUsersByEmail() ¶
Loads a users for the given email.
|
|
Note: This method loads user by $email where $email might be case-insensitive on certain storage engines!
Returns an array of Users since Ibexa has under certain circumstances allowed several users having same email in the past (by means of a configuration option).
Parameters
Name | Type | Default value | Description |
---|---|---|---|
string | - | - | |
$prioritizedLanguages | array<string|int, string> | [] |
Used as prioritized language code on translated properties of returned object. |
Return values
array<string|int, User>
Tags
loadUsersOfUserGroup() ¶
Loads the users of a user group.
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$userGroup | UserGroup | - | - |
$offset | int | 0 |
the start offset for paging |
$limit | int | 25 |
the number of users returned |
$prioritizedLanguages | array<string|int, string> | [] |
Used as prioritized language code on translated properties of returned object. |
Return values
array<string|int, User>
Tags
moveUserGroup() ¶
Moves the user group to another parent.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$userGroup | UserGroup | - | - |
$newParent | UserGroup | - | - |
Tags
newUserCreateStruct() ¶
Instantiate a user create class.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$login | string | - |
the login of the new user |
string | - |
the email of the new user |
|
$password | string | - |
the plain password of the new user |
$mainLanguageCode | string | - |
the main language for the underlying content object |
$contentType | ContentType|null | null |
content type for the underlying content object. |
Return values
newUserGroupCreateStruct() ¶
Instantiate a user group create class.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$mainLanguageCode | string | - |
The main language for the underlying content object |
$contentType | ContentType|null | null |
5.x the content type for the underlying content object. In 4.x it is ignored and taken from the configuration |
Return values
newUserGroupUpdateStruct() ¶
Instantiate a new user group update struct.
|
|
Return values
newUserUpdateStruct() ¶
Instantiate a new user update struct.
|
|
Return values
unAssignUserFromUserGroup() ¶
Removes a user group from the user.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$user | User | - | - |
$userGroup | UserGroup | - | - |
Tags
updateUser() ¶
Updates a user.
|
|
4.x: If the versionUpdateStruct is set in the user update structure, this method internally creates a content draft, updates ts with the provided data and publishes the draft. If a draft is explicitly required, the user group can be updated via the content service methods.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$user | User | - | - |
$userUpdateStruct | UserUpdateStruct | - | - |
Return values
Tags
updateUserGroup() ¶
Updates the group profile with fields and meta data.
|
|
4.x: If the versionUpdateStruct is set in $userGroupUpdateStruct, this method internally creates a content draft, updates ts with the provided data and publishes the draft. If a draft is explicitly required, the user group can be updated via the content service methods.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$userGroup | UserGroup | - | - |
$userGroupUpdateStruct | UserGroupUpdateStruct | - | - |
Return values
Tags
updateUserPassword() ¶
Validates and updates just the user's password.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$user | User | - | - |
$newPassword | string | - | - |
Return values
Tags
updateUserToken() ¶
Update the user token information specified by the user token struct.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$user | User | - | - |
$userTokenUpdateStruct | UserTokenUpdateStruct | - | - |
Return values
validatePassword() ¶
Validates given password.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$password | string | - | - |
$context | PasswordValidationContext|null | null | - |
Return values
array<string|int, ValidationError>