tcms.rpc.api.user module¶
- tcms.rpc.api.user.add_attachment(filename, b64content, **kwargs)[source]¶
- RPC User.add_attachment(filename, b64content)
Attach a file under the currently logged-in user!
This method is meant to be used by SimpleMDE combined with post_save processing for various models like TestPlan and TestCase. While files uploaded by this method will be attached and available (if you know their URL), there is no UI to see all of the files uploaded by a certain user or manage them!
- tcms.rpc.api.user.deactivate(query)[source]¶
- RPC User.deactivate(query)
Deactivate the selected user(s) so that they cannot login again!
- Parameters:
query (dict) – Field lookups for
django.contrib.auth.models.User- Returns:
Serialized list of
django.contrib.auth.models.Userobjects- Return type:
- Raises:
PermissionDenied – if missing the auth.change_user permission when updating another user or when passwords don’t match.
Specify by user ID:
>>> User.deactivate({'pk': 123})
Specify multiple users by ID:
>>> User.deactivate({'pk__in': [123, 456]})
Specify by username:
>>> User.deactivate({'username': 'john-doe'})
Specify by email:
>>> User.deactivate({'email__icontains': '@example.com'}) >>> User.deactivate({'email__startswith': 'mia@'})
- tcms.rpc.api.user.filter(query=None, **kwargs)[source]¶
- RPC User.filter(query)
Search and return the resulting list of users.
- Parameters:
query (dict) – Field lookups for
django.contrib.auth.models.User**kwargs – Dict providing access to the current request, protocol, entry point name and handler instance from the rpc method
- Returns:
Serialized list of
django.contrib.auth.models.Userobjects without the password field- Return type:
- Raises:
PermissionDenied – if missing the auth.view_user permission
Note
If query is
Nonewill return the user issuing the RPC request.
- tcms.rpc.api.user.update(user_id, values, **kwargs)[source]¶
- RPC User.update(user_id, values)
Updates the fields of the selected user. Can be used to update password as well!
- Parameters:
- Returns:
Serialized
django.contrib.auth.models.Userobject- Return type:
- Raises:
PermissionDenied – if missing the auth.change_user permission when updating another user or when passwords don’t match.
Note
If
user_idis None will update the user issuing the RPC request.Warning
Changing the password for another user via RPC is not allowed!