Class: Bizside::Acl::AccessControlUtils
- Inherits:
-
Object
- Object
- Bizside::Acl::AccessControlUtils
- Defined in:
- lib/bizside/acl/access_control_utils.rb
Overview
アクセス制御のユーティリティクラス
Constant Summary collapse
- @@access_control =
nil
Class Method Summary collapse
- .get_access_control(roll_key) ⇒ Object
- .init(reload = false) ⇒ Object
- .merge(filename) ⇒ Object
- .role_keys ⇒ Object
Class Method Details
.get_access_control(roll_key) ⇒ Object
32 33 34 |
# File 'lib/bizside/acl/access_control_utils.rb', line 32 def self.get_access_control(roll_key) @@access_control[roll_key] end |
.init(reload = false) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/bizside/acl/access_control_utils.rb', line 6 def self.init(reload = false) if reload or @@access_control.nil? @@access_control = {} config_files = Bizside.config.acl.config_files? ? Bizside.config.acl.config_files : ['config/acl.yml'] config_files.each do |config| merge(config) end end end |
.merge(filename) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/bizside/acl/access_control_utils.rb', line 16 def self.merge(filename) yml = YAML.load_file(filename) yml.each do |roll_key, values| @@access_control[roll_key] ||= {} @@access_control[roll_key].merge!(values) end end |