Module: Shamu::Security::Roles

Extended by:
ActiveSupport::Concern
Included in:
Policy
Defined in:
lib/shamu/security/roles.rb

Overview

Mixin for Policy and Support classes to define security roles including inheritance.

Class Method Summary collapse

Class Method Details

.expand_roles(*roles) ⇒ Array<Symbol>

Expand the given roles to include the roles that they have inherited.



29
30
31
# File 'lib/shamu/security/roles.rb', line 29

def expand_roles( *roles )
  expand_roles_into( roles, [] )
end

.role(name, inherits: nil)

This method returns an undefined value.

Define a named role.



22
23
24
# File 'lib/shamu/security/roles.rb', line 22

def role( name, inherits: nil )
  roles[ name.to_sym ] = { inherits: Array( inherits ) }
end

.role_defined?(role) ⇒ Boolean



35
36
37
# File 'lib/shamu/security/roles.rb', line 35

def role_defined?( role )
  roles.key?( role.to_sym )
end

.rolesHash



12
13
14
# File 'lib/shamu/security/roles.rb', line 12

def roles
  @roles ||= {}
end