Sha256: 7494748a2f03338738d848d16f606f7e811012325a7c3e1e6d51f0dadf7fbe46

Contents?: true

Size: 432 Bytes

Versions: 6

Compression:

Stored size: 432 Bytes

Contents

# frozen_string_literal: true

module ProxES
  class Request
    class CatPolicy < RequestPolicy
      class Scope < RequestPolicy::Scope
        def resolve
          patterns = Permission.for_user(user, 'INDEX').map do |permission|
            permission.pattern.gsub(/\{user.(.*)\}/) { |_match| user.send(Regexp.last_match[1].to_sym) }
          end
          filter scope.index, patterns
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
proxes-0.6.1 lib/proxes/policies/request/cat_policy.rb
proxes-0.6.0 lib/proxes/policies/request/cat_policy.rb
proxes-0.5.2 lib/proxes/policies/request/cat_policy.rb
proxes-0.5.1 lib/proxes/policies/request/cat_policy.rb
proxes-0.5.0 lib/proxes/policies/request/cat_policy.rb
proxes-0.4.4 lib/proxes/policies/request/cat_policy.rb