Sha256: 7815067631e90966d4d0417eb4091195e9318a5ab66350c01ef9a365a9fabab0
Contents?: true
Size: 645 Bytes
Versions: 1
Compression:
Stored size: 645 Bytes
Contents
require 'yaml' module Hydra::RoleMapperBehavior extend ActiveSupport::Concern module ClassMethods def role_names map.keys end def roles(username) byname[username]||[] end def whois(r) map[r]||[] end def map @map ||= YAML.load(File.open(File.join(Rails.root, "config/role_map_#{Rails.env}.yml"))) end def byname return @byname if @byname m = Hash.new{|h,k| h[k]=[]} @byname = map.inject(m) do|memo, (role,usernames)| ((usernames if usernames.respond_to?(:each)) || [usernames]).each { |x| memo[x]<<role} memo end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hydra-head-4.0.0 | app/models/hydra/role_mapper_behavior.rb |