Sha256: 3983d94c33c59607f16057927f359058b2b9ae734e4cea521ce86c7672c6ef69

Contents?: true

Size: 1.09 KB

Versions: 22

Compression:

Stored size: 1.09 KB

Contents

module Katello
  module Authorization::System
    extend ActiveSupport::Concern

    include Authorizable

    def readable?
      authorized?(:view_content_hosts)
    end

    def editable?
      authorized?(:edit_content_hosts)
    end

    def deletable?
      authorized?(:destroy_content_hosts)
    end

    module ClassMethods
      def readable_search_filters(_org)
        {:or => [
          {:terms => {:environment_id => KTEnvironment.readable.pluck(:id) }}
        ]
        }
      end

      def readable
        authorized(:view_content_hosts)
      end

      def readable?
        User.current.can?(:view_content_hosts)
      end

      def editable
        authorized(:edit_content_hosts)
      end

      def deletable
        authorized(:destroy_content_hosts)
      end

      def any_editable?
        authorized(:edit_content_hosts).count > 0
      end

      def all_editable?(content_view, environments)
        systems_query = System.where(:content_view_id => content_view, :environment_id => environments)
        systems_query.count == systems_query.editable.count
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
katello-3.1.0.1 app/models/katello/authorization/system.rb
katello-3.1.0 app/models/katello/authorization/system.rb
katello-3.1.0.rc2.1 app/models/katello/authorization/system.rb
katello-3.0.2 app/models/katello/authorization/system.rb
katello-2.4.5 app/models/katello/authorization/system.rb
katello-3.1.0.rc1 app/models/katello/authorization/system.rb
katello-3.0.1 app/models/katello/authorization/system.rb
katello-2.4.4 app/models/katello/authorization/system.rb
katello-3.0.0 app/models/katello/authorization/system.rb
katello-2.4.3 app/models/katello/authorization/system.rb
katello-3.0.0.rc7 app/models/katello/authorization/system.rb
katello-3.0.0.rc5 app/models/katello/authorization/system.rb
katello-2.4.2 app/models/katello/authorization/system.rb
katello-3.0.0.rc4 app/models/katello/authorization/system.rb
katello-3.0.0.rc3 app/models/katello/authorization/system.rb
katello-3.0.0.rc2 app/models/katello/authorization/system.rb
katello-3.0.0.rc1 app/models/katello/authorization/system.rb
katello-2.4.1 app/models/katello/authorization/system.rb
katello-2.4.0 app/models/katello/authorization/system.rb
katello-2.4.0.rc3 app/models/katello/authorization/system.rb