Module: UU::OS::MetaPermission

Extended by:
MetaPermission
Included in:
MetaPermission
Defined in:
uu_os-0.29.16/lib/uu/os/meta_permission.rb,
uu_os-0.29.16/lib/uu/os/meta_permission/meta_permission_grant.rb,
uu_os-0.29.16/lib/uu/os/meta_permission/meta_permission_level.rb,
uu_os-0.29.16/lib/uu/os/meta_permission/meta_permission_revoke.rb,
uu_os-0.29.16/lib/uu/os/meta_permission/meta_permission_create_mask.rb,
uu_os-0.29.16/lib/uu/os/meta_permission/meta_permission_get_mask_data.rb,
uu_os-0.29.16/lib/uu/os/meta_permission/meta_permission_set_mask_data.rb,
uu_os-0.29.16/lib/uu/os/meta_permission/meta_permission_get_mask_list.rb,
uu_os-0.29.16/lib/uu/os/meta_permission/meta_permission_get_authority_list.rb,
uu_os-0.29.16/lib/uu/os/meta_permission/meta_permission_get_authority_data.rb,
uu_os-0.29.16/lib/uu/os/meta_permission/meta_permission_get_mask_attributes.rb,
uu_os-0.29.16/lib/uu/os/meta_permission/meta_permission_set_mask_attributes.rb,
uu_os-0.29.16/lib/uu/os/meta_permission/meta_permission_get_system_group_list.rb,
uu_os-0.29.16/lib/uu/os/meta_permission/meta_permission_get_authority_list_item.rb,
uu_os-0.29.16/lib/uu/os/meta_permission/meta_permission_get_system_group_attributes.rb

Overview

Module Meta Permission.

Defined Under Namespace

Classes: MetaPermissionCreateMask, MetaPermissionGetAuthorityData, MetaPermissionGetAuthorityList, MetaPermissionGetAuthorityListItem, MetaPermissionGetMaskAttributes, MetaPermissionGetMaskData, MetaPermissionGetMaskList, MetaPermissionGetSystemGroupAttributes, MetaPermissionGetSystemGroupList, MetaPermissionGrant, MetaPermissionLevel, MetaPermissionRevoke, MetaPermissionSetMaskAttributes, MetaPermissionSetMaskData

Constant Summary

PATH =

REST service url path.

'ues/core/security/UESMetaPermission'

Instance Method Summary (collapse)

Instance Method Details

- (UU::OS::UESURI) create_mask(template_uri, mask)

Creates a permission mask. (Mask contains prescription of the levels of meta permissions.)

Examples:

# Prepare new permission mask data.
mask_data = '[{"useCaseCode":"AU_103129","castLevel":"$GUEST"}]'

# Prepare new permission mask labels.
mask_labels = '{"en":"Read","cs":"Čtení","ru":"Чтение"}'

# Create a new permission mask.
UU::OS::MetaPermission.create_mask('ues:TERRITORY:META_ARTIFACT', :name => 'Read', :code => 'READ', :description => 'Read permission mask', :data => mask_data, labels => mask_labels)

Parameters:

Options Hash (mask):

  • :name (String)

    Name of the new permission mask. Must not be nil.

  • :code (String)

    Code of the new permission mask. Must be unique for the template object. When nil is set, new code is generated automatically from the sequence.

  • :description (String)

    Description of the new permission mask.

  • :data (String, File, UU::OS::REST::BinaryValue)

    Data settings of the new permission mask in JSON format (containing prescription of use cases and levels).

  • :default_mask (Boolean)

    Flag indicating whether the new permission mask is to be set as default for the template object. Default value is false.

  • :labels (String)

    Name of the new permission mask in different languages. This attribute must be entered in JSON format.

Returns:



169
170
171
172
173
174
175
176
177
# File 'uu_os-0.29.16/lib/uu/os/meta_permission.rb', line 169

def create_mask(template_uri, mask)
  svc = UU::OS::REST::RemoteClient.new(MetaPermission)
  payload = UU::OS::MetaPermission::MetaPermissionCreateMask.new(mask).to_json

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

- (Object) delete_mask(mask_uri)

Deletes a permission mask. It is not possible to delete permission mask which is marked as default.

Examples:

# Delete a permission mask.
UU::OS::MetaPermission.delete('ues:TERRITORY:META_ARTIFACT:MASK')

Parameters:

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

    UESURI of the permission mask which will be deleted.



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

