Module: Sequel::Privacy::BuiltInPolicies
- Defined in:
- lib/sequel/privacy/built_in_policies.rb
Overview
Built-in policies that ship with the gem. Applications should define their own policies using PolicyDSL.
Constant Summary collapse
- AlwaysDeny =
Always deny access. Should be the last policy in every chain (fail-secure).
Policy.create( :AlwaysDeny, -> { :deny }, 'In the absence of other rules, this content is hidden.', cacheable: true )
- AlwaysAllow =
Always allow access. Use sparingly.
Policy.create( :AlwaysAllow, -> { :allow }, 'Always allow access.', cacheable: true )
- PassAndLog =
Pass and log - useful for debugging policy chains.
Policy.create( :PassAndLog, ->(subject, actor) { Sequel::Privacy::Enforcer.logger&.info("PassAndLog: #{subject.class} for actor #{actor.id}") :pass }, 'Log and pass to next policy.', cacheable: false )