-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #36753 - Only allow coherent default CVE
in global registration form - remove 'Lifecycle Environment' field from global registration form - add Rails validator preventing content view environments from using a non-default lifecycle environment with the Default Organization View
- Loading branch information
1 parent
9d03ca6
commit 21dc7a8
Showing
6 changed files
with
45 additions
and
109 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
app/lib/katello/validators/content_view_environment_coherent_default_validator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module Katello | ||
module Validators | ||
# ensures that the Default Organization View content view can only be used with the Library environment | ||
class ContentViewEnvironmentCoherentDefaultValidator < ActiveModel::Validator | ||
def validate(record) | ||
#support lifecycle_environment_id for foreman models | ||
environment_id = record.respond_to?(:lifecycle_environment_id) ? record.lifecycle_environment_id : record.environment_id | ||
if record.content_view_id | ||
view = ContentView.where(:id => record.content_view_id).first | ||
if environment_id | ||
env = KTEnvironment.where(:id => environment_id).first | ||
return if view.blank? || env.blank? | ||
if view.default? && !env.library? | ||
record.errors[:base] << _("Lifecycle environment '%{env}' cannot be used with content view '%{view}'") % | ||
{:view => view.name, :env => env.name} | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
1 change: 1 addition & 0 deletions
1
app/lib/katello/validators/content_view_environment_validator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
webpack/components/extensions/RegistrationCommands/__tests__/LifeCycleEnvironment.test.js
This file was deleted.
Oops, something went wrong.
57 changes: 0 additions & 57 deletions
57
webpack/components/extensions/RegistrationCommands/fields/LifecycleEnvironment.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters