Nextcloud PHP API (master)

IUserManager

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
since
8.0.0

Table of Contents

Constants

MAX_PASSWORD_LENGTH  = 469

Methods

callForAllUsers()  : mixed
callForSeenUsers()  : mixed
checkPassword()  : IUser|false
Check if the password is valid for the user
clearBackends()  : mixed
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)
createUser()  : false|IUser
createUserFromBackend()  : IUser|null
get()  : IUser|null
get a user by user id
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()  : string|null
Get the display name of a user
registerBackend()  : mixed
register a user backend
removeBackend()  : mixed
remove a user backend
search()  : array<string|int, IUser>
search by user id
searchDisplayName()  : array<string|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
since
26.0.0

Methods

callForAllUsers()

public callForAllUsers(Closure $callback[, string $search = '' ]) : mixed
Parameters
$callback : Closure
$search : string = ''
Tags
psalm-param

\Closure(\OCP\IUser):void $callback

since
9.0.0

callForSeenUsers()

public callForSeenUsers(Closure $callback) : mixed
Parameters
$callback : Closure
Tags
psalm-param

\Closure(\OCP\IUser):?bool $callback

since
11.0.0

checkPassword()

Check if the password is valid for the user

public checkPassword(string $loginName, string $password) : IUser|false
Parameters
$loginName : string
$password : string
Tags
since
8.0.0
Return values
IUser|false

the User object on success, false otherwise

clearBackends()

remove all user backends

public clearBackends() : mixed
Tags
since
8.0.0

countDisabledUsers()

returns how many users have logged in once

public countDisabledUsers() : int
Tags
since
11.0.0
Return values
int

countSeenUsers()

returns how many users have logged in once

public countSeenUsers() : int
Tags
since
11.0.0
Return values
int

countUsers()

Get how many users per backend exist (if supported by backend)

public countUsers() : array<string, int>
Tags
since
8.0.0
Return values
array<string, int>

an array of backend class name as key and count number as value

createUser()

public createUser(string $uid, string $password) : false|IUser
Parameters
$uid : string
$password : string
Tags
throws
InvalidArgumentException
since
8.0.0
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
throws
InvalidArgumentException
since
12.0.0
Return values
IUser|null

get()

get a user by user id

public get(string $uid) : IUser|null
Parameters
$uid : string
Tags
since
8.0.0
Return values
IUser|null

Either the user or null if the specified user does not exist

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
since
9.1.0
Return values
array<string|int, IUser>

getDisabledUsers()

public getDisabledUsers([int|null $limit = null ][, int $offset = 0 ]) : array<string|int, IUser>
Parameters
$limit : int|null = null
$offset : int = 0
Tags
since
28.0.0
Return values
array<string|int, IUser>

getDisplayName()

Get the display name of a user

public getDisplayName(string $uid) : string|null
Parameters
$uid : string
Tags
since
25.0.0
Return values
string|null

search by user id

public search(string $pattern[, int $limit = null ][, int $offset = null ]) : array<string|int, IUser>
Parameters
$pattern : string
$limit : int = null
$offset : int = null
Tags
since
8.0.0
Return values
array<string|int, IUser>

searchDisplayName()

search by displayName

public searchDisplayName(string $pattern[, int $limit = null ][, int $offset = null ]) : array<string|int, IUser>
Parameters
$pattern : string
$limit : int = null
$offset : int = null
Tags
since
8.0.0
Return values
array<string|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
since
21.0.1
Return values
array<string|int, IUser>

userExists()

check if a user exists

public userExists(string $uid) : bool
Parameters
$uid : string
Tags
since
8.0.0
Return values
bool

validateUserId()

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

Tags
throws
InvalidArgumentException

Message is an already translated string with a reason why the ID is not valid

since
26.0.0

        
On this page

Search results