def delete_mask(mask_uri)
  svc = UU::OS::REST::RemoteClient.new(MetaPermission)

  UU::OS::QoS::QoSHandler.auto_retry do
    svc.post('deleteMask', mask_uri)
  end
end

- (UU::OS::REST::BinaryValue) get_authority_data(template_uri, options)

Returns data about meta permissions granted to the given authority (Roles, Groups or System Groups) on a template object (only meta artifacts in current version).
To list all authorities with granted meta permissions use uuCommand #get_authority_list.

Examples:

# Get meta permissions granted to Group or Role in JSON format.
UU::OS::MetaPermission.get_authority_data('ues:TERRITORY:META_ARTIFACT', :authority_uri => 'ues:TERRITORY:ROLE')

# Get meta permissions granted to System Group in JSON format.
UU::OS::MetaPermission.get_authority_data('ues:TERRITORY:META_ARTIFACT', :authority_uri => 'ues:${system}:COMPETENT_FOR_ART_IFC')

# Get meta permissions granted to Group or Role in CSV format.
UU::OS::MetaPermission.get_authority_data('ues:TERRITORY:META_ARTIFACT', :authority_uri => 'ues:TERRITORY:ROLE', :requested_mime_type => 'text/csv')

Parameters:

Options Hash (options):

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

    UESURI of the authority whose granted meta permission settings will be returned. Must not be nil.

  • :requested_mime_type (String)

    MIME type of the returned value. Possible values are ‘application/json’ for JSON and ‘text/csv’ for CSV. JSON is returned by default.

Returns:



134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'uu_os-0.29.16/lib/uu/os/meta_permission.rb', line 134

def get_authority_data(template_uri, options)
  svc = UU::OS::REST::RemoteClient.new(MetaPermission)
  dto = UU::OS::MetaPermission::MetaPermissionGetAuthorityData.new(options)
  if dto.requested_mime_type
    svc.add_parameter('requestedMimeType', dto.requested_mime_type)
  end
  svc.add_parameter('authorityUri', dto.authority_uri)

  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('getAuthorityData', template_uri)
    return UU::OS::REST::BinaryValue.new(res, true)
  end
end

- (Array) get_authority_list(template_uri, criteria = nil)

Returns a list of authorities (Roles, Groups or System Groups) who have been granted meta permissions on a template object (only meta artifacts in current version).

Examples:

# Get a list of all authorities which have been granted meta permissions for a meta artifact.
UU::OS::MetaPermission.get_authority_list('ues:TERRITORY:META_ARTIFACT')

# Get a list of all authorities with authority_name that starts with string John.
UU::OS::MetaPermission.get_authority_list('ues:TERRITORY:META_ARTIFACT', :query => "authority_name='John%'")

Parameters:

Options Hash (criteria):

  • :query (String)

    Query for filtering and ordering of the result list (more information in uuQuery - Guideline). It is possible to filter the result list by authorityUri and authorityName.

Returns:



103
104
105
106
107
108
109
110
111
112
113
# File 'uu_os-0.29.16/lib/uu/os/meta_permission.rb', line 103

def get_authority_list(template_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaPermission)
  dto = MetaPermission::MetaPermissionGetAuthorityList.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('getAuthorityList', template_uri)
    return UU::OS::REST::ResultList.new(MetaPermission::MetaPermissionGetAuthorityList, MetaPermission::MetaPermissionGetAuthorityListItem, res)
  end
end

- (UU::OS::MetaPermission::MetaPermissionGetMaskAttributes) get_mask_attributes(mask_uri)

Returns attributes of a permission mask.

Examples:

#Get attributes of a permission mask
UU::OS::MetaPermission.get_mask_attributes('ues:TERRITORY:META_ARTIFACT:MASK')

Parameters:

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

    UESURI of the permission mask whose attributes will be returned.

Returns:



202
203
204
205
206
207
208
# File 'uu_os-0.29.16/lib/uu/os/meta_permission.rb', line 202

def get_mask_attributes(mask_uri)
  svc = UU::OS::REST::RemoteClient.new(MetaPermission)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('getMaskAttributes', mask_uri)
    return MetaPermission::MetaPermissionGetMaskAttributes.new(res)
  end
end

- (UU::OS::REST::BinaryValue) get_mask_data(mask_uri, options = nil)

Returns data settings of a permission mask.

Examples:

UU::OS::MetaPermission.get_mask_data('ues:TERRITORY:META_ARTIFACT:MASK')

