Module: EasyRoleRequirementSystem::ClassMethods
- Defined in:
- lib/easy_role_requirement_system.rb
Instance Method Summary collapse
-
#enforce_permissions ⇒ Object
calls RoleRequirementSystem::require_role for every permission set in the config file for the current controller.
- #has_role_requirements? ⇒ Boolean
- #role_permissions_file_path ⇒ Object
Instance Method Details
#enforce_permissions ⇒ Object
calls RoleRequirementSystem::require_role for every permission set in the config file for the current controller
61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/easy_role_requirement_system.rb', line 61 def .each do || all_parameters = [] .each do |p| check_format(p) parameter = {} parameter[:roles] = add_roles(p) parameter[:options] = ((p[:options]) if p[:options]) || {} all_parameters << parameter end all_parameters.each{|param| self.require_role(param[:roles], param[:options]) \ if param[:roles]} end end |
#has_role_requirements? ⇒ Boolean
55 56 57 |
# File 'lib/easy_role_requirement_system.rb', line 55 def has_role_requirements? self.role_requirements && self.role_requirements != [] ? true : false end |
#role_permissions_file_path ⇒ Object
51 52 53 |
# File 'lib/easy_role_requirement_system.rb', line 51 def @role_permissions_file_path ||= "#{RAILS_ROOT}/config/spree_permissions.yml" end |