Sha256: 5e83d6132e6d88049cb8cfeeef7392d51a3ea2292934b9fc66219a4b66d94cfe

Contents?: true

Size: 859 Bytes

Versions: 3

Compression:

Stored size: 859 Bytes

Contents

module Katello
  module Authorization::ActivationKey
    extend ActiveSupport::Concern

    include Authorizable

    def readable?
      authorized?(:view_activation_keys)
    end

    def editable?
      authorized?(:edit_activation_keys)
    end

    def deletable?
      authorized?(:destroy_activation_keys)
    end

    module ClassMethods
      def readable
        authorized(:view_activation_keys)
      end

      def editable
        authorized(:edit_activation_keys)
      end

      def deletable
        authorized(:destroy_activation_keys)
      end

      def any_editable?
        editable.count > 0
      end

      def all_editable?(content_view, environments)
        key_query = ActivationKey.with_content_views(content_view).with_environments(environments)
        key_query.count == key_query.editable.count
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
katello-4.15.0 app/models/katello/authorization/activation_key.rb
katello-4.15.0.rc2 app/models/katello/authorization/activation_key.rb
katello-4.15.0.rc1 app/models/katello/authorization/activation_key.rb