Sha256: e3e3812eedde5ee8b7d2ea8122a50bd05d0a7dc2090aaff36be194811e34fdfe

Contents?: true

Size: 601 Bytes

Versions: 2

Compression:

Stored size: 601 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

2 entries across 2 versions & 1 rubygems

Version Path
proxes-0.4.0 lib/proxes/policies/audit_log_policy.rb
proxes-0.3.6 lib/proxes/policies/audit_log_policy.rb