Module: Ddr::Auth::Roles
- Extended by:
- ActiveSupport::Autoload
- Defined in:
- lib/ddr/auth/roles.rb,
lib/ddr/auth/roles/role.rb,
lib/ddr/auth/roles/query.rb,
lib/ddr/auth/roles/editor.rb,
lib/ddr/auth/roles/scopes.rb,
lib/ddr/auth/roles/viewer.rb,
lib/ddr/auth/roles/curator.rb,
lib/ddr/auth/roles/role_set.rb,
lib/ddr/auth/roles/downloader.rb,
lib/ddr/auth/roles/contributor.rb,
lib/ddr/auth/roles/metadata_editor.rb
Defined Under Namespace
Modules: Scopes Classes: Contributor, Curator, Downloader, Editor, MetadataEditor, Query, Role, RoleSet, Viewer
Class Method Summary collapse
-
.build_role(args = {}) ⇒ Ddr::Auth::Roles::Role
Builds a new role instance by type and a hash of arguments.
-
.get_role_class(role_type) ⇒ Class
(also: get)
Return the class for a type of role specified as a symbol or string.
-
.get_scope_term(scope) ⇒ RDF::Vocabulary::Term
Return the RDF term for the scope.
Class Method Details
.build_role(args = {}) ⇒ Ddr::Auth::Roles::Role
Builds a new role instance by type and a hash of arguments
39 40 41 42 |
# File 'lib/ddr/auth/roles.rb', line 39 def build_role(args={}) role_type = args.delete(:type) get_role_class(role_type).build(args) end |
.get_role_class(role_type) ⇒ Class Also known as: get
Return the class for a type of role specified as a symbol or string
25 26 27 28 29 30 31 |
# File 'lib/ddr/auth/roles.rb', line 25 def get_role_class(role_type) role_class = const_get(role_type.to_s.camelize) unless role_class < Role raise ArgumentError, "#{role_type.inspect} is not a valid role type." end role_class end |