Manager¶
- 
class 
OC\User\Manager¶ - Class ManagerHooks available in scope \OC\User:- preSetPassword(\OC\User\User $user, string $password, string $recoverPassword)- postSetPassword(\OC\User\User $user, string $password, string $recoverPassword)- preDelete(\OC\User\User $user)- postDelete(\OC\User\User $user)- preCreateUser(string $uid, string $password)- postCreateUser(\OC\User\User $user, string $password)- change(\OC\User\User $user)- assignedUserId(string $uid)- preUnassignedUserId(string $uid)- postUnassignedUserId(string $uid)
Source: lib/private/User/Manager.php#73 Parent: OC\Hooks\PublicEmitterImplements: OCP\IUserManager 
Properties¶
Methods¶
- 
public 
OC\User\Manager::__construct($config, $oldDispatcher, $cacheFactory, $eventDispatcher)¶ Source: lib/private/User/Manager.php#96 
- 
public 
OC\User\Manager::getBackends()¶ - Get the active backends
Source: lib/private/User/Manager.php#115 Returns: \OCP\UserInterface[] 
- 
public 
OC\User\Manager::registerBackend($backend)¶ - register a user backend
Source: Parameters: - $backend (
OCP\UserInterface) 
 - $backend (
 
- 
public 
OC\User\Manager::removeBackend($backend)¶ - remove a user backend
Source: Parameters: - $backend (
OCP\UserInterface) 
 - $backend (
 
- 
public 
OC\User\Manager::clearBackends()¶ - remove all user backends
Source: lib/private/User/Manager.php#143  
- 
public 
OC\User\Manager::get($uid)¶ - get a user by user id
Source: Parameters: - $uid (string)
 
Returns: \OC\User\User| null Either the user or null if the specified user does not exist 
- 
protected 
OC\User\Manager::getUserObject($uid, $backend, $cacheUser=true)¶ - get or construct the user object
Source: Parameters: - $uid (string)
 - $backend (
OCP\UserInterface) - $cacheUser (bool) If false the newly created user object will not be cached
 
Returns:  
- 
public 
OC\User\Manager::userExists($uid)¶ - check if a user exists
Source: Parameters: - $uid (string)
 
Returns: bool
 
- 
public 
OC\User\Manager::checkPassword($loginName, $password)¶ - Check if the password is valid for the user
Source: Parameters: - $loginName (string)
 - $password (string)
 
Returns: mixed the User object on success, false otherwise
 
- 
public 
OC\User\Manager::checkPasswordNoLogging($loginName, $password)¶ - Check if the password is valid for the user
Source: Parameters: - $loginName (string)
 - $password (string)
 
Returns: \OCP\IUser| bool the User object on success, false otherwise 
- 
public 
OC\User\Manager::search($pattern, $limit=null, $offset=null)¶ - search by user id
Source: Parameters: - $pattern (string)
 - $limit (int)
 - $offset (int)
 
Returns:  
- 
public 
OC\User\Manager::searchDisplayName($pattern, $limit=null, $offset=null)¶ - search by displayName
Source: Parameters: - $pattern (string)
 - $limit (int)
 - $offset (int)
 
Returns:  
- 
public 
OC\User\Manager::searchKnownUsersByDisplayName($searcher, $pattern, $limit=null, $offset=null)¶ - Search known users (from phonebook sync) by displayName
Source: Parameters: - $searcher (string)
 - $pattern (string)
 - $limit (int | null)
 - $offset (int | null)
 
Returns:  
- 
public 
OC\User\Manager::createUser($uid, $password)¶ Source: Parameters: - $uid (string)
 - $password (string)
 
Throws: \InvalidArgumentExceptionReturns: bool |
\OCP\IUserthe created user or false
- 
public 
OC\User\Manager::createUserFromBackend($uid, $password, $backend)¶ Source: Parameters: - $uid (string)
 - $password (string)
 - $backend (
OCP\UserInterface) 
Returns: \OCP\IUser| nullThrows: \InvalidArgumentException
- 
public 
OC\User\Manager::countUsers($hasLoggedIn=false)¶ - returns how many users per backend exist (if supported by backend)
Source: Parameters: - $hasLoggedIn (bool) when true only users that have a lastLogin
 
entry in the preferences table will be affected
Returns: array | int an array of backend class as key and count number as value if $hasLoggedIn is true only an int is returned
 
- 
public 
OC\User\Manager::countUsersOfGroups($groups)¶ - returns how many users per backend exist in the requested groups (if supported by backend)
Source: Parameters: - $groups (
OCP\IGroup[]) an array of gid to search in 
Returns: array | int an array of backend class as key and count number as value if $hasLoggedIn is true only an int is returned
 - $groups (
 
- 
public 
OC\User\Manager::callForAllUsers($callback, $search="", $onlySeen=false)¶ - The callback is executed for each user on each backend.If the callback returns false no further users will be retrieved.
Source: Parameters: - $callback (
Closure) - $search (string)
 - $onlySeen (bool) when true only users that have a lastLogin entry
 
in the preferences table will be affected
Since: 9.0.0
 - $callback (
 
- 
public 
OC\User\Manager::countDisabledUsers()¶ - returns how many users are disabled
Source: lib/private/User/Manager.php#557 Returns: int Since: 12.0.0  
- 
public 
OC\User\Manager::countDisabledUsersOfGroups($groups)¶ - returns how many users are disabled in the requested groups
Source: Parameters: - $groups (array) groupids to search
 
Returns: int
Since: 14.0.0
 
- 
public 
OC\User\Manager::countSeenUsers()¶ - returns how many users have logged in once
Source: lib/private/User/Manager.php#615 Returns: int Since: 11.0.0  
- 
public 
OC\User\Manager::callForSeenUsers($callback)¶ Source: Parameters: - $callback (
Closure) 
Since: 11.0.0
- $callback (
 
- 
public 
OC\User\Manager::getByEmail($email)¶ Source: Parameters: - $email (string)
 
Returns: Since: 9.1.0