Module: UU::OS::Role

Extended by:
Role
Included in:
Role
Defined in:
uu_os_client-0.10.6/lib/uu/os/role/role_create.rb,
uu_os_client-0.10.6/lib/uu/os/role.rb,
uu_os_client-0.10.6/lib/uu/os/role/role_attributes.rb,
uu_os_client-0.10.6/lib/uu/os/role/role_set_attributes.rb,
uu_os_client-0.10.6/lib/uu/os/role/role_get_artifact_list.rb,
uu_os_client-0.10.6/lib/uu/os/role/role_add_role_interface.rb,
uu_os_client-0.10.6/lib/uu/os/role/role_remove_role_interface.rb,
uu_os_client-0.10.6/lib/uu/os/role/role_get_artifact_list_item.rb,
uu_os_client-0.10.6/lib/uu/os/role/role_get_role_interface_list.rb,
uu_os_client-0.10.6/lib/uu/os/role/role_get_role_interface_list_item.rb

Overview

Module Role.

Defined Under Namespace

Classes: RoleAddRoleInterface, RoleAttributes, RoleCreate, RoleGetArtifactList, RoleGetArtifactListItem, RoleGetRoleInterfaceList, RoleGetRoleInterfaceListItem, RoleRemoveRoleInterface, RoleSetAttributes

Constant Summary

PATH =

Service path

'ues/core/role/UESRole'

Instance Method Summary (collapse)

Instance Method Details

- (Object) add_role_interface(role_uri, role = nil)

This command creates new role interface connection to the specified 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.

Parameters:

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

    UESURI of the role where the role interface will be connected

  • role (RoleAddRoleInterface) (defaults to: nil)

    DTO containing role interface that to be connected



140
141
142
143
144
145
146
147
# File 'uu_os_client-0.10.6/lib/uu/os/role.rb', line 140

def add_role_interface(role_uri, role = nil)
  svc = UU::OS::REST::RemoteClient.new(Role)
  payload = UU::OS::Role::RoleAddRoleInterface.new(role).to_json

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

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

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

Examples:

# Create new role.
UU::OS::Role.create('ues:TERRITORY:FOLDER', :code => 'NEW_ROLE', :name => 'New Role')

# Verifying that new role can be created.
UU::OS::Role.create('ues:TERRITORY:FOLDER', :code => 'NEW_ROLE', :name => 'New Role', :dryRun => true)

Parameters:

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

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

  • role (UU::OS::Role::RoleCreate) (defaults to: nil)

    Specific options.

Options Hash (role):

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

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

  • :code (String)

    Code of the new role. When null 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.

  • :name (String)

    Name of the new role. When null is set, tName from meta artifact is used if set, otherwise the create command fails. Note that the role name is automatically extended by the name of casted access roles names. Therefore the name attribute returned by getAttributes command returns a different string.

  • :description (String)

    Description of the new role. When null is set, tDescription from meta artifact is used if set, otherwise no description is set on the new role.

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

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

  • :security_level (String)

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

  • :searchable_in_territory (Boolean)

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

  • :searchable_across_territories (Boolean)

    Specifies if it is possible to search and cast the new role in other territories. When null is set, tSearchableAcrossTerritories from meta artifact is used if set, otherwise the create command fails. This attribute has been deprecated and will not be supported in the future.

  • :territory_switch_visible (Boolean)

    Specifies if the organizational unit of this role should be visible invisual usecase for displaying list of territories and organizational units. When true is set then related organizational unit is displayed. When false is set then related organizational unit is not visible unless there is another role with this flag set to true. When null is set, tTerritorySwitchVisible from meta artifact is used if set, otherwise the create command fails. This attribute has been deprecated. The visual use case for displaying territories and organizational units, which this attribute was used for, is no longer supported.

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

    URI of the role’s icon. When null is set, the role uses icon from meta artifact.
    Allowed format URI of icon:ues:#system:#UU::OS::Role.ues_v5ues_v5.core_v1ues_v5.core_v1.codetable_v1ues_v5.core_v1.codetable_v1.base_v1ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons:#CODE_OF_ICON
    For example:ues:#system:#UU::OS::Role.ues_v5ues_v5.core_v1ues_v5.core_v1.codetable_v1ues_v5.core_v1.codetable_v1.base_v1ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons:#ART_077

  • :grant_all_from_organizational_unit (Boolean)

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

  • :dry_run (Boolean)

    Specifies whether this is only a test run to verify that the object can be created. The default value is false.

