Sha256: 6f2ac11b9d9a4a04a779d8219f5330e905b2dc3b93a5fdc7a71b5dfe072d2ae9

Contents?: true

Size: 1.07 KB

Versions: 135

Compression:

Stored size: 1.07 KB

Contents

module Katello
  module Authorization::LifecycleEnvironment
    extend ActiveSupport::Concern

    include Authorizable

    def readable?
      authorized?(:view_lifecycle_environments)
    end

    def creatable?
      self.class.creatable?
    end

    def editable?
      authorized?(:edit_lifecycle_environments)
    end

    def deletable?
      authorized?(:destroy_lifecycle_environments)
    end

    def promotable_or_removable?
      authorized?(:promote_or_remove_content_views_to_environments)
    end

    module ClassMethods
      def readable
        authorized(:view_lifecycle_environments)
      end

      def promotable
        authorized(:promote_or_remove_content_views_to_environments)
      end

      def promotable?
        User.current.can?(:promote_or_remove_content_views_to_environments)
      end

      def any_promotable?
        promotable.count > 0
      end

      def creatable?
        ::User.current.can?(:create_lifecycle_environments)
      end

      def content_readable(org)
        readable.where(:organization_id => org)
      end
    end
  end
end

Version data entries

135 entries across 135 versions & 1 rubygems

Version Path
katello-3.17.3 app/models/katello/authorization/lifecycle_environment.rb
katello-3.17.2 app/models/katello/authorization/lifecycle_environment.rb
katello-3.17.1 app/models/katello/authorization/lifecycle_environment.rb
katello-3.16.2 app/models/katello/authorization/lifecycle_environment.rb
katello-3.17.0 app/models/katello/authorization/lifecycle_environment.rb
katello-3.17.0.rc2.2 app/models/katello/authorization/lifecycle_environment.rb
katello-3.17.0.rc2.1 app/models/katello/authorization/lifecycle_environment.rb
katello-3.16.1.2 app/models/katello/authorization/lifecycle_environment.rb
katello-3.16.1.1 app/models/katello/authorization/lifecycle_environment.rb
katello-3.17.0.rc2 app/models/katello/authorization/lifecycle_environment.rb
katello-3.16.1 app/models/katello/authorization/lifecycle_environment.rb
katello-3.17.0.rc1 app/models/katello/authorization/lifecycle_environment.rb
katello-3.16.0 app/models/katello/authorization/lifecycle_environment.rb
katello-3.16.0.rc5.1 app/models/katello/authorization/lifecycle_environment.rb
katello-3.16.0.rc5 app/models/katello/authorization/lifecycle_environment.rb
katello-3.16.0.rc4.1 app/models/katello/authorization/lifecycle_environment.rb
katello-3.15.3.1 app/models/katello/authorization/lifecycle_environment.rb
katello-3.15.3 app/models/katello/authorization/lifecycle_environment.rb
katello-3.16.0.rc4 app/models/katello/authorization/lifecycle_environment.rb
katello-3.16.0.rc3.1 app/models/katello/authorization/lifecycle_environment.rb