16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/postpolicy/config.rb', line 16
def self.load( config_hash )
acls = Hash.new { |hsh, key| hsh[key] = Array.new }
config_acls = config_hash.delete( "acl" )
config_acls.each_pair do |human_name, klass_value_maps|
klass_value_maps.each_pair do |klass, value|
acls[human_name] << ACL.const_get(klass.classify).new( resolve_datasource( value ) )
end
end
actions = config_hash.delete( "action" )
accesses = config_hash.delete( "access" )
accesses.each_pair do |action, acl|
AccessManager << Access.new( acls[acl], actions[action] )
end
Db.load( config_hash["database"] )
end
|