Module: Ddr::Auth::Roles

Extended by:
ActiveSupport::Autoload
Includes:
RoleTypes
Defined in:
lib/ddr/auth/roles.rb,
lib/ddr/auth/roles/role.rb,
lib/ddr/auth/roles/role_type.rb,
lib/ddr/auth/roles/role_types.rb

Defined Under Namespace

Modules: RoleTypes Classes: Role, RoleType

Constant Summary collapse

RESOURCE_SCOPE =
"resource".freeze
POLICY_SCOPE =
"policy".freeze
SCOPES =
[ RESOURCE_SCOPE, POLICY_SCOPE ].freeze
ORDERED_ROLE_TYPES =
[
  CURATOR,
  EDITOR,
  METADATA_EDITOR,
  CONTRIBUTOR,
  DOWNLOADER,
  VIEWER,
  METADATA_VIEWER
]

Constants included from RoleTypes

RoleTypes::CONTRIBUTOR, RoleTypes::CURATOR, RoleTypes::DOWNLOADER, RoleTypes::EDITOR, RoleTypes::METADATA_EDITOR, RoleTypes::METADATA_VIEWER, RoleTypes::VIEWER

Class Method Summary collapse

Class Method Details

.role_typesObject



30
31
32
# File 'lib/ddr/auth/roles.rb', line 30

def role_types
  ORDERED_ROLE_TYPES
end

.titlesObject



34
35
36
# File 'lib/ddr/auth/roles.rb', line 34

def titles
  @titles ||= role_types.map(&:title)
end

.type_mapObject



26
27
28
# File 'lib/ddr/auth/roles.rb', line 26

def type_map
  @type_map ||= role_types.map { |role_type| [role_type.to_s, role_type] }.to_h
end