Module: UU::OS::AllFromOrganizationalUnitCast

Extended by:
AllFromOrganizationalUnitCast
Included in:
AllFromOrganizationalUnitCast
Defined in:
uu_os_client-0.10.6/lib/uu/os/all_from_organizational_unit_cast.rb,
uu_os_client-0.10.6/lib/uu/os/all_from_organizational_unit_cast/all_from_organizational_unit_cast_exists.rb,
uu_os_client-0.10.6/lib/uu/os/all_from_organizational_unit_cast/all_from_organizational_unit_cast_delete.rb,
uu_os_client-0.10.6/lib/uu/os/all_from_organizational_unit_cast/all_from_organizational_unit_cast_create.rb,
uu_os_client-0.10.6/lib/uu/os/all_from_organizational_unit_cast/all_from_organizational_unit_cast_attributes.rb,
uu_os_client-0.10.6/lib/uu/os/all_from_organizational_unit_cast/all_from_organizational_unit_cast_get_cast_list.rb,
uu_os_client-0.10.6/lib/uu/os/all_from_organizational_unit_cast/all_from_organizational_unit_cast_set_attributes.rb,
uu_os_client-0.10.6/lib/uu/os/all_from_organizational_unit_cast/all_from_organizational_unit_cast_get_attributes.rb

Overview

Module All From Organizational Unit Cast.

Defined Under Namespace

Classes: AllFromOrganizationalUnitCastAttributes, AllFromOrganizationalUnitCastCreate, AllFromOrganizationalUnitCastDelete, AllFromOrganizationalUnitCastExists, AllFromOrganizationalUnitCastGetAttributes, AllFromOrganizationalUnitCastGetCastList, AllFromOrganizationalUnitCastSetAttributes

Constant Summary

PATH =

Service path

'uu/os/AllFromOrganizationalUnitCast'

Instance Method Summary (collapse)

Instance Method Details

- (Object) create(organizational_unit_uri, cast = nil)

Casts a subject (specified in the parameter casted_subject_uri) to the group All From Organizational Unit which is derived from specified organizational unit. Only cast between subject and group All From Organizational Unit from the same organizational unit is supported. Any change of user authorization resulting from the cast modification will take effect approximately after 15 minutes.

Parameters:

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

    UESURI of the organizational unit from which is the group All From Organization Unit derived. Another subject is casted to the derived group.

  • cast (AllFromOrganizationalUnitCastCreate) (defaults to: nil)

    Object containing attributes of the cast

Options Hash (cast):

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

    UESURI of the subject (role or group) which is to be casted to the group All From Organizational Unit identified by the command main entity. Never nil.

  • :level (String)

    The level of the new cast relation. When nil is set EXECUTIVE level is used. All possible levels can be found as constants in UU::OS::Cast::CastLevel class.

  • :date_to (String)

    The informative field describing the date when the cast should expire. When nil is set, no date is set.



33
34
35
36
37
38
39
40
# File 'uu_os_client-0.10.6/lib/uu/os/all_from_organizational_unit_cast.rb', line 33

def create(organizational_unit_uri, cast = nil)
  svc = UU::OS::REST::RemoteClient.new(AllFromOrganizationalUnitCast)
  payload = UU::OS::AllFromOrganizationalUnitCast::AllFromOrganizationalUnitCastCreate.new(cast).to_json

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

- (Object) delete(organizational_unit_uri, cast = nil)

Deletes the cast from the system. Any change of user authorization resulting from the cast modification will take effect approximately after 15 minutes.

Parameters:

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

    UESURI of the organizational unit from which is the group All From Organization Unit derived.

  • cast (AllFromOrganizationalUnitCastDelete) (defaults to: nil)

    Object containing ues uri of the casted subject.

Options Hash (cast):

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

    UESURI of the subject (role or group) which is casted to the group All From Organizational Unit identified by the command main entity. Cannot be nil.



108
109
110
111
112
113
114
115
# File 'uu_os_client-0.10.6/lib/uu/os/all_from_organizational_unit_cast.rb', line 108

def delete(organizational_unit_uri, cast = nil)
  svc = UU::OS::REST::RemoteClient.new(AllFromOrganizationalUnitCast)
  payload = UU::OS::AllFromOrganizationalUnitCast::AllFromOrganizationalUnitCastDelete.new(cast).to_json

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

- (Boolean) exists(organizational_unit_uri, cast)

Checks whether the subject (specified in the parameter casted_subject_uri) is casted to the group All From Organizational Unit which is derived from the specified organizational unit.

Examples:

# Check direct cast existence (the role has cast to All From Organizational Unit derived from ORGANIZATIONAL_UNIT).
UU::OS::AllFromOrganizationalUnitCast.exists('ues:TERRITORY:ORGANIZATIONAL_UNIT', :casted_subject_uri => 'ues:TERRITORY:ROLE')

