class
ScriptUserManagement.
ObjectPermissionKind
value
Bases: Enum
This enumeration contains the various possibilites to access an object from the viewpoint of the User Management.
View
= (0,)
The permission to view an object.
Modify
= (1,)
The permission to modify an object.
Remove
= (2,)
The permission to remove an object.
AddRemoveChildren
= 3
The permission to add or remove a child to or from an object.
class
ScriptUserManagement.
PermissionState
value
Bases: Enum
The permission state, either “granted”, “denied”, or “default”.
Granted
= (0,)
The corresponding permission is explicitely granted to a certain group.
Denied
= (1,)
The corresponding permission is explicitely denied to a certain group.
Default
= 2
The corresponding permission is not explicitely set for a certain group.
class
ScriptUserManagement.
ScriptUserManagement
Bases: object
UserManagement interface.
property
project
Backlink to the project for this user management.
property
users
The collection of all defined users for this project.
property
groups
The colleciton of all defined groups for this project.
property
logged_on_user
Gets the user which is currently logged in, or None if no user is currently logged in.
property
login_time
Gets the timestamp since the last successful login, or DateTime.MinValue if no user is currently logged in.
DateTime
login
username
password
Log into the project using the specified credentials.
This is equal to ScriptProject.login().
username (str) – The username.
password (str) – The password.
logout
Log out from the project (back to the user “nobody”).
This is equal to ScriptProject.logout().
check_available
type
Checks whether permission management for the given PermissionType is available in the given CoDeSys installation.
type (Guid) – The type.
bool
get_user_management_permission
Gets the permission object for the user management.
get_command_permission
commandguid
Gets the permission object for execution of a specific command.
commandguid (Guid or ScriptCommand) – The ScriptCommand or its Guid.
The command permission object.
get_factory_permission
factory
Gets the permission object for accessing a specific object factory.
factory (Guid or ScriptObjectFactory) – The factory or its guid.
The factory permission object.
get_object_permission
obj
kind
Gets a Permission object for that specific script object.
obj (ScriptObject) – The object we want the permission for.
kind (ObjectPermissionKind) – The kind of object access permission we want.
The ScriptObject.
property
types
Gets all available types.
class
ScriptUserManagement.
ScriptPermissionTypes
iterable=()
/
Bases: list
This object represents all available permission types.
property
usermanagement
The permission type guid for user management, or Guid.Empty if not available in this installation.
Guid
property
objectaccess
The permission type guid for object access rights, or Guid.Empty if not available in this installation.
Guid
property
objectfactory
The permission type guid for object factory rights (object creation), or Guid.Empty if not available in this installation.
Guid
property
commandexecution
The permission type guid for execution of commands, or Guid.Empty if not available in this installation.
Guid
class
ScriptUserManagement.
ScriptUserList
iterable=()
/
Bases: list
Represents the list of all users known to the current project.
property
user_management
Back-Link to the project’s user management.
property
project
Backlink to the project for this user management.
create
name
Creates a new user with the specified name.
name (str) – The name.
class
ScriptUserManagement.
ScriptUserOrGroup
Bases: object
This interface contains the common members of ScriptUser and ScriptGroup.
property
project
Backlink to the project for this user management.
property
user_management
Back-Link to the project’s user management.
property
is_user
Gets a value indicating whether this ScriptUserOrGroup is an user.
bool
property
is_group
Gets a value indicating whether this ScriptUserOrGroup is a group.
bool
property
id
Gets the ID of this user or group.
Guid
property
name
Gets the login name of this user or group.
str
property
description
Gets or sets the description for this user or group. This is informative only.
str
add_to
parent
Adds this user or group to the specified parent group.
parent (ScriptGroup) – The parent.
remove_from
parent
Removes this user or group from the specified parent group.
parent (ScriptGroup) – The parent.
class
ScriptUserManagement.
ScriptUser
Bases: ScriptUserOrGroup
Instances of this interface represent a single user within the user management.
A user is uniquely identified by its ID (not by its name), although its name must also be unique within a user list.
property
userlist
Backreference to the user list.
property
fullname
Gets or sets the full name of this user. This is informative only.
str
property
active
Gets or sets a boolean which indicates whether this user is currently active.
Inactive users cannot login to the user management.
bool
check_password
password
Checks the password for an user.
password (str) – The password.
bool
True if the password is correct.
change_password
old_password
new_password
Changes the password for the user.
old_password (str) – The old password.
new_password (str) – The new password.
remove
Removes the user with the specified ID from this list.
UserNotExistingException – If the user does not exist (e. G. because it was removed before).
CannotRemoveLastMemberFromOwnerGroupException – If the user is the last member of the owner group.
rename
newname
Renames the user.
newname (str) – The new name.
property
groups
Gets a python tuple with the groups this user is member of.
tuple[ScriptGroup]
class
ScriptUserManagement.
ScriptGroupList
iterable=()
/
Bases: list
Represents the list of all known groups in this project.
property
user_management
Back-Link to the project’s user management.
property
project
Backlink to the project for this user management.
create
name
Creates a new group with the specified name.
property
owner_group
Owner group.
property
everyone_group
Everyone group.
class
ScriptUserManagement.
ScriptGroup
Bases: ScriptUserOrGroup
Instances of this interface represent a single group within the user management.
A group is uniquely identified by its ID (not by its name), although its name must also be unique within a group list.
property
grouplist
Backlink to the grouplist.
add_member
member
Adds a member to this group. This might be either a user or another group.
If such a user or group does not exist, (e. G. because it was deleted in the meantime), a UserNotExistingException, GroupNotExistingException, or UserOrGroupNotExistingException is thrown. If the user or group is already a member of this group, a UserIsAlreadyMemberOfGroupException or GroupIsAlreadyMemberOfGroupException is thrown.
member (ScriptUserOrGroup) – The user or group.
GroupCycleException – If this addition would cause a membership cycle.
remove_member
member
Removes a member from this group.
member (ScriptUserOrGroup) – The member.
has_member
member
Checks whether the specified user or group is a member of this group.
member (ScriptUserOrGroup) – The member.
bool
True if the specified user or group is member of this group, otherwise False.
get_user_members
recursive
Returns a python tuple of all users which are member of this group, or which are members of group members of this group.
recursive (bool) – if set to True, includes users which are members of group members of this group.
list
A python tuple of ScriptUser objects.
get_group_members
Gets a python tuple of all groups which are member of this group.
list
property
is_everyone_group
Gets a boolean value indicating whether this group is the “everyone” group.
bool
property
is_owner_group
Gets a boolean value indicating whether this group is the “owner” group.
bool
rename
newname
Renames the group.
newname (str) – The new name.
remove
Removes this group from the containing grouplist.
class
ScriptUserManagement.
ScriptPermission
Bases: object
Interface for permission objects.
property
type
Gets the type.
Guid
check_permission
silent_or_group
This overload is used when silent_or_group is of type bool.
Checks whether the currently logged in user has a specific permission or not.
silent (bool) – If of type bool: If False, when the permission is not granted, the RequestAuthorization event is triggered which typically prompts a new login interactively and the permission is checked again with the new login. If True, nothing will be prompted.
bool
True if the user is allowed.
This overload is used when silent_or_group is of type ScriptGroup.
group (ScriptGroup) – The group.
bool
True if the permission is allowed.
get_permission_state
group
resolve_effective=True
resolve_inherited=False
Gets the the state of a specific permission.
You can use System.commands to search for a command guid.
group (ScriptGroup) – The group.
resolve_effective (bool) – If True, when the permission is not explicitely granted or denied, it will be resolved (e.g. by asking the parent object, and finally deferring to a default value). This value overrides resolve_inherited.
resolve_inherited (bool) – If set to True, for hierarchical properties (currently only the object access properties), the parent objects are resolved for inherited properties. If set to false, only the properties directly set at the object are resolved. If resolve_effective is True, the parents are always resolved and this parameter is ignored.
If resolve_effective is True, PermissionState.Granted or PermissionState.Denied. If resolve_effective is False, PermissionState.Default might be returned additionally.
set_permission_state
group
state
Sets the permissions for a specific command.
group (ScriptGroup) – The group.
state (PermissionState) – The state.
check_set_permission_state
group
state
silent=True
Checks whether our group is allowed to set a specific permission.
group (ScriptGroup) – The group.
state (PermissionState) – The state.
silent (bool) – If False, when the permission is not granted, the RequestAuthorization event is triggered which typically prompts a new login interactively and the permission is checked again with the new login. If True, nothing will be prompted.
bool
True if the user is allowed.
class
ScriptUserManagement.
ScriptObjectPermission
Bases: ScriptPermission
ObjectAccess Permissions come with additional information about which object to access, and the specific kind of object access.
check_permission_extended
Checks the effective permission the current user has for the given object.
This considers permission inheritance along the object tree etc. This method may prompt the user for a new login.
Exception
An Exception object describing why the user currently does not have access for the given object, and None if the user has access.
property
target_object
Target object.
property
access_kind
Access kind.
class
ScriptUserManagement.
ScriptCommandPermission
Bases: ScriptPermission
Permissions for commands come with the command guid.
property
command_guid
Gets the command guid.
Guid
class
ScriptUserManagement.
ScriptFactoryPermission
Bases: ScriptPermission
Permissions for factories come with a guid describing the object factory.
property
factory_guid
Gets the factory guid.
Guid