Parameters:

Options Hash (options):

  • :requested_mime_type (String)

    MIME type of the returned value. Possible values are ‘application/json’ for JSON and ‘text/csv’ for CSV. JSON is returned by default.

Returns:



220
221
222
223
224
225
226
227
228
229
230
231
# File 'uu_os-0.29.16/lib/uu/os/meta_permission.rb', line 220

def get_mask_data(mask_uri, options = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaPermission)
  dto = UU::OS::MetaPermission::MetaPermissionGetMaskData.new(options)
  if dto.requested_mime_type
    svc.add_parameter('requestedMimeType', dto.requested_mime_type)
  end

  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('getMaskData', mask_uri)
    return UU::OS::REST::BinaryValue.new(res, true)
  end
end

- (Array) get_mask_list(template_uri, criteria = nil)

Returns a list of permission masks for a template object (only meta artifacts in current version).

Examples:

# Get a list of all permission masks whose name starts with string "Create" and code starts with string "CREATE".
UU::OS::MetaPermission.get_mask_list('ues:TERRITORY:META_ARTIFACT', :query => "name='Create%' AND code='CREATE%'")

Parameters:

Options Hash (criteria):

  • :query (String)

    Query for filtering and ordering of the result list (more information in uuQuery - Guideline). It is possible to filter the result list by name and code.

Returns:



244
245
246
247
248
249
250
251
252
253
254
# File 'uu_os-0.29.16/lib/uu/os/meta_permission.rb', line 244

def get_mask_list(template_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaPermission)
  dto = MetaPermission::MetaPermissionGetMaskList.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('getMaskList', template_uri)
    return UU::OS::REST::ResultList.new(MetaPermission::MetaPermissionGetMaskList, MetaPermission::MetaPermissionGetMaskAttributes, res)
  end
end

- (Array) get_system_group_list(entity_uri, criteria = nil)

Returns a list of System Groups of an entity (template object or pack). It may be used to set meta permissions for these groups.

Examples:

# Get a list of all System Groups for given entity.
UU::OS::MetaPermission.get_system_group_list('ues:TERRITORY:META_ARTIFACT')

Parameters:

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

    UESURI of the template object. Must not be nil.

Returns:



316
317
318
319
320
321
322
323
324
# File 'uu_os-0.29.16/lib/uu/os/meta_permission.rb', line 316

def get_system_group_list(entity_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaPermission)
  dto = MetaPermission::MetaPermissionGetSystemGroupList.new(criteria)

  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('getSystemGroupList', entity_uri)
    return UU::OS::REST::ResultList.new(MetaPermission::MetaPermissionGetSystemGroupList, MetaPermission::MetaPermissionGetSystemGroupAttributes, res)
  end
end

- (Object) grant(template_uri, meta_permission_grant)

Grants meta permissions on a template object (only meta artifacts in current version) for given Use Cases. It is possible to grant meta permissions on template objects for any allowed authority (Role, Group or System Group).
To list all allowed system groups use uuCommand #get_system_group_list.
All possible levels may be found as constants in MetaPermissionLevel class.

Examples:

# Prepare data for the meta permission in JSON format.
grant_data = '[{"useCaseCode":"AU_103129","castLevel":"$GUEST"}]'

# Grant meta permissions for Group or Role.
UU::OS::MetaPermission.grant('ues:TERRITORY:META_ARTIFACT', :authority_uri => 'ues:TERRITORY:ROLE', :data => grant_data)

# Grant meta permissions for System Group.
UU::OS::MetaPermission.grant('ues:TERRITORY:META_ARTIFACT', :authority_uri => 'ues:${system}:COMPETENT_FOR_ART_IFC', :data => grant_data)

Parameters:

Options Hash (meta_permission_grant):

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

    UESURI of the authority for which the meta permissions will be granted. Must not be nil.

  • :data (String, File, UU::OS::REST::BinaryValue)

    Information about meta permission settings in JSON format. The meta permission is specified by the use case and the level. Must not be nil.



51
52
53
54
55
56
57
58
# File 'uu_os-0.29.16/lib/uu/os/meta_permission.rb', line 51

def grant(template_uri, meta_permission_grant)
  svc = UU::OS::REST::RemoteClient.new(MetaPermission)
  payload = UU::OS::MetaPermission::MetaPermissionGrant.new(meta_permission_grant).to_json

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

