SCAutolib.models.user

This module defines the User and IPAUser classes which can be used to represent system and IPA users.

The classes contain the usual properties that defines a user, like username, password, etc.

The classes implement add_user and delete_user methods which can be used to create or remove a specified user in the system or in the specified IPA server.

Classes

class IPAUser(ipa_server, *args, **kwargs)[source]

This class represents an IPA user.

Class for IPA user. IPA client should be configured first before creating an IPA user through this class.

Parameters:
  • ipa_server (IPAServerCA) – IPAServerCA object which provides the ipa hostname

  • username (str) – Username for the system user

  • password (str) – Password for the system user

  • key (Path) – Key to be associated with the user

  • cert (Path) – Certificate to be associated with the user.

add_user()[source]

Adds IPA user to IPA server.

delete_user()[source]

Deletes the user

class User(username, password)[source]

User represents general system user.

add_user()[source]

Add user to the local system with useradd bash command and set password for created user.

delete_user()[source]

Deletes the user

static load(json_file, **kwargs)[source]

Load values from user’s JSON file to corresponding user object.

Parameters:
  • json_file (pathlib.Path) – path to JSON file to read from

  • kwargs (dict) – dictionary of additional values needed to initialise the object

Returns:

user object

Return type:

SCAutolib.models.user.User or SCAutolib.models.user.IPAUser