User Management
- class nc_py_api.users.UserInfo(raw_data: dict)[source]
User information description.
- property storage_location: str
User’s home folder. Can be empty for LDAP or when the caller does not have administrative rights.
- 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.