Sha256: 11861db3a20e69628906f77be7d7d0793e59351c13faad51a79296befed51e1f

Contents?: true

Size: 511 Bytes

Versions: 18

Compression:

Stored size: 511 Bytes

Contents

module Itsf::Backend
  class EnginePolicy < Struct.new(:user, :engine)
    def access?
      permission_identifier = self.class.name.gsub('Policy', '').underscore
      allowed = user.respond_to?(:allowed_to?) ? user.allowed_to?(permission_identifier) : false

      if allowed
        Rails.logger.debug "User #{user} is allowed to access #{permission_identifier}"
      else
        Rails.logger.debug "User #{user} is not allowed to access #{permission_identifier}"
      end
      allowed
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
itsf_backend-2.2.1 app/policies/itsf/backend/engine_policy.rb
itsf_backend-2.2.0 app/policies/itsf/backend/engine_policy.rb
itsf_backend-2.1.0 app/policies/itsf/backend/engine_policy.rb
itsf_backend-2.0.2 app/policies/itsf/backend/engine_policy.rb
itsf_backend-2.0.1 app/policies/itsf/backend/engine_policy.rb
itsf_backend-1.2.8 app/policies/itsf/backend/engine_policy.rb
itsf_backend-1.2.7 app/policies/itsf/backend/engine_policy.rb
itsf_backend-1.2.6 app/policies/itsf/backend/engine_policy.rb
itsf_backend-1.2.5 app/policies/itsf/backend/engine_policy.rb
itsf_backend-1.2.4 app/policies/itsf/backend/engine_policy.rb
itsf_backend-1.2.1 app/policies/itsf/backend/engine_policy.rb
itsf_backend-1.2.0 app/policies/itsf/backend/engine_policy.rb
itsf_backend-1.1.15 app/policies/itsf/backend/engine_policy.rb
itsf_backend-1.1.14 app/policies/itsf/backend/engine_policy.rb
itsf_backend-1.1.13 app/policies/itsf/backend/engine_policy.rb
itsf_backend-1.1.12 app/policies/itsf/backend/engine_policy.rb
itsf_backend-1.1.11 app/policies/itsf/backend/engine_policy.rb
itsf_backend-1.1.10 app/policies/itsf/backend/engine_policy.rb