Sha256: e0780206d5c227a7fc6d8b2d97b90fa3655ce674c48f93212447c35cfbe49918

Contents?: true

Size: 602 Bytes

Versions: 11

Compression:

Stored size: 602 Bytes

Contents

# frozen_string_literal: true

require 'proxes/policies/application_policy'

module ProxES
  class AuditLogPolicy < ApplicationPolicy
    def create?
      user && user.super_admin?
    end

    def list?
      create?
    end

    def read?
      create?
    end

    def update?
      read?
    end

    def delete?
      create?
    end

    def permitted_attributes
      [:action, :details]
    end

    class Scope < ApplicationPolicy::Scope
      def resolve
        if user && user.super_admin?
          scope
        else
          scope.where(id: -1)
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
proxes-0.7.1 lib/proxes/policies/audit_log_policy.rb
proxes-0.7.0 lib/proxes/policies/audit_log_policy.rb
proxes-0.6.1 lib/proxes/policies/audit_log_policy.rb
proxes-0.6.0 lib/proxes/policies/audit_log_policy.rb
proxes-0.5.2 lib/proxes/policies/audit_log_policy.rb
proxes-0.5.1 lib/proxes/policies/audit_log_policy.rb
proxes-0.5.0 lib/proxes/policies/audit_log_policy.rb
proxes-0.4.4 lib/proxes/policies/audit_log_policy.rb
proxes-0.4.3 lib/proxes/policies/audit_log_policy.rb
proxes-0.4.2 lib/proxes/policies/audit_log_policy.rb
proxes-0.4.1 lib/proxes/policies/audit_log_policy.rb