IUserManager
in
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)
- assignedUserId(string $uid)
- preUnassignedUserId(string $uid)
- postUnassignedUserId(string $uid)
Tags
Table of Contents
Constants
- MAX_PASSWORD_LENGTH : mixed = 469
Methods
- callForAllUsers() : mixed
- callForSeenUsers() : mixed
- checkPassword() : IUser|false
- Check if the password is valid for the user
- clearBackends() : void
- remove all user backends
- countDisabledUsers() : int
- returns how many users have logged in once
- countSeenUsers() : int
- returns how many users have logged in once
- countUsers() : array<string, int>
- Get how many users per backend exist (if supported by backend)
- countUsersTotal() : int|false
- Get how many users exists in total, whithin limit
- createUser() : false|IUser
- createUserFromBackend() : IUser|null
- get() : IUser|null
- get a user by user id
- getAvatarUrlDark() : non-empty-string
- getAvatarUrlLight() : non-empty-string
- getBackends() : array<string|int, UserInterface>
- Get the active backends
- getByEmail() : array<string|int, IUser>
- returns all users having the provided email set as system email address
- getDisabledUsers() : array<string|int, IUser>
- getDisplayName() : non-empty-string|null
- Get the display name of a user
- getExistingUser() : IUser
- Get a user by user id without validating that the user exists.
- getFederatedUser() : IUser
- Get a read-only user from a cloud ID for showing the display name of a remote federation user (e.g. the "deleted by" user of a federated share) that has no local account.
- getLastLoggedInUsers() : array<int, string>
- Gets the list of users sorted by lastLogin, from most recent to least recent
- getSeenUsers() : Iterator<string, IUser>
- Gets the list of users.
- registerBackend() : void
- register a user backend
- removeBackend() : void
- remove a user backend
- search() : array<string|int, IUser>
- search by user id
- searchDisplayName() : array<int, IUser>
- search by displayName
- searchKnownUsersByDisplayName() : array<string|int, IUser>
- Search known users (from phonebook sync) by displayName
- userExists() : bool
- Check if a user exists.
- validateUserId() : void
Constants
MAX_PASSWORD_LENGTH
public
mixed
MAX_PASSWORD_LENGTH
= 469
Tags
Methods
callForAllUsers()
public
callForAllUsers(Closure $callback[, string $search = '' ]) : mixed
Parameters
- $callback : Closure
- $search : string = ''
Tags
callForSeenUsers()
public
callForSeenUsers(Closure $callback) : mixed
Parameters
- $callback : Closure
Tags
checkPassword()
Check if the password is valid for the user
public
checkPassword(string $loginName, string $password) : IUser|false
Parameters
- $loginName : string
- $password : string
Tags
Return values
IUser|false —the User object on success, false otherwise
clearBackends()
remove all user backends
public
clearBackends() : void
Tags
countDisabledUsers()
returns how many users have logged in once
public
countDisabledUsers() : int
Tags
Return values
intcountSeenUsers()
returns how many users have logged in once
public
countSeenUsers() : int
Tags
Return values
intcountUsers()
Get how many users per backend exist (if supported by backend)
public
countUsers([bool $onlyMappedUsers = false ]) : array<string, int>
Parameters
- $onlyMappedUsers : bool = false
Tags
Return values
array<string, int> —an array of backend class name as key and count number as value
countUsersTotal()
Get how many users exists in total, whithin limit
public
countUsersTotal([int $limit = 0 ][, bool $onlyMappedUsers = false ]) : int|false
Parameters
- $limit : int = 0
-
Limit the count to avoid resource waste. 0 to disable
- $onlyMappedUsers : bool = false
-
Count mapped users instead of all users for compatible backends
Tags
Return values
int|falsecreateUser()
public
createUser(string $uid, string $password) : false|IUser
Parameters
- $uid : string
- $password : string
Tags
Return values
false|IUser —the created user or false
createUserFromBackend()
public
createUserFromBackend(string $uid, string $password, UserInterface $backend) : IUser|null
Parameters
- $uid : string
- $password : string
- $backend : UserInterface
Tags
Return values
IUser|nullget()
get a user by user id
public
get(string $uid) : IUser|null
If you're already 100% sure that the user exists, consider IUserManager::getExistingUser which has less overhead.
Parameters
- $uid : string
Tags
Return values
IUser|null —Either the user or null if the specified user does not exist
getAvatarUrlDark()
public
getAvatarUrlDark(string $userId, 64|512 $size) : non-empty-string
Parameters
- $userId : string
- $size : 64|512
Tags
Return values
non-empty-stringgetAvatarUrlLight()
public
getAvatarUrlLight(string $userId, 64|512 $size) : non-empty-string
Parameters
- $userId : string
- $size : 64|512
Tags
Return values
non-empty-stringgetBackends()
Get the active backends
public
getBackends() : array<string|int, UserInterface>
Tags
Return values
array<string|int, UserInterface>getByEmail()
returns all users having the provided email set as system email address
public
getByEmail(string $email) : array<string|int, IUser>
Parameters
- $email : string
Tags
Return values
array<string|int, IUser>getDisabledUsers()
public
getDisabledUsers([int|null $limit = null ][, int $offset = 0 ][, string $search = '' ]) : array<string|int, IUser>
Parameters
- $limit : int|null = null
- $offset : int = 0
- $search : string = ''
Tags
Return values
array<string|int, IUser>getDisplayName()
Get the display name of a user
public
getDisplayName(string $uid) : non-empty-string|null
Parameters
- $uid : string
Tags
Return values
non-empty-string|nullgetExistingUser()
Get a user by user id without validating that the user exists.
public
getExistingUser(string $userId[, string|null $displayName = null ]) : IUser
This should only be used if you're certain that the provided user id exists in the system. Using this to get a user object for a non-existing user will lead to unexpected behavior down the line.
If you're not 100% sure that the user exists, use IUserManager::get instead.
Parameters
- $userId : string
- $displayName : string|null = null
-
If the display name is known in advance you can provide it so it doesn't have to be fetched again
Tags
Return values
IUsergetFederatedUser()
Get a read-only user from a cloud ID for showing the display name of a remote federation user (e.g. the "deleted by" user of a federated share) that has no local account.
public
getFederatedUser(ICloudId $cloudId) : IUser
Parameters
- $cloudId : ICloudId
Tags
Return values
IUsergetLastLoggedInUsers()
Gets the list of users sorted by lastLogin, from most recent to least recent
public
getLastLoggedInUsers([int|null $limit = null ][, int $offset = 0 ][, string $search = '' ]) : array<int, string>
Parameters
- $limit : int|null = null
-
how many records to fetch
- $offset : int = 0
-
from which offset to fetch
- $search : string = ''
-
search users based on search params
Tags
Return values
array<int, string> —list of user IDs
getSeenUsers()
Gets the list of users.
public
getSeenUsers([int $offset = 0 ][, int|null $limit = null ]) : Iterator<string, IUser>
An iterator is returned allowing the caller to stop the iteration at any time. The offset argument allows the caller to continue the iteration at a specific offset.
Parameters
- $offset : int = 0
-
from which offset to fetch
- $limit : int|null = null
-
maximum number of records to fetch
Tags
Return values
Iterator<string, IUser> —list of IUser object
registerBackend()
register a user backend
public
registerBackend(UserInterface $backend) : void
Parameters
- $backend : UserInterface
Tags
removeBackend()
remove a user backend
public
removeBackend(UserInterface $backend) : void
Parameters
- $backend : UserInterface
Tags
search()
search by user id
public
search(string $pattern[, int $limit = null ][, int $offset = null ]) : array<string|int, IUser>
use searchDisplayName instead
Parameters
- $pattern : string
- $limit : int = null
- $offset : int = null
Tags
Return values
array<string|int, IUser>searchDisplayName()
search by displayName
public
searchDisplayName(string $pattern[, int $limit = null ][, int $offset = null ]) : array<int, IUser>
Parameters
- $pattern : string
- $limit : int = null
- $offset : int = null
Tags
Return values
array<int, IUser>searchKnownUsersByDisplayName()
Search known users (from phonebook sync) by displayName
public
searchKnownUsersByDisplayName(string $searcher, string $pattern[, int|null $limit = null ][, int|null $offset = null ]) : array<string|int, IUser>
Parameters
- $searcher : string
- $pattern : string
- $limit : int|null = null
- $offset : int|null = null
Tags
Return values
array<string|int, IUser>userExists()
Check if a user exists.
public
userExists(string $uid[, array<int, string> $excludeBackends = [] ]) : bool
Parameters
- $uid : string
- $excludeBackends : array<int, string> = []
-
A list of IUserBackend::getBackendName() that need to be excluded from the search.
Tags
Return values
boolvalidateUserId()
public
validateUserId(string $uid[, bool $checkDataDirectory = false ]) : void
Parameters
- $uid : string
-
The user ID to validate
- $checkDataDirectory : bool = false
-
Whether it should be checked if files for the ID exist inside the data directory