- (Object) revoke(template_uri, meta_permission_revoke)

Revokes meta permissions on a template object (only meta artifacts in current version) for given Use Cases. It is possible to revoke meta permissions on template objects for any allowed authority (Role, Group or System Group).
To list all allowed system groups use uuCommand #get_system_group_list.

Examples:

# Revoke meta permissions on all Use Cases for System Group
UU::OS::MetaPermission.revoke('ues:TERRITORY:META_ARTIFACT', :authority_uri => 'ues:${system}:COMPETENT_FOR_ART_IFC', :all => true)

# Revoke meta permissions on all Use Cases for Group or Role.
UU::OS::MetaPermission.revoke('ues:TERRITORY:META_ARTIFACT', :authority_uri => 'ues:TERRITORY:ROLE', :all => true)

# Revoke meta permissions on specified Use Cases for Group or Role.
revoke_data = '[{"useCaseCode":"AU_103129"},{"useCaseCode":"AU_103300"}]'
UU::OS::MetaPermission.revoke('ues:TERRITORY:META_ARTIFACT', :authority_uri => 'ues:TERRITORY:ROLE', :data => revoke_data)

Parameters:

Options Hash (meta_permission_revoke):

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

    UESURI of the authority for which the meta permissions will be revoked. Must not be nil.

  • :data (String, File, UU::OS::REST::BinaryValue)

    List of Use Cases (in JSON format) for which the meta permission will be revoked.

  • :all (Boolean)

    When true is set, meta permissions will be revoked for all Use Cases. Default value is false. Option :data has higher priority than this one.



80
81
82
83
84
85
86
87
# File 'uu_os-0.29.16/lib/uu/os/meta_permission.rb', line 80

def revoke(template_uri, meta_permission_revoke)
  svc = UU::OS::REST::RemoteClient.new(MetaPermission)
  payload = UU::OS::MetaPermission::MetaPermissionRevoke.new(meta_permission_revoke).to_json        

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

- (UU::OS::UESURI) set_mask_attributes(mask_uri, mask = nil)

Modifies attributes of a permission mask.

Examples:

# Prepare labels
mask_labels = '{"en":"Read / Write","cs":"Čtení / Zápis","ru":"Чтение / записи"}'

# Modify a permission mask.
UU::OS::MetaPermission.set_mask_attributes('ues:TERRITORY:META_ARTIFACT:MASK', :name => 'Read / Write', :code => 'READWRITE',
  :description => 'Read / Write permission mask', :default_mask => true, :labels => mask_labels)

Parameters:

Options Hash (mask):

  • :name (String)

    New name of the permission mask. When nil is set, the attribute will not be modified. Must not be blank.

  • :code (String)

    New code of the permission mask. Must be unique for the template object. When nil is set, the attribute will not be modified. When blank string is set, a new code will be generated automatically from the sequence.

  • :description (String)

    New description of the permission mask.

  • :default_mask (Boolean)

    Flag indicating whether the permission mask is set as default for the template for which the mask is defined.

  • :labels (String)

    New names of the permission mask in different laguages. This attribute must be entered in JSON format.

Returns:



275
276
277
278
279
280
281
282
283
# File 'uu_os-0.29.16/lib/uu/os/meta_permission.rb', line 275

def set_mask_attributes(mask_uri, mask = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaPermission)
  payload = UU::OS::MetaPermission::MetaPermissionSetMaskAttributes.new(mask).to_json

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

- (Object) set_mask_data(mask_uri, mask_data)

Stores a permission mask settings. The mask settings is list of pairs an use case code (access unit in current version) and a cast level.

Examples:

# Prepare new permission mask data in JSON Format
mask_data = '[{"useCaseCode":"AU_103129","castLevel":"$GUEST"}]'

# Set data of an existing permission mask
UU::OS::MetaPermission.set_mask_data('ues:TERRITORY:META_ARTIFACT:MASK', :data => mask_data)

Parameters:

Options Hash (mask_data):

  • :data (String)

    Data for settings permission mask. Only JSON (“application/json”) or CSV (“text/csv”) format is accepted.



298
299
300
301
302
303
304
305
# File 'uu_os-0.29.16/lib/uu/os/meta_permission.rb', line 298

def set_mask_data(mask_uri, mask_data)
  svc = UU::OS::REST::RemoteClient.new(MetaPermission)
  payload = UU::OS::MetaPermission::MetaPermissionSetMaskData.new(mask_data).to_json

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