Nextcloud PHP API (stable19)

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

callForAllUsers()  : mixed
callForSeenUsers()  : mixed
checkPassword()  : mixed
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
returns how many users per backend exist (if supported by backend)
createUser()  : bool|IUser
createUserFromBackend()  : IUser|null
get()  : IUser|null
get a user by user id
getBackends()  : \OCP\UserInterface[]
Get the active backends
getByEmail()  : \OCP\IUser[]
registerBackend()  : mixed
register a user backend
removeBackend()  : mixed
remove a user backend
search()  : \OCP\IUser[]
search by user id
searchDisplayName()  : \OCP\IUser[]
search by displayName
userExists()  : bool
check if a user exists

Methods

callForAllUsers()

public callForAllUsers(Closure $callback[, string $search = '' ]) : mixed
Parameters
$callback : Closure
$search : string = ''
Tags
since
9.0.0
Return values
mixed

callForSeenUsers()

public callForSeenUsers(Closure $callback) : mixed
Parameters
$callback : Closure
Tags
since
11.0.0
Return values
mixed

checkPassword()

Check if the password is valid for the user

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

the User object on success, false otherwise

clearBackends()

remove all user backends

public clearBackends() : mixed
Tags
since
8.0.0
Return values
mixed

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()

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

public countUsers() : array
Tags
since
8.0.0
Return values
array

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

createUser()

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

getBackends()

Get the active backends

public getBackends() : \OCP\UserInterface[]
Tags
since
8.0.0
Return values
\OCP\UserInterface[]

getByEmail()

public getByEmail(string $email) : \OCP\IUser[]
Parameters
$email : string
Tags
since
9.1.0
Return values
\OCP\IUser[]

search by user id

public search(string $pattern[, int $limit = null ][, int $offset = null ]) : \OCP\IUser[]
Parameters
$pattern : string
$limit : int = null
$offset : int = null
Tags
since
8.0.0
Return values
\OCP\IUser[]

searchDisplayName()

search by displayName

public searchDisplayName(string $pattern[, int $limit = null ][, int $offset = null ]) : \OCP\IUser[]
Parameters
$pattern : string
$limit : int = null
$offset : int = null
Tags
since
8.0.0
Return values
\OCP\IUser[]

userExists()

check if a user exists

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

Search results