ScriptDeviceUserManagement

 

class

ScriptDeviceUserManagement.

ScriptDeviceUserManagement

Bases: object

This object represents the user management on a given device. 

online_device

Gets the online device this user management was created from.

Return type

users

Gets the users on the device.

Modifications of this list will take place offline and come into effect by downloading the user management to the device.

Return type

groups

Gets the groups on the device.

Modifications of this list will take place offline and come into effect by downloading the user management to the device.

Return type

reload_from_program

Reloads the user management contents from the device object in the project.

store_to_project

Writes the current contents of the user management back to the device object in the project.

You should always use this method to persist your changes into the project. If you don't call this method, the project will contain an outdated state.

upload

Uploads the user and group information from the device.

download

Downloads the user and group information to the device.

load

element

Loads the contents of the given XML element into this user management object.

Parameters

element (XmlElement) -- The element.

save

file_name=None

writer=None

Saves the contents of this user management object as XML into a string.

Warning

The original C# function that is called with this method contains 3 overloads. It is strongly advised to pass all arguments with their respective keywords. file_path and writer are not actually optional, they just aren't required in every over­load. Pass them if your overload needs them!

save() (1/3)

Return type

str

Returns

A string containing the XML representation of this user management.

save(file_path) (2/3)

Saves the contents of this user management object as XML into a file.

Parameters

file_path (str) -- The file name.

save(writer) (3/3)

Saves the contents of this user management object as XML into an System.Xml.XmlWriter.

Parameters

writer (XmlWriter) -- The writer.

class

ScriptDeviceUserManagement.

ScriptDeviceUserList

Bases: list

Represents a list of script device users. 

flags

Gets flags concerning the entire user list.

Return type

DeviceUserManagementFlags

add

name

Adds a new user with the specified name.

Parameters

name (str) -- The name of the new user.

Raises

  • ArgumentException -- A user with the specified name already exists.

  • NotSupportedException -- Adding new users is not supported. Check flags for the DeviceUserManagementFlags.Create flag in advance.

Return type

Returns

The newly created user.

remove

name

Removes the user with the specified name.

Parameters

name (str) -- The name of the existing user.

Raises

NotSupportedException --

  • Deleting existing users is not supported. Check ScriptDevi­ceUser.flags for the DeviceUserManagementFlags.Delete flag in advance.

  • Removing a member from a group in which the specified user is a member of is not supported. Check ScriptDeviceGroup.flags of all affected groups for the DeviceUserManagementFlags.Remove­Member flag in advance.

Return type

bool

Returns

True if the user existed and was removed, otherwise False

clear

Removes all users.

Raises

NotSupportedException -- Deleting existing users is not supported. Check ScriptDeviceUser.flags for the DeviceUserManagement­Flags.Delete flag in advance. --OR-- Removing a member from a group in which the specified user is a member of is not supported. Check ScriptDeviceGroup.flags of all affected groups for the DeviceUserMan­agementFlags.RemoveMember flag in advance.

class

ScriptDeviceUserManagement.

ScriptDeviceGroupList

Bases: list

A list of groups on the device. 

flags

Gets flags concerning the entire group list.

Return type

DeviceUserManagementFlags

add

name

Adds a new group with the specified name.

Parameters

name (str) -- The name of the group.

Return type

str

Returns

The newly created group, or None if a group with the specified name already exists.

remove

name

Removes the group with the specified name.

Parameters

name (str) -- The name of the existing group.

Return type

bool

Returns

True if the group existed and was removed, otherwise False

clear

Removes all groups.

class

ScriptDeviceUserManagement.

ScriptDeviceUser

Bases: object

An user on this device. 

flags

Gets flags concerning this particular user.

Return type

DeviceUserManagementFlags

name

Gets or sets the name of the user.

Raises

  • NotSupportedException -- Editing this user is not supported. Check flags for the DeviceUserManagementFlags.Edit flag in advance.

  • ArgumentException -- A user with the specified name already exists.

Return type

str

set_password

password

Sets the password for this user.

Parameters

password (str) -- The password to set.

password_hash

Gets or sets the encrypted password for this user.

Raises

NotSupportedException -- Editing this user is not supported. Check flags for the DeviceUserManagementFlags.Edit flag in advance.

Return type

str

set_user_flags

flags

Sets flags for the user.

Parameters

flags (DeviceUserManagementFlags) -- The flags to set.

class

ScriptDeviceUserManagement.

ScriptDeviceGroup

Bases: object

A group of users, which have common rights on the device. 

flags

Gets flags concerning this particular group.

Return type

DeviceUserManagementFlags

name

Gets or sets the name of the group.

Raises

  • NotSupportedException -- Editing this user is not supported. Check flags for the DeviceUserManagementFlags.Edit flag in advance.

  • ArgumentException -- A group with the specified name already exists.

Return type

str

user_members

Gets the list of all user names which are members of this group.

This list can be modifed in-place to add or remove users from this group.

Return type

list

group_members

Gets the list of all group names which are members of this group.

This list can be modifed in-place to add or remove groups from this group.

Return type

list

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

True if adding the specified group member would cause a cycle, other­wise False.

Returns

bool