User Management
- class nc_py_api.users.UserInfo(raw_data: dict)[source]
User information description.
- property enabled: bool
Flag indicating whether the user is enabled.
- property storage_location: str
User’s home folder. Can be empty for LDAP or when the caller does not have administrative rights.
- property user_id: str
User ID.
- property last_login: datetime
Last user login time.
- property backend: str
The type of backend in which user information is stored.
- property subadmin: list[str]
IDs of groups of which the user is a subadmin.
- property quota: dict
Quota for the user, if set.
- property manager: str
The user’s manager UID.
- property email: str
Email address of the user.
- property additional_mail: list[str]
List of additional emails.
- property display_name: str
The display name of the new user.
- property phone: str
Phone of the user.
- property address: str
Address of the user.
- property website: str
Link to user website.
- property twitter: str
Twitter handle.
- property fediverse: str
Fediverse(e.g. Mastodon) in the user profile.
- property organisation: str
Organisation in the user profile.
- property role: str
Role in the user profile.
- property headline: str
Headline in the user profile.
- property biography: str
Biography in the user profile.
- property profile_enabled: bool
Flag indicating whether the user profile is enabled.
- property groups: list[str]
ID of the groups the user is a member of.
- property language: str
The language to use when sending something to a user.
- property locale: str
The locale set for the user.
- property notify_email: str
The user’s preferred email address.
Note
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.
- property backend_capabilities: dict
By default, only the
setDisplayName
andsetPassword
keys are available.
- class nc_py_api.users._UsersAPI(session: NcSessionBasic)[source]
The class provides the user API on the Nextcloud server.
Note
In NextcloudApp mode, only
get_list
,editable_fields
andget_user
methods are available.- get_list(mask: str | None = '', limit: int | None = None, offset: int | None = None) list[str] [source]
Returns list of user IDs.
- create(user_id: str, display_name: str | None = None, **kwargs) None [source]
Create a new user on the Nextcloud server.
- Parameters:
user_id – id of the user to create.
display_name – display name for a created user.
kwargs – See below.
Additionally supported arguments:
password
- password that should be set for user.email
- email of the new user. Ifpassword
is not provided, then this field should be filled.groups
- list of groups IDs to which user belongs.subadmin
- boolean indicating is user should be the subadmin.quota
- quota for the user, if needed.language
- default language for the user.
- edit(user_id: str, **kwargs) None [source]
Edits user metadata.
- Parameters:
user_id – id of the user.
kwargs – dictionary where keys are values from
editable_fields
method, and values to set.
- demote_from_subadmin(user_id: str, group_id: str) None [source]
Removes user from the admin role of the group.
- get_avatar(user_id: str = '', size: Literal[64, 512] = 512, dark: bool = False, guest: bool = False) bytes [source]
Returns user avatar binary data.
- Parameters:
user_id – The ID of the user whose avatar should be returned. .. note:: To return the current user’s avatar, leave the field blank.
size – Size of the avatar. Currently supported values:
64
and512
.dark – Flag indicating whether a dark theme avatar should be returned or not.
guest – Flag indicating whether user ID is a guest name or not.