Class: Parse::ACLScope::Resolution
- Inherits:
-
Struct
- Object
- Struct
- Parse::ACLScope::Resolution
- Defined in:
- lib/parse/acl_scope.rb
Overview
Outcome of resolving a single mongo-direct call's auth kwargs.
Instance Attribute Summary collapse
-
#client ⇒ Parse::Client?
The client whose authorization context produced this resolution.
-
#master_dropped ⇒ Boolean?
truewhen the caller asked formaster: trueinside Parse.without_master_key and the call was downgraded to the public scope. -
#mode ⇒ Symbol
One of
:session,:master,:public. -
#permission_strings ⇒ Array<String>?
The
_rpermallow-set ready to hand to Parse::ACL.read_predicate. -
#session ⇒ Parse::Authorization::Resolved?
The underlying resolved-session struct (carries role-name set),
nilfor:master. -
#strict_role ⇒ Boolean
When
true, downstream predicate construction (see match_stage_for and rewrite_pipeline) suppresses the implicit"*"(public) grant. -
#user_id ⇒ String?
The resolved user_id, or
nilfor:masterand:public.
Instance Method Summary collapse
- #master? ⇒ Boolean
- #master_dropped? ⇒ Boolean
- #public? ⇒ Boolean
- #session? ⇒ Boolean
- #strict_role? ⇒ Boolean
Instance Attribute Details
#client ⇒ Parse::Client?
Returns the client whose authorization context produced this resolution. Carried so a caller about to run the query against a process-global resource can check that the two agree; see MongoDB.verify_client!. Per-client authorization plus a process-global MongoDB connection is safe only when they belong to the same application.
83 84 85 86 87 88 89 90 |
# File 'lib/parse/acl_scope.rb', line 83 Resolution = Struct.new(:mode, :permission_strings, :user_id, :session, :strict_role, :client, :master_dropped, keyword_init: true) do def master?; mode == :master; end def session?; mode == :session; end def public?; mode == :public; end def strict_role?; strict_role == true; end def master_dropped?; master_dropped == true; end end |
#master_dropped ⇒ Boolean?
Returns true when the caller asked for master: true
inside Parse.without_master_key and the call was downgraded to
the public scope. Reported on the parse.mongodb.aggregate
notification so a master-key caller that sees only public rows
inside the block can be diagnosed.
83 84 85 86 87 88 89 90 |
# File 'lib/parse/acl_scope.rb', line 83 Resolution = Struct.new(:mode, :permission_strings, :user_id, :session, :strict_role, :client, :master_dropped, keyword_init: true) do def master?; mode == :master; end def session?; mode == :session; end def public?; mode == :public; end def strict_role?; strict_role == true; end def master_dropped?; master_dropped == true; end end |
#mode ⇒ Symbol
Returns one of :session, :master, :public.
:session means the caller passed a valid session_token:;
:master means the caller passed master: true; :public
means neither was supplied and the path's require_session_token
toggle is off, so the SDK falls through to public-only ACL
semantics.
83 84 85 86 87 88 89 90 |
# File 'lib/parse/acl_scope.rb', line 83 Resolution = Struct.new(:mode, :permission_strings, :user_id, :session, :strict_role, :client, :master_dropped, keyword_init: true) do def master?; mode == :master; end def session?; mode == :session; end def public?; mode == :public; end def strict_role?; strict_role == true; end def master_dropped?; master_dropped == true; end end |
#permission_strings ⇒ Array<String>?
Returns the _rperm allow-set ready to
hand to Parse::ACL.read_predicate. nil for :master —
no injection runs on the master path.
83 84 85 86 87 88 89 90 |
# File 'lib/parse/acl_scope.rb', line 83 Resolution = Struct.new(:mode, :permission_strings, :user_id, :session, :strict_role, :client, :master_dropped, keyword_init: true) do def master?; mode == :master; end def session?; mode == :session; end def public?; mode == :public; end def strict_role?; strict_role == true; end def master_dropped?; master_dropped == true; end end |
#session ⇒ Parse::Authorization::Resolved?
Returns the
underlying resolved-session struct (carries role-name set),
nil for :master.
83 84 85 86 87 88 89 90 |
# File 'lib/parse/acl_scope.rb', line 83 Resolution = Struct.new(:mode, :permission_strings, :user_id, :session, :strict_role, :client, :master_dropped, keyword_init: true) do def master?; mode == :master; end def session?; mode == :session; end def public?; mode == :public; end def strict_role?; strict_role == true; end def master_dropped?; master_dropped == true; end end |
#strict_role ⇒ Boolean
Returns when true, downstream predicate construction
(see Parse::ACLScope.match_stage_for and Parse::ACLScope.rewrite_pipeline) suppresses the
implicit "*" (public) grant. Only meaningful for role-scoped
resolutions where the caller wants to see ONLY rows whose
_rperm explicitly includes one of the resolved role names,
not every public-readable row in the collection. Defaults to
false for backwards compatibility. Note: even with
strict_role: true, rows with NO _rperm field still pass
(Parse-Server treats absent _rperm as public-default); the
knob only suppresses the "*" subscription in the $in set.
83 84 85 86 87 88 89 90 |
# File 'lib/parse/acl_scope.rb', line 83 Resolution = Struct.new(:mode, :permission_strings, :user_id, :session, :strict_role, :client, :master_dropped, keyword_init: true) do def master?; mode == :master; end def session?; mode == :session; end def public?; mode == :public; end def strict_role?; strict_role == true; end def master_dropped?; master_dropped == true; end end |
#user_id ⇒ String?
Returns the resolved user_id, or nil for
:master and :public.
83 84 85 86 87 88 89 90 |
# File 'lib/parse/acl_scope.rb', line 83 Resolution = Struct.new(:mode, :permission_strings, :user_id, :session, :strict_role, :client, :master_dropped, keyword_init: true) do def master?; mode == :master; end def session?; mode == :session; end def public?; mode == :public; end def strict_role?; strict_role == true; end def master_dropped?; master_dropped == true; end end |
Instance Method Details
#master? ⇒ Boolean
85 |
# File 'lib/parse/acl_scope.rb', line 85 def master?; mode == :master; end |
#master_dropped? ⇒ Boolean
89 |
# File 'lib/parse/acl_scope.rb', line 89 def master_dropped?; master_dropped == true; end |
#public? ⇒ Boolean
87 |
# File 'lib/parse/acl_scope.rb', line 87 def public?; mode == :public; end |
#session? ⇒ Boolean
86 |
# File 'lib/parse/acl_scope.rb', line 86 def session?; mode == :session; end |
#strict_role? ⇒ Boolean
88 |
# File 'lib/parse/acl_scope.rb', line 88 def strict_role?; strict_role == true; end |