Package cm_api :: Package endpoints :: Module users
[hide private]
[frames] | no frames]

Module users

source code

Classes [hide private]
  ApiUser
Functions [hide private]
 
get_all_users(resource_root, view=None)
Get all users.
source code
 
get_user(resource_root, username)
Look up a user by username.
source code
 
_grant_admin_role(resource_root, username)
Grant admin access to a user.
source code
 
_revoke_admin_role(resource_root, username)
Revoke admin access from a user.
source code
 
create_user(resource_root, username, password, roles)
Create a user.
source code
 
delete_user(resource_root, username)
Delete user by username.
source code
Variables [hide private]
  USERS_PATH = '/users'
  __package__ = 'cm_api.endpoints'
Function Details [hide private]

get_all_users(resource_root, view=None)

source code 

Get all users.

Parameters:
  • resource_root - The root Resource object
  • view - View to materialize ('full' or 'summary').
Returns:
A list of ApiUser objects.

get_user(resource_root, username)

source code 

Look up a user by username.

Parameters:
  • resource_root - The root Resource object
  • username - Username to look up
Returns:
An ApiUser object

_grant_admin_role(resource_root, username)

source code 

Grant admin access to a user. If the user already has admin access, this does nothing.

Parameters:
  • resource_root - The root Resource object
  • username - Username to give admin access to.
Returns:
An ApiUser object

_revoke_admin_role(resource_root, username)

source code 

Revoke admin access from a user. If the user does not have admin access, this does nothing.

Parameters:
  • resource_root - The root Resource object
  • username - Username to give admin access to.
Returns:
An ApiUser object

create_user(resource_root, username, password, roles)

source code 

Create a user.

Parameters:
  • resource_root - The root Resource object
  • username - Username
  • password - Password
  • roles - List of roles for the user. This should be [] for a regular user, or ['ROLE_ADMIN'] for an admin.
Returns:
An ApiUser object

delete_user(resource_root, username)

source code 

Delete user by username.

Parameters:
  • resource_root - The root Resource object
Returns:
An ApiUser object