Exception: CurrentScope::AccessDenied
- Inherits:
-
StandardError
- Object
- StandardError
- CurrentScope::AccessDenied
- Defined in:
- lib/current_scope.rb
Overview
Raised when the resolver denies an action gated by Guard (or when the management UI is accessed without a full-access role). Carries an optional machine-readable reason, surfaced on the response as X-Current-Scope-Reason by current_scope_denied:
:sod_veto — the record's initiator can't perform an SoD action on it
:no_grant — nothing granted the permission (the default deny)
:model_undeclared — a record-less deny that a scoped grant would have
opened, had the controller declared current_scope_model
to bind it to a type (#50). Fail-closed, with the fix named.
:model_invalid — its sibling: current_scope_model WAS declared but
returned something the shape guard refuses (a String,
an instance, an abstract class — not a concrete AR
class). Same cell, different fix, so a different label.
:impersonation_gate — a mutation while impersonating, which is read-only
:not_full_access — the engine's management UI, which only full_access enters
Every denial in the gem raises this and lands in current_scope_denied, so a denial cannot exist that forgets its reason. (:sod_bypassed is the one audited ALLOW, so it is set by the Guard rather than raised here.)
Instance Attribute Summary collapse
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
Instance Method Summary collapse
-
#initialize(message = nil, reason: nil) ⇒ AccessDenied
constructor
A new instance of AccessDenied.
Constructor Details
#initialize(message = nil, reason: nil) ⇒ AccessDenied
Returns a new instance of AccessDenied.
39 40 41 42 |
# File 'lib/current_scope.rb', line 39 def initialize( = nil, reason: nil) super() @reason = reason end |
Instance Attribute Details
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
37 38 39 |
# File 'lib/current_scope.rb', line 37 def reason @reason end |