Skip to content

class Athena::Security::Authorization::Voter::Role
inherits Athena::Security::Authorization::Voter #

Votes on attributes starting with a prefix, ROLE_ by default, granting the access if the token has that role.

Included modules

Athena::Security::Authorization::Voter::AttributeOnly

Direct known subclasses

Athena::Security::Authorization::Voter::RoleHierarchy

Constructors#

.new(prefix : String = "ROLE_")#

View source

Methods#

#supports_attribute?(attribute : String) : Bool#

Returns false if this voter never votes on the provided attribute, otherwise true.

The ASEC::Authorization::AccessDecisionManager caches the result, and no longer asks this voter to vote on the attribute when it is false.

View source

#vote(token : ASEC::Authentication::Token::Interface, attribute : String, vote : ASEC::Authorization::Voter::Vote | Nil = nil) : ASEC::Authorization::Voter::Access#

Returns the vote of this voter on whether the provided token is granted the provided attribute.

The vote may be explained by adding reasons to the provided vote.

View source