ScriptLiveDeviceUserManagement¶
- class ScriptLiveDeviceUserManagement.ScriptLiveDeviceUserManagement¶
Bases:
object
This object represents the live user management on a given device.
- Version added:
3.5.16.0
- property online_device¶
Gets the online device this user management is using.
- Return type:
ScriptOnlineDevice
- property users¶
Gets the users on the device.
- Return type:
- property groups¶
Gets the groups on the device.
- Return type:
- upload()¶
Uploads the user and group information from the device.
- backup(directory, password)¶
Backups the user management from the device.
Don’t change the name of the backup file because the device uses a fixed file name. Use different directories to store different backups.
- Parameters:
directory (str) – Directory where the backup file shall be stored.
password (str) – Password which should be used to protected the backup file.
- Return type:
str
- Returns:
Full path of the backup file.
- restore(path, password)¶
Restores the user management to the device.
Note
After the restore of the user management it is possible to get an authentication exception during the next operation on the online device because the current login session is no longer valid. In this case you catch the exception, reconnect the online device and repeat the operation.
For example:
online_device = online.create_online_device(device_obj) user_mgmt = online_device.create_live_user_management() user_mgmt.restore(file, password) try: user_mgmt.upload() except: online_device.disconnect() online_device.connect() user_mgmt.upload()
- Parameters:
path (str) – Path of the backup file.
password (str) – Password which was used to protect the backup file.
- add_user(name, password, can_change_password=True, must_change_password=False)¶
Adds a new user with the specified name.
- Parameters:
name (str) – The name of the new user.
password (str) – Password for the new user.
can_change_password (bool) – User can change their password.
must_change_password (bool) – User must change their password with next login.
- remove_user(name)¶
Removes the user with the specified name.
- Parameters:
name (str) – The name of the existing user.
- set_user_password(name, password)¶
Sets the password for this user.
- Parameters:
name (str) – The name of the user.
password (str) – The password to set.
- set_user_flags(name, flags)¶
Sets flags for the user.
- Parameters:
name (str) – The name of the user.
flags (
DeviceUserManagementFlags
) – The flags to set.
- add_group(name, group_members, user_members)¶
Adds a new group with the specified name.
- Parameters:
name (str) – The name of the new group.
group_members (list[str]) – The group members of the new group.
user_members (list[str]) – The user members of the new group.
- remove_group(name)¶
Removes the group with the specified name.
- Parameters:
name (str) – The name of the existing group.
- set_members_of_group(name, group_members, user_members)¶
Sets the members of groups and users which shall be in the group.
- Parameters:
name (str) – The name of the group.
group_members (list[str]) – Group names which should be member for the group.
user_members (list[str]) – User names which should be member for the group.
- class ScriptLiveDeviceUserManagement.ScriptLiveDeviceUserList(iterable=(), /)¶
Bases:
list
Represents a list of script device users.
- Version added:
3.5.16.0
- property flags¶
Gets flags concerning the entire user list.
- Return type:
DeviceUserManagementFlags
- class ScriptLiveDeviceUserManagement.ScriptLiveDeviceGroupList(iterable=(), /)¶
Bases:
list
A list of groups on the device.
- Version added:
3.5.16.0
- property flags¶
Gets flags concerning the entire group list.
- Return type:
DeviceUserManagementFlags
- class ScriptLiveDeviceUserManagement.ScriptLiveDeviceUser¶
Bases:
object
An user on the device.
- Version added:
3.5.16.0
- property flags¶
Gets flags concerning this particular user.
- Return type:
DeviceUserManagementFlags
- property name¶
Gets the name of the user.
- Return type:
str
- class ScriptLiveDeviceUserManagement.ScriptLiveDeviceGroup¶
Bases:
object
A group of users, which have common rights on the device.
- Version added:
3.5.16.0
- property flags¶
Gets flags concerning this particular group.
- Return type:
DeviceUserManagementFlags
- property name¶
Gets the name of the group.
- Return type:
str
- property user_members¶
Gets the user names which are member of this group.
- Return type:
tuple[str]
- property group_members¶
Gets the group names which are member of this group.
- Return type:
tuple[str]
- check_cyclic_membership(new_group_member)¶
Checks whether adding the specified group member would cause a cyclic membership dependency.
- Parameters:
new_group_member (str) – The name of the new group membership to check.
- Return type:
bool
- Returns:
True if adding the specified group member would cause a cycle, False otherwise.