tcms.rpc.api.user module

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:
  • user_id (int) – PK of user to update
  • values (dict) – Field values 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 django.contrib.auth.models.User object

Return type:

dict

Raises:

PermissionDenied – if missing the auth.change_user permission when updating another user or when passwords don’t match.

Note

If user_id is None will update the user issuing the RPC request.

Warning

Changing the password for another user via RPC is not allowed!

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 django.contrib.auth.models.User object without the password field!

Return type:

dict

Note

If query is None will return the user issuing the RPC request.

tcms.rpc.api.user.join_group(username, groupname)[source]
RPC User.join_group(username, groupname)

Add user to a group specified by name.

Parameters:
  • username (str) – Username to modify
  • groupname (str) – Name of group to join, must exist!
Raises:

PermissionDenied – if missing auth.change_user permission

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!

Parameters:
  • filename (str) – File name of attachment, e.g. ‘logs.txt’
  • b64content (str) – Base64 encoded content
  • kwargs – Dict providing access to the current request, protocol entry point name and handler instance from the rpc method
Returns:

Information about the attachment

Return type:

dict