Module: UU::OS::PersonalAccessRole

Extended by:
PersonalAccessRole
Included in:
PersonalAccessRole
Defined in:
uu_os-0.29.16/lib/uu/os/personal_access_role.rb,
uu_os-0.29.16/lib/uu/os/personal_access_role/personal_access_role_create.rb,
uu_os-0.29.16/lib/uu/os/personal_access_role/personal_access_role_get_list.rb,
uu_os-0.29.16/lib/uu/os/personal_access_role/personal_access_role_attributes.rb,
uu_os-0.29.16/lib/uu/os/personal_access_role/personal_access_role_set_attributes.rb,
uu_os-0.29.16/lib/uu/os/personal_access_role/personal_access_role_add_role_interface.rb,
uu_os-0.29.16/lib/uu/os/personal_access_role/personal_access_role_remove_role_interface.rb,
uu_os-0.29.16/lib/uu/os/personal_access_role/personal_access_role_get_role_interface_list.rb,
uu_os-0.29.16/lib/uu/os/personal_access_role/personal_access_role_get_role_interface_list_item.rb

Defined Under Namespace

Classes: PersonalAccessRoleAddRoleInterface, PersonalAccessRoleAttributes, PersonalAccessRoleCreate, PersonalAccessRoleGetList, PersonalAccessRoleGetRoleInterfaceList, PersonalAccessRoleGetRoleInterfaceListItem, PersonalAccessRoleRemoveRoleInterface, PersonalAccessRoleSetAttributes

Constant Summary

PATH =

Service path of the REST API.

'uu/os/PersonalAccessRole'

Instance Method Summary (collapse)

Instance Method Details

- (Object) activate_access(personal_access_role_uri)

This command activates a personal access role. The personal access role will have access to its territory.

Examples:

# Activate access for specified access role.
UU::OS::PersonalAccessRole.activate_access('ues:TERRITORY:PERSONAL_ACCESS_ROLE')

Parameters:

  • personal_access_role_uri (String, UU::OS::UESURI)

    UESURI of a personal access role that the access will be reactivated.



238
239
240
241
242
243
# File 'uu_os-0.29.16/lib/uu/os/personal_access_role.rb', line 238

def activate_access(personal_access_role_uri)
  svc = UU::OS::REST::RemoteClient.new(PersonalAccessRole)
  UU::OS::QoS::QoSHandler.auto_retry do
    svc.post('activateAccess', personal_access_role_uri)
  end
end

- (Object) add_role_interface(personal_access_role_uri, personal_access_role = nil)

This command creates new role interface connection to the specified personal access role. The role interface has to be in an active state and mustn't be already connected. The role interface has to be connected to the one of the authorized roles for this command, or the authorized role has to be casted to the default group of meta model where the role interface is located.

Examples:

# Add role interface for specified access role.
UU::OS::PersonalAccessRole.add_role_interface('ues:TERRITORY:PERSONAL_ACCESS_ROLE', :role_interface_uri=>'ues:TERRITORY:ROLE_IFC')

Parameters:

  • personal_access_role_uri (String, UU::OS::UESURI)

    UESURI of the personal access role where the role interface will be connected

  • personal_access_role (PersonalAccessRoleAddRoleInterface) (defaults to: nil)

    DTO containing role interface that to be connected

Options Hash (personal_access_role):

  • :role_interface_uri (String, UU::OS::UESURI)

    UESURI of the role interface that to be connected to the specified personal access role. When nil is set, the command fails.



206
207
208
209
210
211
212
213
# File 'uu_os-0.29.16/lib/uu/os/personal_access_role.rb', line 206

def add_role_interface(personal_access_role_uri, personal_access_role = nil)
  svc = UU::OS::REST::RemoteClient.new(PersonalAccessRole)
  payload = UU::OS::PersonalAccessRole::PersonalAccessRoleAddRoleInterface.new(personal_access_role).to_json

  UU::OS::QoS::QoSHandler.auto_retry do
    svc.post('addRoleInterface', personal_access_role_uri, payload)
  end
end

- (UU::OS::UESURI) create(location_uri, personal_access_role = nil)

Creates a new personal access role. The command creates a new personal access role in a specified location. At the very least meta artifact must be specified in PersonalAccessRoleCreate DTO. Competent role for the new role will be selected as the most suitable according to the specified container and meta artifact (executive/authorized role with connected interface), or can be also specified in PersonalAccessRoleCreate DTO.

Examples:

# Create personal access role.
UU::OS::PersonalAccessRole.create('ues:UNI:FOLDER', :meta_artifact_uri=>'ues:TERRITORY:METAARTIFACT',:universe_id=>'37820001', :first_name=>'John', :surname=>'Doe', :code=>'DOECODE', :description=>'Some sample description',:searchable_in_territory=>true)

