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.13.2 app/models/katello/authorization/lifecycle_environment.rb
katello-3.14.0.rc1 app/models/katello/authorization/lifecycle_environment.rb
katello-3.13.1 app/models/katello/authorization/lifecycle_environment.rb
katello-3.13.0 app/models/katello/authorization/lifecycle_environment.rb
katello-3.13.0.rc2.1 app/models/katello/authorization/lifecycle_environment.rb
katello-3.13.0.rc2 app/models/katello/authorization/lifecycle_environment.rb
katello-3.12.3 app/models/katello/authorization/lifecycle_environment.rb
katello-3.12.2 app/models/katello/authorization/lifecycle_environment.rb
katello-3.13.0.rc1 app/models/katello/authorization/lifecycle_environment.rb
katello-3.12.1 app/models/katello/authorization/lifecycle_environment.rb
katello-3.11.2 app/models/katello/authorization/lifecycle_environment.rb
katello-3.10.2 app/models/katello/authorization/lifecycle_environment.rb
katello-3.12.0 app/models/katello/authorization/lifecycle_environment.rb
katello-3.12.0.rc2 app/models/katello/authorization/lifecycle_environment.rb
katello-3.10.1.1 app/models/katello/authorization/lifecycle_environment.rb
katello-3.12.0.rc1 app/models/katello/authorization/lifecycle_environment.rb
katello-3.10.1 app/models/katello/authorization/lifecycle_environment.rb
katello-3.11.1 app/models/katello/authorization/lifecycle_environment.rb
katello-3.11.0 app/models/katello/authorization/lifecycle_environment.rb
katello-3.11.0.rc2 app/models/katello/authorization/lifecycle_environment.rb