Sha256: 5c6c9eb5597abfae85da01cd980842caa4e9bf578d6f1f601dd7db4f9fd16c7f

Contents?: true

Size: 500 Bytes

Versions: 46

Compression:

Stored size: 500 Bytes

Contents

module Itsf::Backend
  class DashboardPolicy < Struct.new(:user, :dashboard)
    def access?
      permission_identifier = self.class.name.gsub('Policy', '').underscore
      allowed = user.respond_to?(:allowed_to?) ? user.allowed_to?(permission_identifier) : true
      if allowed
        Rails.logger.info "Allowed access to #{permission_identifier} for #{user}"
      else
        Rails.logger.info "Denied access to #{permission_identifier} for #{user}"
      end
      allowed
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
itsf_backend-5.0.0.pre app/policies/itsf/backend/dashboard_policy.rb
itsf_backend-4.2.3 app/policies/itsf/backend/dashboard_policy.rb
itsf_backend-4.2.2 app/policies/itsf/backend/dashboard_policy.rb
itsf_backend-4.2.1 app/policies/itsf/backend/dashboard_policy.rb
itsf_backend-4.2.0 app/policies/itsf/backend/dashboard_policy.rb
itsf_backend-4.0.1 app/policies/itsf/backend/dashboard_policy.rb
itsf_backend-4.0.0 app/policies/itsf/backend/dashboard_policy.rb
itsf_backend-3.1.1 app/policies/itsf/backend/dashboard_policy.rb
itsf_backend-3.1.0 app/policies/itsf/backend/dashboard_policy.rb
itsf_backend-3.0.7 app/policies/itsf/backend/dashboard_policy.rb
itsf_backend-3.0.6 app/policies/itsf/backend/dashboard_policy.rb
itsf_backend-3.0.5 app/policies/itsf/backend/dashboard_policy.rb
itsf_backend-3.0.4 app/policies/itsf/backend/dashboard_policy.rb
itsf_backend-3.0.3 app/policies/itsf/backend/dashboard_policy.rb
itsf_backend-3.0.2 app/policies/itsf/backend/dashboard_policy.rb
itsf_backend-3.0.1 app/policies/itsf/backend/dashboard_policy.rb
itsf_backend-3.0.0 app/policies/itsf/backend/dashboard_policy.rb
itsf_backend-2.2.1 app/policies/itsf/backend/dashboard_policy.rb
itsf_backend-2.2.0 app/policies/itsf/backend/dashboard_policy.rb
itsf_backend-2.1.0 app/policies/itsf/backend/dashboard_policy.rb