Parameters:

  • location_uri (String, UU::OS::UESURI)

    UESURI of the folder/org. unit/meta model where the personal access role will be created.

  • personal_access_role (PersonalAccessRoleCreate) (defaults to: nil)

    DTO containing attributes of the new personal access role

Options Hash (personal_access_role):

  • :meta_artifact_uri (String, UU::OS::UESURI)

    UESURI of the meta artifact. Only a meta artifact with the template class of an Access role (not its descendants) can be used. If the rights does not permit to create a new personal access role from the meta artifact in the specified location, the create command fails.

  • :universe_id (String)

    Universe identifier of the user. When nil is set, the create command fails.

  • :first_name (String)

    First name of the new personal access role. When nil is set, the create command fails.

  • :surname (String)

    Surname of the new personal access role. When nil is set, the create command fails.

  • :code (String)

    Code of the new personal access role. When nil is set, the code is generated automatically using the system sequence. The code must be unique in the given territory, otherwise the create command fails.

  • :description (String)

    Description of the new personal access role. When nil is set, description from meta artifact is used if set, otherwise no description is set on the new personal access role.

  • :competent_role_uri (String, UU::OS::UESURI)

    UESURI of the competent role. When nil is set, the executive role from authorization is used. If no role is authorized to create the personal access role into specified container, the create command fails. If the selected role doesn’t have connected the access role interface with the selected meta artifact, the create command fails. If the selected role doesn’t belong to the same organizational unit as anew role or if it doesn’t belong to one of superior organizational units, the create command fails.

  • :security_level (UU::OS::Artifact::SecurityLevel)

    Security level. When nil is set, security level is taken from the meta artifact default security level. If the meta artifact template security level is higher than the user’s security clearance, the create command fails.

  • :security_clearance (UU::OS::Artifact::SecurityLevel)

    Security clearance of the new personal access role. When nil is set, the value NO_CONFIDENTIALITY is used.

  • :searchable_in_territory (Boolean)

    Specifies if it is possible to search the new personal access role in its territory. When nil is set, SearchableInTerritory from meta artifact is used if set, otherwise the create command fails.

  • :icon_uri (String, UU::OS::UESURI)

    URI of the personal access role’s icon. When nil is set, the icon is not modified. If nil UESURI (“ues:[-1]:[-1]:”) is set, the personal access role icon is removed and the role uses icon from meta artifact. Allowed format of icon URI: ‘ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{CODE_OF_ICON}’. An example of icon URI: ‘ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{ART_077}’.

  • :grant_all_from_organizational_unit (Boolean)

    Deprecated. Specifies if the personal access role will be included among All roles from organizational unit. When true or nil is set, the personal access role will be included, otherwise it will not be included among All roles from organizational unit.

  • :force (Boolean)

    If set to true, new Personal Access Role will be created even if Personal Access Role in FINAL state for the same user exists in the given territory.

  • :component_content (Boolean)

    Defines whether the primarily displayed content of the created Personal access role is component content. Default value is false.

  • :avatar_uri (String)

    UESURI or URL of image which represents access role’s avatar (user photo). When nil is set, the access role will be created without avatar.

Returns:

Raises:

  • (UESPersonalAccessRoleRTException)


106
107
108
109
110
111
112
113
114
# File 'uu_os-0.29.16/lib/uu/os/personal_access_role.rb', line 106

def create(location_uri, personal_access_role = nil)
  svc = UU::OS::REST::RemoteClient.new(PersonalAccessRole)
  payload = UU::OS::PersonalAccessRole::PersonalAccessRoleCreate.new(personal_access_role).to_json

  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('create', location_uri, payload)
    return UU::OS::UESURI.new(res)
  end
end

- (Object) deactivate_access(personal_access_role_uri)

This command deactivates a personal access role. The personal access role will lose access to its territory.

Examples:

# Deactivate access for specified access role.
UU::OS::PersonalAccessRole.deactivate_access('ues:TERRITORY:PERSONAL_ACCESS_ROLE')

Parameters:

  • personal_access_role_uri (String, UU::OS::UESURI)

    UESURI of a personal access role that the access will be canceled.



223
224
225
226
227
228
# File 'uu_os-0.29.16/lib/uu/os/personal_access_role.rb', line 223

def deactivate_access(personal_access_role_uri)
  svc = UU::OS::REST::RemoteClient.new(PersonalAccessRole)
  UU::OS::QoS::QoSHandler.auto_retry do
    svc.post('deactivateAccess', personal_access_role_uri)
  end
