Class: Ddr::Auth::Roles::Role
- Inherits:
-
Valkyrie::Resource
- Object
- Valkyrie::Resource
- Ddr::Auth::Roles::Role
- Defined in:
- lib/ddr/auth/roles/role.rb
Overview
The assignment of a role to an agent within a scope.
Constant Summary collapse
- DEFAULT_SCOPE =
Roles::RESOURCE_SCOPE
- ValidScope =
Valkyrie::Types::Coercible::String.default(DEFAULT_SCOPE).enum(*(Roles::SCOPES))
- ValidRoleType =
Valkyrie::Types::Strict::String.enum(*(Roles.titles))
- ValidAgent =
Valkyrie::Types::Coercible::String.constrained(min_size: 1)
Class Method Summary collapse
-
.build(args = {}) ⇒ Object
DEPRECATED: Use constructor.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
(also: #eql?)
Roles are considered equal (==) if they are of the same type and have the same agent and scope.
- #in_policy_scope? ⇒ Boolean
- #in_resource_scope? ⇒ Boolean
- #inspect ⇒ Object
-
#permissions ⇒ Array<Symbol>
Returns the permissions associated with the role.
Class Method Details
.build(args = {}) ⇒ Object
DEPRECATED: Use constructor
40 41 42 |
# File 'lib/ddr/auth/roles/role.rb', line 40 def self.build(args={}) new(args) end |
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
Roles are considered equal (==) if they are of the same type and have the same agent and scope.
48 49 50 51 52 53 |
# 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 |
#in_policy_scope? ⇒ Boolean
61 62 63 |
# File 'lib/ddr/auth/roles/role.rb', line 61 def in_policy_scope? scope == Roles::POLICY_SCOPE end |
#in_resource_scope? ⇒ Boolean
57 58 59 |
# File 'lib/ddr/auth/roles/role.rb', line 57 def in_resource_scope? scope == Roles::RESOURCE_SCOPE end |
#inspect ⇒ Object
65 66 67 68 |
# 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 |