\OCPIUserManager

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)

Summary

Methods
Constants
registerBackend()
getBackends()
removeBackend()
clearBackends()
get()
userExists()
checkPassword()
search()
find()
searchDisplayName()
createUser()
countUsers()
callForAllUsers()
countSeenUsers()
callForSeenUsers()
getByEmail()
createUserFromBackend()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

registerBackend()

registerBackend(\OCP\UserInterface  $backend) 

register a user backend

Parameters

\OCP\UserInterface $backend

getBackends()

getBackends() : array<mixed,\OCP\UserInterface>

Get the active backends

Returns

array<mixed,\OCP\UserInterface>

removeBackend()

removeBackend(\OCP\UserInterface  $backend) 

remove a user backend

Parameters

\OCP\UserInterface $backend

clearBackends()

clearBackends() 

remove all user backends

get()

get(string  $uid) : \OCP\IUser|null

get a user by user id

Parameters

string $uid

Returns

\OCP\IUser|null —

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

userExists()

userExists(string  $uid) : boolean

check if a user exists

Parameters

string $uid

Returns

boolean

checkPassword()

checkPassword(string  $loginName, string  $password) : mixed

Check if the password is valid for the user

Parameters

string $loginName
string $password

Returns

mixed —

the User object on success, false otherwise

search()

search(string  $pattern, integer  $limit = null, integer  $offset = null) : array<mixed,\OCP\IUser>

search by user id

Parameters

string $pattern
integer $limit
integer $offset

Returns

array<mixed,\OCP\IUser>

find()

find(string  $pattern, integer  $limit = null, integer  $offset = null) : array<mixed,\OCP\IUser>

find a user account by checking user_id, display name and email fields

Parameters

string $pattern
integer $limit
integer $offset

Returns

array<mixed,\OCP\IUser>

searchDisplayName()

searchDisplayName(string  $pattern, integer  $limit = null, integer  $offset = null) : array<mixed,\OCP\IUser>

search by displayName

Parameters

string $pattern
integer $limit
integer $offset

Returns

array<mixed,\OCP\IUser>

createUser()

createUser(string  $uid, string  $password) : boolean|\OCP\IUser

Parameters

string $uid
string $password

Throws

\Exception

Returns

boolean|\OCP\IUser

the created user of false

countUsers()

countUsers() : array

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

Returns

array —

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

callForAllUsers()

callForAllUsers(\Closure  $callback, string  $search = '') 

Parameters

\Closure $callback
string $search

countSeenUsers()

countSeenUsers() : integer

returns how many users have logged in once

Returns

integer

callForSeenUsers()

callForSeenUsers(\Closure  $callback) 

Parameters

\Closure $callback

getByEmail()

getByEmail(string  $email) : array<mixed,\OCP\IUser>

Parameters

string $email

Returns

array<mixed,\OCP\IUser>

createUserFromBackend()

createUserFromBackend(string  $uid, string  $password, \OCP\UserInterface  $backend) : \OCP\IUser

Parameters

string $uid
string $password
\OCP\UserInterface $backend

Returns

\OCP\IUser

| null