end

- (PersonalAccessRoleAttributes) get_attributes(personal_access_role_uri)

This command returns attributes representing the personal access role specified by the personal_access_role_uri parameter. The command does not change the state of the role in the system.

Examples:

# Get attributes of specified personal access role.
UU::OS::PersonalAccessRole.get_attributes('ues:TERRITORY:PERSONAL_ACCESS_ROLE')

Parameters:

  • personal_access_role_uri (String, UU::OS::UESURI)

    UESURI of a personal access role whose attributes are returned

Returns:



33
34
35
36
37
38
39
# File 'uu_os-0.29.16/lib/uu/os/personal_access_role.rb', line 33

def get_attributes(personal_access_role_uri)
  svc = UU::OS::REST::RemoteClient.new(PersonalAccessRole)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('getAttributes', personal_access_role_uri)
    return PersonalAccessRole::PersonalAccessRoleAttributes.new(res)
  end
end

- (UU::OS::REST::ResultList<PersonalAccessRole::PersonalAccessRoleGetList, PersonalAccessRole::PersonalAccessRoleAttributes>) get_personal_access_role_list(territory_uri, criteria = nil)

Returns list of personal access roles in the given location with specified criteria.

Examples:

# UESURI of the UNI territory
terUri = 'ues:UNI-BT:UNI-BT'

# Get personal access role with uid 7-8864-1 in UNI territory if exists
list = UU::OS::PersonalAccessRole.get_personal_access_role_list(terUri, :query => "universeId = '7-8864-1'")

# Get list of all personal access roles in UNI territory
list = UU::OS::PersonalAccessRole.get_personal_access_role_list(terUri)

Parameters:

Options Hash (criteria):

  • :query (String)

    The query for filtering the result list. If it is not set, no filtering is applied and personal access roles are ordered by their firstName, surname and code. Available parameter is: universeId

Returns:



160
161
162
163
164
165
166
167
168
169
170
# File 'uu_os-0.29.16/lib/uu/os/personal_access_role.rb', line 160

