Class: Parse::Authorization::Resolved
- Inherits:
-
Struct
- Object
- Struct
- Parse::Authorization::Resolved
- Defined in:
- lib/parse/authorization.rb
Overview
The outcome of resolving a caller. user_id is the _User.objectId
owning the session, or nil for an anonymous caller. role_names is a
Set of bare role names (no role: prefix) the user inherits
permissions from.
Instance Attribute Summary collapse
-
#role_names ⇒ Object
Returns the value of attribute role_names.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
Instance Method Summary collapse
-
#anonymous? ⇒ Boolean
truefor the anonymous case. -
#permission_strings ⇒ Array<String>
The canonical
_rperm/_wpermpermission-string set for this caller.
Instance Attribute Details
#role_names ⇒ Object
Returns the value of attribute role_names
110 111 112 |
# File 'lib/parse/authorization.rb', line 110 def role_names @role_names end |
#user_id ⇒ Object
Returns the value of attribute user_id
110 111 112 |
# File 'lib/parse/authorization.rb', line 110 def user_id @user_id end |
Instance Method Details
#anonymous? ⇒ Boolean
Returns true for the anonymous case.
123 124 125 |
# File 'lib/parse/authorization.rb', line 123 def anonymous? user_id.nil? || user_id.empty? end |
#permission_strings ⇒ Array<String>
The canonical _rperm / _wperm permission-string set for this
caller. Always includes "*". Includes user_id when present, and
"role:#{name}" for each inherited role.
115 116 117 118 119 120 |
# File 'lib/parse/authorization.rb', line 115 def out = ["*"] out << user_id if user_id && !user_id.empty? role_names.each { |name| out << "role:#{name}" if name && !name.empty? } out.uniq end |