Skip to content

Commit

Permalink
Make AK fail if its multiple cve
Browse files Browse the repository at this point in the history
  • Loading branch information
parthaa committed Sep 11, 2024
1 parent 695190d commit c16d6b5
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,11 @@ def find_activation_keys
activation_key = organization.activation_keys.find_by(:name => ak_name)
fail HttpErrors::NotFound, _("Couldn't find activation key '%s'") % ak_name unless activation_key

if activation_key.multi_content_view_environment? && !Setting['allow_multiple_content_views']
fail HttpErrors::BadRequest, _("Activation key '%s' is associated to multiple environments"\
" and registering to multiple environments is not enabled.") % ak_name
end

if !activation_key.unlimited_hosts && activation_key.usage_count >= activation_key.max_hosts
fail Errors::MaxHostsReachedException, _("Max Hosts (%{limit}) reached for activation key '%{name}'") %
{ :limit => activation_key.max_hosts, :name => activation_key.name }
Expand Down

0 comments on commit c16d6b5

Please sign in to comment.