def get_personal_access_role_list(territory_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(PersonalAccessRole)
  dto = PersonalAccessRole::PersonalAccessRoleGetList.new(criteria)
  svc.add_parameter('pageIndex', dto.page_index)
  svc.add_parameter('pageSize', dto.page_size)
  svc.add_parameter('query', dto.query)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('getAccessRoleList', territory_uri)
    return UU::OS::REST::ResultList.new(PersonalAccessRole::PersonalAccessRoleGetList, PersonalAccessRole::PersonalAccessRoleAttributes, res)
  end
end

- (UU::OS::REST::ResultList<PersonalAccessRole::PersonalAccessRoleGetRoleInterfaceList, PersonalAccessRole::PersonalAccessRoleGetRoleInterfaceListItem>) get_role_interface_list(personal_access_role_uri, criteria = nil)

Returns list of the role interfaces that are connected to the specified access role. The list of returned interfaces could be filtered by the name or code. Returned list does not contain any objects filtered out by executed UESQuery. The list is sorted by the name (and by code in case are equal) of an interface by default.

Examples:

# Get role interface list descend ordered by code.
roleIfcList = UU::OS::PersonalAccessRole.get_role_interface_list('ues:TERRITORY:ACCESSROLE', :query=>'ORDER BY code DESC')

Parameters:

Options Hash (criteria):

  • :query (String)

    The UES query string. It has to conform the uesquery syntax (see documentation for more info). Filtering and order of the result list can be specified there. When nil is set, no filtering is applied and entries are ordered by name of casted subjects (and code as the second criteria). See UESQuery Documentation.

Returns:



130
131
132
133
134
135
136
137
138
139
140
# File 'uu_os-0.29.16/lib/uu/os/personal_access_role.rb', line 130

def get_role_interface_list(personal_access_role_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(PersonalAccessRole)
  dto = PersonalAccessRole::PersonalAccessRoleGetRoleInterfaceList.new(criteria)
  svc.add_parameter('pageIndex', dto.page_index)
  svc.add_parameter('pageSize', dto.page_size)
  svc.add_parameter('query', dto.query)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('getRoleInterfaceList', personal_access_role_uri)
    return UU::OS::REST::ResultList.new(PersonalAccessRole::PersonalAccessRoleGetRoleInterfaceList, PersonalAccessRole::PersonalAccessRoleGetRoleInterfaceListItem, res)
  end
end

- (Object) remove_role_interface(personal_access_role_uri, personal_access_role = nil)

The command removes role interface connection from the specified personal access role. Only connected interfaces can be disconnected from the personal access role.

Examples:

# Remove role interface for specified personal access role
UU::OS::PersonalAccessRole.remove_role_interface('ues:TERRITORY:PERSONAL_ACCESS_ROLE',:role_interface_uri=>'ues:TERRITORY:ROLE_IFC')

Parameters:

  • personal_access_role_uri (String, UU::OS::UESURI)

    UESURI of the personal access role where the role interface will be disconnected

  • personal_access_role (PersonalAccessRoleRemoveRoleInterface) (defaults to: nil)

    DTO containing role interface that to be disconnected

Options Hash (personal_access_role):

  • :role_interface_uri (String, UU::OS::UESURI)

    UESURI of the role interface that to be unconnected from the specified personal access role. When nil is set, the command fails.



183
184
185
186
187
188
189
190
# File 'uu_os-0.29.16/lib/uu/os/personal_access_role.rb', line 183

def remove_role_interface(personal_access_role_uri, personal_access_role = nil)
  svc = UU::OS::REST::RemoteClient.new(PersonalAccessRole)
  payload = UU::OS::PersonalAccessRole::PersonalAccessRoleRemoveRoleInterface.new(personal_access_role).to_json

  UU::OS::QoS::QoSHandler.auto_retry do
    svc.post('removeRoleInterface', personal_access_role_uri, payload)
  end
end

- (UU::OS::UESURI) set_attributes(personal_access_role_uri, personal_access_role = nil)

Command for setting attributes of a personal access role. The command can't modify references to objects like location, competent role and so on.

Examples:

#Set attributes of personal access role.
accessRoleUri = UU::OS::PersonalAccessRole.set_attributes('ues:TERRITORY:PERSONAL_ACCESS_ROLE', :first_name=>'John', :surname=>'Doe', :code=>'NEWACCESSCODE', :description=>'Some basic access role',:security_level=>UU::OS::Artifact::SecurityLevel::CONFIDENTIAL,:searchable_in_territory=>false)

Parameters:

  • personal_access_role_uri (String, UU::OS::UESURI)

    UESURI of the personal access role whose attributes are to be changed

  • personal_access_role (PersonalAccessRoleSetAttributes) (defaults to: nil)

    DTO containing new attributes the personal access role

Options Hash (personal_access_role):

  • :first_name (String)

    The new first name of the personal access role. When nil is set, the first name is not modified.

  • :surname (String)

    The new surname of the personal access role. When nil is set, the surname is not modified.

  • :code (String)

    The new code of the personal access role. When nil is set, the code is not modified. When blank string is set, the code is generated automatically using the system sequence. The code must be unique in a given territory, otherwise the setAttributes command fails.

  • :description (String)

    The new description of the personal access role. When nil is set, the description is not modified.

  • :security_level (UU::OS::Artifact::SecurityLevel)

    Security level of the new personal access role. When nil is set, security level is taken from the meta artifact SecurityLevel. If the meta artifact SecurityLevel is higher than the user’s security clearance, the create command fails.

  • :security_clearance (UU::OS::Artifact::SecurityLevel)

    Security clearance of the new personal access role. When nil is set, the security clearance is not modified.

  • :searchable_in_territory (Boolean)

    Specifies if it is possible to search the personal access role in its territory. When nil is set, this attribute on the personal access role is not modified.

  • :icon_uri (String, UU::OS::UESURI)

    URI of the personal access role’s icon. When nil is set, the icon is not modified. If nil UESURI (“ues:[-1]:[-1]:”) is set, the personal access role icon is removed and the personal access role uses icon from meta artifact. Allowed format of icon URI: ‘ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{CODE_OF_ICON}’. An example of icon URI: ‘ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{ART_077}’.

  • :grant_all_from_organizational_unit (Boolean)

    Deprecated. Specifies if the personal access role will be included among All roles from organizational unit. When nil is set, this attribute on the personal access role is not modified.

  • :component_content (Boolean)

    Defines whether the primarily displayed content of the created Personal access role is component content. Default value is false.

  • :avatar_uri (String)

    UESURI or URL of image which represents access role’s avatar (user photo). If set to an empty string, the value will be erased. When nil is set, the value is not modified.

Returns:



64
65
66
67
68
69
70
71
72
# File 'uu_os-0.29.16/lib/uu/os/personal_access_role.rb', line 64

def set_attributes(personal_access_role_uri, personal_access_role = nil)
  svc = UU::OS::REST::RemoteClient.new(PersonalAccessRole)
  payload = UU::OS::PersonalAccessRole::PersonalAccessRoleSetAttributes.new(personal_access_role).to_json

  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('setAttributes', personal_access_role_uri, payload)
    return UU::OS::UESURI.new(res)
  end
end