Nextcloud PHP API (master)

IUser

Interface IUser

Tags
since
8.0.0

Table of Contents

Methods

canChangeAvatar()  : bool
check if the backend allows the user to change his avatar on Personal page
canChangeDisplayName()  : bool
check if the backend supports changing display names
canChangePassword()  : bool
check if the backend supports changing passwords
delete()  : bool
Delete the user
getAvatarImage()  : IImage|null
get the avatar image if it exists
getBackend()  : UserInterface|null
Get the backend for the current user object
getBackendClassName()  : string
Get the name of the backend class the user is connected with
getCloudId()  : string
get the federation cloud id
getDisplayName()  : string
get the display name for the user, if no specific display name is set it will fallback to the user id
getEMailAddress()  : string|null
get the user's email address
getHome()  : string
get the users home folder to mount
getLastLogin()  : int
returns the timestamp of the user's last login or 0 if the user did never login
getManagerUids()  : array<string|int, string>
Get the user's manager UIDs
getPrimaryEMailAddress()  : string|null
get the user's preferred email address
getQuota()  : string
get the users' quota in human readable form. If a specific quota is not set for the user, the default value is returned. If a default setting was not set otherwise, it is return as 'none', i.e. quota is not limited.
getSystemEMailAddress()  : string|null
get the user's system email address
getUID()  : string
get the user id
isEnabled()  : bool
check if the user is enabled
setDisplayName()  : bool
set the display name for the user
setEMailAddress()  : void
set the email address of the user
setEnabled()  : mixed
set the enabled status for the user
setManagerUids()  : void
Set the user's manager UIDs
setPassword()  : bool
Set the password of the user
setPrimaryEMailAddress()  : void
Set the primary email address of the user.
setQuota()  : void
set the users' quota
setSystemEMailAddress()  : void
Set the system email address of the user
updateLastLoginTimestamp()  : mixed
updates the timestamp of the most recent login of this user

Methods

canChangeAvatar()

check if the backend allows the user to change his avatar on Personal page

public canChangeAvatar() : bool
Tags
since
8.0.0
Return values
bool

canChangeDisplayName()

check if the backend supports changing display names

public canChangeDisplayName() : bool
Tags
since
8.0.0
Return values
bool

canChangePassword()

check if the backend supports changing passwords

public canChangePassword() : bool
Tags
since
8.0.0
Return values
bool

delete()

Delete the user

public delete() : bool
Tags
since
8.0.0
Return values
bool

getAvatarImage()

get the avatar image if it exists

public getAvatarImage(int $size) : IImage|null
Parameters
$size : int
Tags
since
9.0.0
Return values
IImage|null

getBackendClassName()

Get the name of the backend class the user is connected with

public getBackendClassName() : string
Tags
since
8.0.0
Return values
string

getCloudId()

get the federation cloud id

public getCloudId() : string
Tags
since
9.0.0
Return values
string

getDisplayName()

get the display name for the user, if no specific display name is set it will fallback to the user id

public getDisplayName() : string
Tags
since
8.0.0
Return values
string

getEMailAddress()

get the user's email address

public getEMailAddress() : string|null
Tags
since
9.0.0
Return values
string|null

getHome()

get the users home folder to mount

public getHome() : string
Tags
since
8.0.0
Return values
string

getLastLogin()

returns the timestamp of the user's last login or 0 if the user did never login

public getLastLogin() : int
Tags
since
8.0.0
Return values
int

getManagerUids()

Get the user's manager UIDs

public getManagerUids() : array<string|int, string>
Tags
since
27.0.0
Return values
array<string|int, string>

getPrimaryEMailAddress()

get the user's preferred email address

public getPrimaryEMailAddress() : string|null

The primary mail address may be set be the user to specify a different email address where mails by Nextcloud are sent to. It is not necessarily set.

Use this getter only when the primary address is needed. For picking the proper address to e.g. send a mail to, use getEMailAddress().

Tags
since
23.0.0
Return values
string|null

getQuota()

get the users' quota in human readable form. If a specific quota is not set for the user, the default value is returned. If a default setting was not set otherwise, it is return as 'none', i.e. quota is not limited.

public getQuota() : string
Tags
since
9.0.0
Return values
string

getSystemEMailAddress()

get the user's system email address

public getSystemEMailAddress() : string|null

The system mail address may be read only and may be set from different sources like LDAP, SAML or simply the admin.

Use this getter only when the system address is needed. For picking the proper address to e.g. send a mail to, use getEMailAddress().

Tags
since
23.0.0
Return values
string|null

getUID()

get the user id

public getUID() : string
Tags
since
8.0.0
Return values
string

isEnabled()

check if the user is enabled

public isEnabled() : bool
Tags
since
8.0.0
Return values
bool

setDisplayName()

set the display name for the user

public setDisplayName(string $displayName) : bool
Parameters
$displayName : string
Tags
since
8.0.0
since
25.0.0

Throw InvalidArgumentException

throws
InvalidArgumentException
Return values
bool

setEMailAddress()

set the email address of the user

public setEMailAddress(string|null $mailAddress) : void

It is an alias to setSystemEMailAddress()

Parameters
$mailAddress : string|null
Tags
since
9.0.0
deprecated
23.0.0

use setSystemEMailAddress() or setPrimaryEMailAddress()

setEnabled()

set the enabled status for the user

public setEnabled([bool $enabled = true ]) : mixed
Parameters
$enabled : bool = true
Tags
since
8.0.0

setManagerUids()

Set the user's manager UIDs

public setManagerUids(array<string|int, string> $uids) : void
Parameters
$uids : array<string|int, string>

UIDs of all managers

Tags
since
27.0.0

setPassword()

Set the password of the user

public setPassword(string $password[, string $recoveryPassword = null ]) : bool
Parameters
$password : string
$recoveryPassword : string = null

for the encryption app to reset encryption keys

Tags
since
8.0.0
Return values
bool

setPrimaryEMailAddress()

Set the primary email address of the user.

public setPrimaryEMailAddress(string $mailAddress) : void

This method should be typically called when the user is changing their own primary address and is not allowed to change their system email.

The mail address provided here must be already registered as an additional mail in the user account and also be verified locally. Also an empty string is allowed to delete this preference.

Parameters
$mailAddress : string
Tags
throws
InvalidArgumentException

when the provided email address does not satisfy constraints.

since
23.0.0

setQuota()

set the users' quota

public setQuota(string $quota) : void
Parameters
$quota : string
Tags
since
9.0.0

setSystemEMailAddress()

Set the system email address of the user

public setSystemEMailAddress(string $mailAddress) : void

This is supposed to be used when the email is set from different sources (i.e. other user backends, admin).

Parameters
$mailAddress : string
Tags
since
23.0.0

updateLastLoginTimestamp()

updates the timestamp of the most recent login of this user

public updateLastLoginTimestamp() : mixed
Tags
since
8.0.0

        
On this page

Search results