class

Noir::CanCanAbility

Inherits Reference < Object

What a CanCanCan Ability#initialize(user) grants a caller with no user. The rules are read in order with the if/unless blocks and modifiers around them; a condition is judged for a nil user: if user&.active? never runs, unless user always does, an app setting (Settings.status != "offline") is taken as on, and anything else is unknown. verdict folds the rules that cover an action the way CanCan does (a later rule wins). ponytail: only the class's own file is read, with the helper methods it defines inlined; an ability that includes other modules, merges another ability or calls a method it does not define is unreadable.

Constructors

new(lines : Array(String))
Source

Instance methods

readable?
Source
rules
Source
verdict(action : String, subject : String, instance : Bool = false) : Grant

Yes when a nil user is allowed action on subject, No when every rule that could allow it needs a user, Maybe otherwise. subject is a class (Note) or symbol (:profile) name. instance: CanCan checks a loaded record, not the class. On a class check it ignores a rule's hash/block conditions: a conditioned can allows, a conditioned cannot is skipped. On a record, a can whose conditions read the caller fails for a nil user (and is unknown for a guest object); a conditioned cannot refuses only some records and is skipped. A subject no rule names (:all aside) is one this reader may have derived wrongly: Maybe.

Source

Nested types