class
UserManagement.
ScriptUserManagement
Bases: object
UserManagement interface.
project
Backlink to the project for this user management.
users
The collection of all defined users for this project.
groups
The colleciton of all defined groups for this project.
logged_on_user
Gets the user which is currently logged in, or None if no user is currently logged in.
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 System.ScriptCommand) -- The command 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.
types
Gets all available types.
class
UserManagement.
ScriptPermissionTypes
Bases: list
This object represents all available permission types.
usermanagement
The permission type guid for user management, or Guid.Empty if not available in this installation.
Guid
objectaccess
The permission type guid for object access rights, or Guid.Empty if not available in this installation.
Guid
objectfactory
The permission type guid for object factory rights (object creation), or Guid.Empty if not available in this installation.
Guid
commandexecution
The permission type guid for execution of commands, or Guid.Empty if not available in this installation.
Guid
class
UserManagement.
ScriptUserList
Bases: list
Represents the list of all users known to the current project.
user_management
Back-Link to the project's user management.
project
Backlink to the project for this user management.
create
name
Creates a new user with the specified name.
name (str) -- The name.
class
UserManagement.
ScriptUserOrGroup
Bases: object
This interface contains the common members of ScriptUser and ScriptGroup.
user_management
Back-Link to the project's user management.
project
Backlink to the project for this user management.
is_user
Gets a value indicating whether this ScriptUserOrGroup is an user.
bool
is_group
Gets a value indicating whether this ScriptUserOrGroup is a group.
bool
id
Gets the ID of this user or group.
Guid
name
Gets the login name of this user or group.
str
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
UserManagement.
ScriptUser
Bases: UserManagement.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.
userlist
Backreference to the user list.
fullname
Gets or sets the full name of this user. This is informative only.
str
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.
groups
Gets a python tuple with the groups this user is member of.
list
class
UserManagement.
ScriptGroupList
Bases: list
Represents the list of all known groups in this project.
user_management
Back-Link to the project's user management.
project
Backlink to the project for this user management.
create
name
Creates a new group with the specified name.
owner_group
Owner group.
everyone_group
Everyone group.
class
UserManagement.
ScriptGroup
Bases: UserManagement.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.
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
is_everyone_group
Gets a boolean value indicating whether this group is the "everyone" group.
bool
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
UserManagement.
ScriptPermission
Bases: object
Interface for permission objects.
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.
PermissionState
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
UserManagement.
ScriptObjectPermission
Bases: UserManagement.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.
target_object
Target object.
access_kind
Access kind.
ObjectPermissionKind
class
UserManagement.
ScriptCommandPermission
Bases: UserManagement.ScriptPermission
Permissions for commands come with the command guid.
command_guid
Gets the command guid.
Guid
class
UserManagement.
ScriptFactoryPermission
Bases: UserManagement.ScriptPermission
Permissions for factories come with a guid describing the object factory.
factory_guid
Gets the factory guid.
Guid