Method: Checkpoint::Credential::Resolver#expand

Defined in:
lib/checkpoint/credential/resolver.rb

#expand(action) ⇒ Array<Credential>

Expand an action into all Checkpoint::Credentials that would permit it.

Expansion first converts the action to a Credential, and then calls #granted_by on it.

Note that the parameter name is action, though it can accept a Credential. This is to promote the most common and recommended model: authorizing based on named application actions. However, the polymorphic and hierarchical nature of credentials means that there can be cases where expanding something like a Checkpoint::Credential::Role is intentional. As an example, an administrative interface for managing roles granted to users might need to expand the roles to show inheritance, rather than checking whether a given user would be permitted to take some action.

Parameters:

  • action (String|Symbol|Credential)

    the action name or Credential to expand

Returns:

  • (Array<Credential>)

    the set of Credentials, any of which would allow the action



63
64
65
# File 'lib/checkpoint/credential/resolver.rb', line 63

def expand(action)
  convert(action).granted_by
end