class Ddr::Auth::Roles::Role

The assignment of a role to an agent within a scope.

Constants

DEFAULT_SCOPE
ValidAgent
ValidRoleType
ValidScope

Public Class Methods

build(args={}) click to toggle source

DEPRECATED: Use constructor

# File lib/ddr/auth/roles/role.rb, line 40
def self.build(args={})
  new(args)
end

Public Instance Methods

==(other) click to toggle source

Roles are considered equal (==) if they are of the same type and have the same agent and scope. @param other [Object] the object of comparison @return [Boolean] the result

# File lib/ddr/auth/roles/role.rb, line 48
def ==(other)
  self.class == other.class &&
    role_type == other.role_type &&
    scope == other.scope &&
    agent == other.agent
end
Also aliased as: eql?
eql?(other)
Alias for: ==
in_policy_scope?() click to toggle source
# File lib/ddr/auth/roles/role.rb, line 61
def in_policy_scope?
  scope == Roles::POLICY_SCOPE
end
in_resource_scope?() click to toggle source
# File lib/ddr/auth/roles/role.rb, line 57
def in_resource_scope?
  scope == Roles::RESOURCE_SCOPE
end
inspect() click to toggle source
# File lib/ddr/auth/roles/role.rb, line 65
def inspect
  "#<#{self.class.name} role_type=#{role_type.inspect}, " \
  "agent=#{agent.inspect}, scope=#{scope.inspect}>"
end
permissions() click to toggle source

Returns the permissions associated with the role @return [Array<Symbol>] the permissions

# File lib/ddr/auth/roles/role.rb, line 72
def permissions
  Roles.type_map[role_type].permissions
end