creds.users¶
Users ([oktypes]) |
A collection of users and methods to manage them. |
User ([name, passwd, uid, gid, gecos, …]) |
Representation of a user and their related credentials. |
generate_add_user_command ([proposed_user, …]) |
Generate command to add a user. |
generate_modify_user_command ([task, manage_home]) |
Generate command to modify existing user to become the proposed user. |
generate_delete_user_command ([username, …]) |
Generate command to delete a user. |
get_user_by_uid ([uid, users]) |
Return a list of users, from a supplied list, based on their uid. |
compare_user ([passed_user, user_list]) |
Check if supplied User instance exists in supplied Users list and, if so, return the differences. |
-
class
creds.users.
User
(name=None, passwd=None, uid=None, gid=None, gecos=None, home_dir=None, shell=None, public_keys=None, sudoers_entry=None)[source]¶ Representation of a user and their related credentials.
-
gecos
¶ Force double quoted gecos.
Returns: The double quoted gecos. Return type: str
-
-
class
creds.users.
Users
(oktypes=<class 'creds.users.User'>)[source]¶ A collection of users and methods to manage them.
-
static
construct_user_list
(raw_users=None)[source]¶ Construct a list of User objects from a list of dicts.
-
static
-
creds.users.
compare_user
(passed_user=None, user_list=None)[source]¶ Check if supplied User instance exists in supplied Users list and, if so, return the differences.
Parameters: Returns: Details of the matching user and a list of differences
Return type: dict
-
creds.users.
generate_add_user_command
(proposed_user=None, manage_home=None)[source]¶ Generate command to add a user.
Parameters: - proposed_user (User) – User
- manage_home – bool
Returns: The command string split into shell-like syntax
Return type: list
-
creds.users.
generate_delete_user_command
(username=None, manage_home=None)[source]¶ Generate command to delete a user.
Parameters: - username (str) – user name
- manage_home (bool) – manage home directory
Returns: The user delete command string split into shell-like syntax
Return type: list
-
creds.users.
generate_modify_user_command
(task=None, manage_home=None)[source]¶ Generate command to modify existing user to become the proposed user.
Parameters: task (dict) – A proposed user and the differences between it and the existing user Returns: The command string split into shell-like syntax Return type: list