Class: Duracloud::SpaceAcls
Constant Summary
collapse
- READ =
"READ".freeze
- WRITE =
"WRITE".freeze
- ACL_PREFIX =
(PREFIX + "acl-").freeze
Constants inherited
from Properties
Properties::PREFIX
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Properties
#convert_value, #property?, property?
Constructor Details
#initialize(space) ⇒ SpaceAcls
Returns a new instance of SpaceAcls.
11
12
13
14
15
16
17
18
19
|
# File 'lib/duracloud/space_acls.rb', line 11
def initialize(space)
@space = space
if space.persisted?
response = Client.get_space_acls(space.space_id, **query)
super(response.)
else
super()
end
end
|
Instance Attribute Details
#space ⇒ Object
Returns the value of attribute space.
9
10
11
|
# File 'lib/duracloud/space_acls.rb', line 9
def space
@space
end
|
Instance Method Details
#grant(perm, to) ⇒ Object
31
32
33
34
|
# File 'lib/duracloud/space_acls.rb', line 31
def grant(perm, to)
prop = ACL_PREFIX + to
self[prop] = perm
end
|
#grant_read(to) ⇒ Object
40
41
42
|
# File 'lib/duracloud/space_acls.rb', line 40
def grant_read(to)
grant READ, to
end
|
#grant_write(to) ⇒ Object
36
37
38
|
# File 'lib/duracloud/space_acls.rb', line 36
def grant_write(to)
grant WRITE, to
end
|
#query ⇒ Object
21
22
23
|
# File 'lib/duracloud/space_acls.rb', line 21
def query
{ storeID: space.store_id }
end
|
#revoke(from) ⇒ Object
44
45
46
47
|
# File 'lib/duracloud/space_acls.rb', line 44
def revoke(from)
prop = ACL_PREFIX + from
delete prop
end
|
#show ⇒ Object
25
26
27
28
29
|
# File 'lib/duracloud/space_acls.rb', line 25
def show
each_with_object({}) do |(k, v), memo|
memo[k.sub(ACL_PREFIX, "")] = v
end
end
|