Sha256: d1b39d89b34237aac916836a906212c43cb351a70646695329f953676ed0618c
Contents?: true
Size: 759 Bytes
Versions: 1
Compression:
Stored size: 759 Bytes
Contents
module Ddr module Auth module LegacyRoles extend ActiveSupport::Concern LEGACY_ROLES = [:administrator, :editor, :downloader, :contributor] def legacy_downloader_to_resource_roles principals(:downloader).map do |name| agent_type = (name =~ /@/ ? :person : :group) Roles::Role.build(:type=>:downloader, agent_type=>name, :scope=>:resource) end end def principal_has_role?(principal, role) ( principals(role) & Array(principal) ).any? end def principals(role) if LEGACY_ROLES.include?(role) adminMetadata.send(role) else raise ArgumentError, "#{role.inspect} is not a legacy role." end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ddr-models-1.13.2 | lib/ddr/auth/legacy_roles.rb |