Module: BreakDance::SecurityPolicyAdditions
- Defined in:
- lib/break_dance/security_policy_additions.rb
Instance Method Summary collapse
Instance Method Details
#policy(name) ⇒ Object
3 4 5 6 |
# File 'lib/break_dance/security_policy_additions.rb', line 3 def policy(name) @policy_name = name yield end |
#resource(key, resource) ⇒ Object
15 16 17 |
# File 'lib/break_dance/security_policy_additions.rb', line 15 def resource(key, resource) RequestStore.store[:security_policy_holder].resources[key] = resource end |
#scope(model) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/break_dance/security_policy_additions.rb', line 8 def scope(model) model_name = model.name if @user and @user. and @user.['models'] and @user.['models'].has_key? model_name and @user.['models'][model_name] == @policy_name RequestStore.store[:security_policy_holder].policies[model.name] = yield(model.unscoped) end end |