Module: GoodData::Mixin::MdGrantees
- Included in:
- GoodData::MdObject
- Defined in:
- lib/gooddata/mixins/md_grantees.rb
Instance Method Summary collapse
- #change_permission(opts) ⇒ Object
- #grant(opts = {}) ⇒ Object
- #grantees(opts = {}) ⇒ Object
- #revoke(opts = {}) ⇒ Object
Instance Method Details
#change_permission(opts) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/gooddata/mixins/md_grantees.rb', line 24 def (opts) = opts[:permission] member = opts[:member] op = opts[:operation] klasses = [GoodData::Profile, GoodData::UserGroup, GoodData::Membership] fail "Permission has to be set. Current value '#{}'" unless fail 'Member has to be either user or group' unless klasses.any? { |c| member.is_a?(c) } payload = { granteeURIs: { items: [ { aclEntryURI: { permission: , grantee: member.uri } } ] } } client.post(uri + '/grantees/' + op.to_s, payload) end |
#grant(opts = {}) ⇒ Object
16 17 18 |
# File 'lib/gooddata/mixins/md_grantees.rb', line 16 def grant(opts = {}) (opts.merge(operation: :add)) end |
#grantees(opts = {}) ⇒ Object
10 11 12 13 14 |
# File 'lib/gooddata/mixins/md_grantees.rb', line 10 def grantees(opts = {}) = opts[:permission] params = ? { permission: } : {} client.get(uri + '/grantees', params: params) end |
#revoke(opts = {}) ⇒ Object
20 21 22 |
# File 'lib/gooddata/mixins/md_grantees.rb', line 20 def revoke(opts = {}) (opts.merge(operation: :remove)) end |