Sha256: 2311d1397ecf81c9b37023c79ee267b0ef43bec7cc5e296461035ceea6f5ff1d

Contents?: true

Size: 563 Bytes

Versions: 87

Compression:

Stored size: 563 Bytes

Contents

module Pageflow
  module Admin
    class EntryTabPolicy
      attr_reader :user, :tab, :query

      def initialize(user, tab)
        @user = user
        @tab = tab
        @query = EntryRoleQuery.new(user, tab.resource)
      end

      def see?
        if user.admin?
          true
        elsif tab.required_account_role
          query.has_at_least_account_role?(tab.required_account_role)
        elsif tab.required_role
          query.has_at_least_role?(tab.required_role)
        else
          !tab.admin_only?
        end
      end
    end
  end
end

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
pageflow-17.0.4 app/policies/pageflow/admin/entry_tab_policy.rb
pageflow-17.0.3 app/policies/pageflow/admin/entry_tab_policy.rb
pageflow-17.0.2 app/policies/pageflow/admin/entry_tab_policy.rb
pageflow-17.0.1 app/policies/pageflow/admin/entry_tab_policy.rb
pageflow-17.0.0 app/policies/pageflow/admin/entry_tab_policy.rb
pageflow-16.2.0 app/policies/pageflow/admin/entry_tab_policy.rb
pageflow-16.1.0 app/policies/pageflow/admin/entry_tab_policy.rb
pageflow-16.0.0 app/policies/pageflow/admin/entry_tab_policy.rb
pageflow-15.8.0 app/policies/pageflow/admin/entry_tab_policy.rb
pageflow-14.5.2 app/policies/pageflow/admin/entry_tab_policy.rb
pageflow-15.7.1 app/policies/pageflow/admin/entry_tab_policy.rb
pageflow-15.7.0 app/policies/pageflow/admin/entry_tab_policy.rb
pageflow-15.6.1 app/policies/pageflow/admin/entry_tab_policy.rb
pageflow-15.6.0 app/policies/pageflow/admin/entry_tab_policy.rb
pageflow-15.5.0 app/policies/pageflow/admin/entry_tab_policy.rb
pageflow-15.4.0 app/policies/pageflow/admin/entry_tab_policy.rb
pageflow-15.3.0 app/policies/pageflow/admin/entry_tab_policy.rb
pageflow-15.2.2 app/policies/pageflow/admin/entry_tab_policy.rb
pageflow-15.2.1 app/policies/pageflow/admin/entry_tab_policy.rb
pageflow-15.2.0 app/policies/pageflow/admin/entry_tab_policy.rb