Skip to content

class Athena::Security::Authorization::Checker
inherits Reference #

Checks whether the user of the token held by an ASEC::Authentication::Token::Storage::Interface is granted an attribute, via an ASEC::Authorization::AccessDecisionManager.

Decides for an ASEC::Authentication::Token::Null if there is no token, or its token has no user.

checker = ASEC::Authorization::Checker.new token_storage, access_decision_manager

checker.granted? "ROLE_ADMIN"
checker.granted? "EDIT", post

Included modules

Athena::Security::Authorization::CheckerInterface

Constructors#

Methods#

#granted?(attribute : String, subject = nil, access_decision : ASEC::Authorization::AccessDecision | Nil = nil) : Bool#

Returns true if the current user is granted the provided attribute, optionally on the provided subject, otherwise false.

The decision and the votes it was based on are stored in the provided access_decision, if any.

View source