grant [permission], to: [grantees] -> result
permission - Symbol (required) - one of [:discover|:read|:edit]
to - one of:
:all
- Grants permission to all (i.e., group: "public"):public
- Grants permission to "public" group:registered
- Grants permission to "registered" group- a Hash including:
:person
- Individual name (String) or an Array of individual names:group
- Group name (String) or an Array of group names
Boolean - success/failure
revoke [permission], from: [revokees] -> result
permission - Symbol (required) - one of [:discover|:read|:edit|:all]
. Use :all
to revoke all permissions from the Person(s) and/or groups(s).
from - one of:
:all
- Revokes permission from all (persons and groups) to whom it is assigned.revoke :all, from: :all
is equivalent to clearing permissions on the object.:public
- Revokes permission from "public" group:registered
- Revokes permission from "registered" group- a Hash including:
:person
- Revokes permission from an individual (String) or list of individuals (Array):group
- Revokes permission from a group (String) or list of groups (Array)
Boolean - success/failure
object.permissions.grant :read, to: {person: '[email protected]'}
=> true
# Equivalent to:
# object.permissions = [{type: "person", name: "[email protected]", access: "read"}]
object.permissions.grant :read, to: :public
=> true
# object.permissions = [{type: "group", name: "public", access: "read"}]
# person '[email protected]' has edit permission
object.permissions.revoke :edit, from: {person: '[email protected]'}
=> true
# Equivalent to (one way to do it):
# object.set_edit_users(object.edit_users - ['[email protected]'], ['[email protected]'])
# person '[email protected]' lacks edit permission
object.permissions.revoke :edit, from: {person: '[email protected]'}
=> false
object.permissions.revoke :all, from: :all
=> true
# Equivalent to:
# object.rightsMetadata.clear_permissions!
# Etc.
- Should result be false on revoke if entity lacks permission specified?
- Should result be false on grant if entity already (effectively) has permission?
Re: including message in return value, I was thinking about UI.
Re: :replace, I think we can drop it.