UserManager
in package
Service class for managing users and their permissions
Table of Contents
Properties
- $managingUser : LSWebUser
- $targetUser : User
Methods
- __construct() : mixed
- canAssignPermissions() : bool
- Returns true if the managing user can assign permissions to the target user.
- canAssignRole() : bool
- Returns true if the managing user can assign roles to the target user.
- canEdit() : bool
- Returns true if the managing user can edit the attribute of the target user Return true if target is same then managing (user can always update himself)
- deleteUser() : OperationResult
- Delete the given User and reassign their owned records to the site administrator.
Properties
$managingUser
private
LSWebUser
$managingUser
the user managing other users
$targetUser
private
User
$targetUser
the user being handled
Methods
__construct()
public
__construct([LSWebUser|null $managingUser = null ][, User|null $targetUser = null ]) : mixed
Parameters
- $managingUser : LSWebUser|null = null
- $targetUser : User|null = null
canAssignPermissions()
Returns true if the managing user can assign permissions to the target user.
public
canAssignPermissions() : bool
Return values
boolcanAssignRole()
Returns true if the managing user can assign roles to the target user.
public
canAssignRole() : bool
Return values
boolcanEdit()
Returns true if the managing user can edit the attribute of the target user Return true if target is same then managing (user can always update himself)
public
canEdit() : bool
Return values
booldeleteUser()
Delete the given User and reassign their owned records to the site administrator.
public
deleteUser(User $user) : OperationResult
Transfers any UserGroup.owner_id and Participant.owner_uid owned by the user to the site admin (uid=1), removes the user's group memberships, and then deletes the user. The whole operation is performed inside a database transaction and will be rolled back if an error occurs. Note: user permissions are not removed by this method.
Parameters
- $user : User
-
The User model to delete; the method uses $user->uid to identify related records.
Return values
OperationResult —An OperationResult whose success flag indicates whether the deletion committed, and whose messages describe actions taken or errors encountered.