%SYS
Roles Class Reference

Define the security Role database, and methods which manipulate them. More...

Inheritance diagram for Roles:
Collaboration diagram for Roles:

Static Public Member Functions

_.Library.Status Copy (_.Library.String Name, _.Library.String NewName, _.Library.String NewDescription)
 Copy a Role. More...
 
_.Library.Status CopySQLPrivileges (_.Library.String pFromRole, _.Library.String pToRole, _.Library.List pNamespaceList)
 CopySQLPrivileges will copy SQL Admin Privileges and SQL Object Privileges from pFromRole to pToRole. More...
 
_.Library.Status Create (_.Library.String Name, _.Library.String Description, _.Library.String Resources, _.Library.String GrantedRoles)
 Create a Role. More...
 
_.Library.Status Delete (_.Library.String Name)
 Delete a role. More...
 
_.Library.Boolean Exists (_.Library.String Name, _.Library.ObjectHandle Role, _.Library.Status Status)
 Role exists. More...
 
_.Library.Status Export (_.Library.String FileName, _.Library.Integer NumExported, _.Library.String Roles, _.Library.String Resources, _.Library.Boolean SQLPrivileges, _.Library.Integer NumSQLPrivilegesExported)
 This method exports Role records to a file in xml format. More...
 
_.Library.Status Get (_.Library.String Name, _.Library.String Properties, _.Library.ObjectHandle Role)
 Get a role's properties. More...
 
_.Library.Status GetProperties (_.Library.ObjectHandle Role, _.Library.String Properties)
 Get a role's properties. More...
 
_.Library.Status Import (_.Library.String FileName, _.Library.Integer NumImported, _.Library.Integer Flags, _.Library.Integer NumSQLPrivsImported)
 Import Role records from an xml file. More...
 
_.Library.Status Modify (_.Library.String Name, _.Library.String Properties)
 Modify a role. More...
 
_.Library.Status Rename (_.Library.String NewRole, _.Library.String OldRole)
 Rename a role, and update all associated tables. More...
 

Public Attributes

 Description
 Description of the role. More...
 
 GrantedRoles
 Roles assigned to the Role. More...
 
 Name
 Role Name. More...
 
 Resources
 Resource/Permission pairs the role holds. More...
 

Private Attributes

 __ForceSave
 Used to force a save of the object. More...
 

Detailed Description

Define the security Role database, and methods which manipulate them.


The system includes a set of pre-defined System roles. System roles cannot be deleted. Legacy system roles may be deleted.

Role names have the following properties:
1) Role names are case insensitive.
2) Maximum length of a role name is 64 characters.
3) Role name cannot contain a "," or ":"
4) Role name cannot start with a "%" unless it is a pre-defined system role
A role may exist which has no resources.
DB_* implicit roles cannot be modified
The Admin Secure:USE permission is required to operate on a resource

The table for this class should be manipulated only through object access, the published API's or through the System Management Portal. It should not be updated through direct SQL access.

Member Function Documentation

◆ Copy()

_.Library.Status Copy ( _.Library.String  Name,
_.Library.String  NewName,
_.Library.String  NewDescription 
)
static

Copy a Role.


Copy an existing role in the Security database to a new one.
Parameters:
Name - Name of the role to be copied
NewName - Name of the role to be created
Description - Description of the new role

◆ CopySQLPrivileges()

_.Library.Status CopySQLPrivileges ( _.Library.String  pFromRole,
_.Library.String  pToRole,
_.Library.List  pNamespaceList 
)
static

CopySQLPrivileges will copy SQL Admin Privileges and SQL Object Privileges from pFromRole to pToRole.

Parameters:
pFromRole - Name of the role to copy SQL privileges from
pToRole - Name of the role to copy SQL privileges to
pNamespaceList - is a $Lb(namespace names). If pNamespaceList is not specified or is "", the copy will be performed for ALL namespaces. Otherwise supply a specific list of namespace you want to copy the privileges for.
The privilege will be copied with the SAME grantor and grantee. This means if UsersA granted a privilege to UserB, and UserC calls CopySQLPrivileges to copy privs from UserB to UserD, the privileges UserD gets will have been granted by UserA. You must have the Admin_Secure resource in order to call this API. CopySQLPrivileges returns a Status code

◆ Create()

_.Library.Status Create ( _.Library.String  Name,
_.Library.String  Description,
_.Library.String  Resources,
_.Library.String  GrantedRoles 
)
static

Create a Role.


