Skip to content

class Athena::Security::Authorization::Strategy::Consensus
inherits Reference #

Grants the access if more voters grant it than deny it, ignoring those that abstain.

If as many voters grant as deny the access, the decision is allow_if_equal_granted_denied_decisions. If all voters abstained, the decision is allow_if_all_abstain_decisions.

Included modules

Athena::Security::Authorization::Strategy::Interface

Constructors#

.new(allow_if_all_abstain_decisions : Bool = false, allow_if_equal_granted_denied_decisions : Bool = true)#

View source

Methods#

#decide(results : Iterator(ASEC::Authorization::Voter::Access), access_decision : ASEC::Authorization::AccessDecision | Nil = nil) : Bool#

Returns true if the access is granted based on the provided results, otherwise false.

The results are lazy: each voter only votes once its result is read, so a strategy can stop reading them as soon as its decision is known.

View source

#to_s(io : IO) : Nil#

Writes the name of this strategy to the provided io.

View source