lib/proxes/policies/request/index_policy.rb in proxes-0.9.2 vs lib/proxes/policies/request/index_policy.rb in proxes-0.9.4

- old
+ new

@@ -7,16 +7,10 @@ module ProxES class Request class IndexPolicy < RequestPolicy class Scope < RequestPolicy::Scope def resolve - return [] if user.nil? - patterns = Permission.for_user(user, 'INDEX').map do |permission| - permission.pattern.gsub(/\{user.(.*)\}/) do |_match| - user.send(Regexp.last_match[1].to_sym) - end - end - result = filter(request.index, patterns) + result = super return [] unless result.count > 0 %w[POST PUT].include?(request.request_method) ? request.index : result end end end