Class: Parse::AtlasSearch::Session::Resolved
- Inherits:
-
Struct
- Object
- Struct
- Parse::AtlasSearch::Session::Resolved
- Defined in:
- lib/parse/atlas_search/session.rb
Overview
Value returned by resolve. +user_id+ is the +_User.objectId+ owning the session, or +nil+ for an anonymous caller. +role_names+ is a +Set+ of role names (no +role:+ prefix) the user inherits permissions from, computed via Role.all_for_user.
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
+true+ for the anonymous-session case.
-
#permission_strings ⇒ Array<String>
Build the canonical +_rperm+/+_wperm+ permission-string set for this session.
Instance Attribute Details
#role_names ⇒ Object
Returns the value of attribute role_names
105 106 107 |
# File 'lib/parse/atlas_search/session.rb', line 105 def role_names @role_names end |
#user_id ⇒ Object
Returns the value of attribute user_id
105 106 107 |
# File 'lib/parse/atlas_search/session.rb', line 105 def user_id @user_id end |
Instance Method Details
#anonymous? ⇒ Boolean
Returns +true+ for the anonymous-session case.
119 120 121 |
# File 'lib/parse/atlas_search/session.rb', line 119 def anonymous? user_id.nil? || user_id.empty? end |
#permission_strings ⇒ Array<String>
Build the canonical +_rperm+/+_wperm+ permission-string set for this session. Always includes +"*"+ (public). Includes +user_id+ when present. Includes +"role:#name"+ for each inherited role.
111 112 113 114 115 116 |
# File 'lib/parse/atlas_search/session.rb', line 111 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 |