Create a Role in the Security database.
Parameters:
Name - Name of the role to create
Description - Description of the role
Resources - Resource/permission pairs to assign to the role
Resources are in the format:
ResourceName:Permission,ResourceName:Permission
For example:
s Resources="MyResource:RW,MyResource1:RWU"
s Resources="" would create a role with no resources.
Permision values are as follows:
"R"
"W"
"U"
GrantedRoles - Additional roles granted when this role is granted to a user
GrantedRoles are in the format:
"GrantedRole1,GrantedRole2"

◆ Delete()

_.Library.Status Delete ( _.Library.String  Name)
static

Delete a role.


This method will delete a role from the security database and remove the role from all the users which hold this role. It will then update the in memory security database to mark this role as "No access" for all resources this role holds. Pre-defined system roles cannot be deleted.
Parameters:
Name - Name of role to delete

◆ Exists()

_.Library.Boolean Exists ( _.Library.String  Name,
_.Library.ObjectHandle  Role,
_.Library.Status  Status 
)
static

Role exists.


This method checks for the existence of a role in the security database.
Parameters:
Name - Name of the role to check existence of
Return values:
If Value of the method = 0 (Role does not exist, or some error occured)
Role = Null
Status = Role "x" does not exist, or other error message<br>
If Value of the method = 1 (Role exists)
Role = Object handle to role
Status = $$$OK

◆ Export()

_.Library.Status Export ( _.Library.String  FileName,
_.Library.Integer  NumExported,
_.Library.String  Roles,
_.Library.String  Resources,
_.Library.Boolean  SQLPrivileges,
_.Library.Integer  NumSQLPrivilegesExported 
)
static

This method exports Role records to a file in xml format.


Parameters:
Filename - Output file name
NumExported (byref) - Returns number of records exported.
Roles - Comma separated list of Roles to export, "*" = All
Resources - Comma separated list of Resource names, "*" = All. Export Roles containing only these resources
SQLPrivileges - 1/0 flag. If 1, export all SQL Privileges from all namespace on this system that have been directly granted to this Role
NumSQLPrivilegesExported *byref) - Returns number of SQL Privileges and SQL Admin Privilege Set records exported
Note: Database roles starting with DB_ will not be exported.

◆ Get()

_.Library.Status Get ( _.Library.String  Name,
_.Library.String  Properties,
_.Library.ObjectHandle  Role 
)
static

Get a role's properties.


Gets a role's properties from the security database.
Parameters:
Name - Name of the role to get
Return values:
Properties - Array of properties
Properties("Description") - Description of the role
Properties("Resources") - Resource names/permission pairs Resources are in the format:
ResourceName:Permission,ResourceName:Permission
For example:
Properties("Resources")="MyResource:RW,MyResource1:RWU"
Properties("GrantedRoles")=List of granted roles
For example:
Properties("GrantedRoles")="GrantedRole,GrantedRole1"

◆ GetProperties()

_.Library.Status GetProperties ( _.Library.ObjectHandle  Role,
_.Library.String  Properties 
)
static

Get a role's properties.


Gets a role's properties from the security database.
Parameters:
Role - Object handle to a role record
Return values:
Properties - See the Get method for more information on properties returned

◆ Import()

_.Library.Status Import ( _.Library.String  FileName,
_.Library.Integer  NumImported,
_.Library.Integer  Flags,
_.Library.Integer  NumSQLPrivsImported 
)
static

Import Role records from an xml file.


Parameters:
FileName - Filename to import Role records from
NumImported (byref) - Returns number of records imported
Flags - Control import
Bit 0 - Do not import records, just return count
Note: On failure, no records will be imported

◆ Modify()

_.Library.Status Modify ( _.Library.String  Name,
_.Library.String  Properties 
)
static

Modify a role.


Modify an existing role's properties in the security database.
Parameters:
Name - Name of the role to modify
Properties - Array of properties to modify.
See the Get() method for a description of the Properties parameter.
Properties("Resources")="" removes all resources from a role.
If a specific property is not passed in the properties array, the value is not modified.

◆ Rename()

_.Library.Status Rename ( _.Library.String  NewRole,
_.Library.String  OldRole 
)
static

Rename a role, and update all associated tables.


Member Data Documentation

◆ Description

Description

Description of the role.

 

◆ __ForceSave

__ForceSave
private

Used to force a save of the object.

 

◆ GrantedRoles

GrantedRoles

Roles assigned to the Role.

 

◆ Name

Name

Role Name.

 

◆ Resources

Resource/Permission pairs the role holds.