Returns:



54
55
56
57
58
59
60
61
62
# File 'uu_os_client-0.10.6/lib/uu/os/role.rb', line 54

def create(location_uri, role = nil)
  svc = UU::OS::REST::RemoteClient.new(Role)
  payload = UU::OS::Role::RoleCreate.new(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) delete(role_uri)

This command deletes the specified role from the system. The role is deleted even if it contains a locked sheet or attachment. The role cannot be deleted when:

the role is not in an active cast
the role's workflow is not created
a property contains a reference to this role 
a time sheet exists with a reference to this role 
an artifact exists with this role as competent role 
an activity exists with this role as competent role

Parameters:

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

    UESURI of the role which is about to be deleted.



105
106
107
108
109
110
# File 'uu_os_client-0.10.6/lib/uu/os/role.rb', line 105

def delete(role_uri)
  svc = UU::OS::REST::RemoteClient.new(Role)
  UU::OS::QoS::QoSHandler.auto_retry do
    svc.post('delete', role_uri)
  end
end

- (UU::OS::REST::ResultList<Role::RoleGetArtifactList, Role::RoleGetArtifactListItem>) get_artifact_list(role_uri, criteria = nil)

This command returns a list of entries representing the artifacts for that the specified role is competent. The list is sorted by the name(and codes in case are equal) of a entry by default.

Parameters:

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

    UESURI of the role that is competent for the searched artifacts

  • criteria (RoleGetArtifactList) (defaults to: nil)

    DTO containing criteria for listing role’sartifacts.

Returns:



120
121
122
123
124
125
126
127
128
129
130
# File 'uu_os_client-0.10.6/lib/uu/os/role.rb', line 120

def get_artifact_list(role_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(Role)
  dto = Role::RoleGetArtifactList.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('getArtifactList', role_uri)
    return UU::OS::REST::ResultList.new(Role::RoleGetArtifactList, Role::RoleGetArtifactListItem, res)
  end
end

- (RoleAttributes) get_attributes(role_uri)

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

Parameters:

Returns:



70
71
72
73
74
75
76
# File 'uu_os_client-0.10.6/lib/uu/os/role.rb', line 70

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

- (UU::OS::REST::ResultList<Role::RoleGetRoleInterfaceList, Role::RoleGetRoleInterfaceListItem>) get_role_interface_list(role_uri, criteria = nil)

Returns list of the role interfaces that are connected to the specified role. Returned list does not contain any objects filtered out by executed UESQuery.

See UESQuery Documentation.

Parameters:

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

    UES URI of the role for which the connected role interfaces are to be listed

  • criteria (RoleGetRoleInterfaceList) (defaults to: nil)

    DTOcontaining criteria for listing connected role interfaces

Returns:



172
173
174
175
176
177
178
179
180
181
182
# File 'uu_os_client-0.10.6/lib/uu/os/role.rb', line 172

def get_role_interface_list(role_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(Role)
  dto = Role::RoleGetRoleInterfaceList.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', role_uri)
    return UU::OS::REST::ResultList.new(Role::RoleGetRoleInterfaceList, Role::RoleGetRoleInterfaceListItem, res)
  end
end

- (Object) remove_role_interface(role_uri, role = nil)

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

Parameters:

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

    UESURI of the role where the role interface will be disconnected.

  • role (RoleRemoveRoleInterface) (defaults to: nil)

    DTO containing role interface that to be disconnected



154
155
156
157
158
159
160
161
# File 'uu_os_client-0.10.6/lib/uu/os/role.rb', line 154

def remove_role_interface(role_uri, role = nil)
  svc = UU::OS::REST::RemoteClient.new(Role)
  payload = UU::OS::Role::RoleRemoveRoleInterface.new(role).to_json

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

- (UU::OS::UESURI) set_attributes(role_uri, role = nil)

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

Parameters:

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

    UESURI of the role whose attributes are to be changed

  • role (RoleSetAttributes) (defaults to: nil)

    DTO containing new attributes for the role

Returns:



85
86
87
88
89
90
91
92
93
# File 'uu_os_client-0.10.6/lib/uu/os/role.rb', line 85

def set_attributes(role_uri, role = nil)
  svc = UU::OS::REST::RemoteClient.new(Role)
  payload = UU::OS::Role::RoleSetAttributes.new(role).to_json

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