# Check indirect access role cast existence (the access role has cast to a role which has cast to All From Organizational Unit derived from ORGANIZATIONAL_UNIT).
UU::OS::AllFromOrganizationalUnitCast.exists('ues:TERRITORY:ORGANIZATIONAL_UNIT', :casted_subject_uri => 'ues:TERRITORY:ACCESS_ROLE', :recursive => true)

Parameters:

Options Hash (cast):

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

    UESURI of the subject (role or group) which is casted to the group All From Organizational Unit identified by the command main entity. Cannot be nil.

  • :recursive (Boolean)

    Flag indicating whether the uuCommand checks indirect cast existence. In current uuCommand version it is possible to check indirect cast only for access roles. Default value is false.

Returns:

  • (Boolean)

    True if cast exists, else false.



134
135
136
137
138
139
140
141
142
143
# File 'uu_os_client-0.10.6/lib/uu/os/all_from_organizational_unit_cast.rb', line 134

def exists(organizational_unit_uri, cast)
  svc = UU::OS::REST::RemoteClient.new(AllFromOrganizationalUnitCast)
  dto = UU::OS::AllFromOrganizationalUnitCast::AllFromOrganizationalUnitCastExists.new(cast)
  svc.add_parameter('castedSubjectUri', dto.casted_subject_uri)
  svc.add_parameter('recursive', dto.recursive)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('exists', organizational_unit_uri)
    return (res == 'true') || (res == '"true"')
  end
end

- (AllFromOrganizationalUnitCastAttributes) get_attributes(organizational_unit_uri, cast)

Returns attributes of subject cast into the group All From Organizational Unit which is derived from specified organizational unit.

Parameters:

Options Hash (cast):

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

    UESURI of the subject (role or group) which is casted to the group All From Organizational Unit identified by the command main entity. Cannot be nil.

Returns:



50
51
52
53
54
55
56
57
58
# File 'uu_os_client-0.10.6/lib/uu/os/all_from_organizational_unit_cast.rb', line 50

def get_attributes(organizational_unit_uri, cast)
  svc = UU::OS::REST::RemoteClient.new(AllFromOrganizationalUnitCast)
  get_dto = UU::OS::AllFromOrganizationalUnitCast::AllFromOrganizationalUnitCastGetAttributes.new(cast)
  svc.add_parameter('castedSubjectUri', get_dto.casted_subject_uri)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('getAttributes', organizational_unit_uri)
    return AllFromOrganizationalUnitCast::AllFromOrganizationalUnitCastAttributes.new(res)
  end
end

- (Array) get_cast_list(organizational_unit_uri, criteria = nil)

Returns list of casts accord to the group All From Organizational Unit which is derived from the specified organizational unit and optionally accord to the specified cast level.

Examples:

# Returns list of casts which has executive level
UU::OS::AllFromOrganizationalUnitCast.get_cast_list('ues:TERRITORY:ORGANIZATIONAL_UNIT', :query='level="EXECUTIVE"')

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 the cast level.

Returns:



72
73
74
75
76
77
78
79
80
81
82
# File 'uu_os_client-0.10.6/lib/uu/os/all_from_organizational_unit_cast.rb', line 72

def get_cast_list(organizational_unit_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(AllFromOrganizationalUnitCast)
  dto = AllFromOrganizationalUnitCast::AllFromOrganizationalUnitCastGetCastList.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('getCastList', organizational_unit_uri)
    return UU::OS::REST::ResultList.new(AllFromOrganizationalUnitCast::AllFromOrganizationalUnitCastGetCastList, AllFromOrganizationalUnitCast::AllFromOrganizationalUnitCastAttributes, res)
  end
end

- (Object) set_attributes(organizational_unit_uri, cast = nil)

Sets basic attributes of the subject cast into the All From Organizational Unit which is derived from the specified organizational unit.

Parameters:

Options Hash (cast):

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

    UESURI of the subject (role or group) which is casted to the group All From Organizational Unit identified by the command main entity. Cannot be nil.

  • :level (String)

    The new level of the cast relation. When nil is set the level is not changed. All possible levels can be found as constants in UU::OS::Cast::CastLevel class.

  • :date_to (String)

    The informative field describing the date when the cast should expire. Note that there is no business logic behind this field at the moment, so it serves only as a note. When nil is set, the date is not changed.

  • :state (String)

    The new state of the cast. Only ACTIVE casts are involved in the business rules computations. When nil is set, the state is not changed. All possible states can be found as constants in UU::OS::Cast::CastState class.



93
94
95
96
97
98
99
100
# File 'uu_os_client-0.10.6/lib/uu/os/all_from_organizational_unit_cast.rb', line 93

def set_attributes(organizational_unit_uri, cast = nil)
  svc = UU::OS::REST::RemoteClient.new(AllFromOrganizationalUnitCast)
  payload = UU::OS::AllFromOrganizationalUnitCast::AllFromOrganizationalUnitCastSetAttributes.new(cast).to_json

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