lib/proxes/policies/request/stats_policy.rb in proxes-0.3.1 vs lib/proxes/policies/request/stats_policy.rb in proxes-0.3.2
- old
+ new
@@ -2,10 +2,10 @@
module ProxES
class Request
class StatsPolicy < RequestPolicy
class Scope < RequestPolicy::Scope
def resolve
- patterns = ProxES::Permission.where(verb: 'INDEX', role: user.roles).map do |permission|
+ patterns = Permission.where(verb: 'INDEX', role: user.roles).map do |permission|
permission.pattern.gsub(/\{user.(.*)\}/) { |match| user.send(Regexp.last_match[1].to_sym) }
end
filter scope.index, patterns
end
end