Manager

class OC\User\Manager
Class Manager
Hooks 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\PublicEmitter
Implements: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:

lib/private/User/Manager.php#124

Parameters:
public OC\User\Manager::removeBackend($backend)
remove a user backend
Source:

lib/private/User/Manager.php#133

Parameters:
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:

lib/private/User/Manager.php#154

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:

lib/private/User/Manager.php#193

Parameters:
  • $uid (string)
  • $backend (OCP\UserInterface)
  • $cacheUser (bool) If false the newly created user object will not be cached
Returns:

\OC\User\User

public OC\User\Manager::userExists($uid)
check if a user exists
Source:

lib/private/User/Manager.php#215

Parameters:
  • $uid (string)
Returns:

bool

public OC\User\Manager::checkPassword($loginName, $password)
Check if the password is valid for the user
Source:

lib/private/User/Manager.php#227

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:

lib/private/User/Manager.php#245

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:

lib/private/User/Manager.php#283

Parameters:
  • $pattern (string)
  • $limit (int)
  • $offset (int)
Returns:

\OC\User\User[]

public OC\User\Manager::searchDisplayName($pattern, $limit=null, $offset=null)
search by displayName
Source:

lib/private/User/Manager.php#312

Parameters:
  • $pattern (string)
  • $limit (int)
  • $offset (int)
Returns:

\OC\User\User[]

public OC\User\Manager::searchKnownUsersByDisplayName($searcher, $pattern, $limit=null, $offset=null)
Search known users (from phonebook sync) by displayName
Source:

lib/private/User/Manager.php#342

Parameters:
  • $searcher (string)
  • $pattern (string)
  • $limit (int | null)
  • $offset (int | null)
Returns:

\OCP\IUser[]

public OC\User\Manager::createUser($uid, $password)
Source:

lib/private/User/Manager.php#374

Parameters:
  • $uid (string)
  • $password (string)
Throws:

\InvalidArgumentException

Returns:

bool | \OCP\IUser the created user or false

public OC\User\Manager::createUserFromBackend($uid, $password, $backend)
Source:

lib/private/User/Manager.php#410

Parameters:
Returns:

\OCP\IUser | null

Throws:

\InvalidArgumentException

public OC\User\Manager::countUsers($hasLoggedIn=false)
returns how many users per backend exist (if supported by backend)
Source:

lib/private/User/Manager.php#473

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:

lib/private/User/Manager.php#505

Parameters:
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::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:

lib/private/User/Manager.php#526

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

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:

lib/private/User/Manager.php#586

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:

lib/private/User/Manager.php#636

Parameters:
  • $callback (Closure)
Since:

11.0.0

public OC\User\Manager::getByEmail($email)
Source:

lib/private/User/Manager.php#702

Parameters:
  • $email (string)
Returns:

\OCP\IUser[]

Since:

9.1.0