Class: ProxES::Request::BulkPolicy
- Inherits:
-
ProxES::RequestPolicy
- Object
- ProxES::RequestPolicy
- ProxES::Request::BulkPolicy
- Defined in:
- lib/proxes/policies/request/bulk_policy.rb
Defined Under Namespace
Classes: Scope
Instance Attribute Summary
Attributes inherited from ProxES::RequestPolicy
Instance Method Summary collapse
Methods inherited from ProxES::RequestPolicy
#action_allowed?, #index_allowed?, #initialize, #logger, #method_missing, #patterns_for, #respond_to_missing?
Methods included from Helpers::Indices
Constructor Details
This class inherits a constructor from ProxES::RequestPolicy
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ProxES::RequestPolicy
Instance Method Details
#post? ⇒ Boolean
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/proxes/policies/request/bulk_policy.rb', line 8 def post? return false if user.nil? patterns = Permission.for_user(user, 'INDEX').map do || .pattern.gsub(/\{user.(.*)\}/) { |_match| user.send(Regexp.last_match[1].to_sym) } end return false if request.index && !index_allowed? return false if request.bulk_indices == '' || patterns.empty? patterns.find do |pattern| request.bulk_indices.find { |idx| idx !~ /#{pattern}/ } end.nil? end |