diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
commit | db384e6b19af03b4c3c82a5760d83a3fd79f7982 (patch) | |
tree | 34beaef37df5f47ccbcf5729d7583aae093cffa0 /app/graphql/mutations/namespace/package_settings | |
parent | 54fd7b1bad233e3944434da91d257fa7f63c3996 (diff) |
Add latest changes from gitlab-org/gitlab@16-3-stable-eev16.3.0-rc42
Diffstat (limited to 'app/graphql/mutations/namespace/package_settings')
-rw-r--r-- | app/graphql/mutations/namespace/package_settings/update.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/graphql/mutations/namespace/package_settings/update.rb b/app/graphql/mutations/namespace/package_settings/update.rb index 96bee693a1e..4e71bed52c6 100644 --- a/app/graphql/mutations/namespace/package_settings/update.rb +++ b/app/graphql/mutations/namespace/package_settings/update.rb @@ -8,6 +8,8 @@ module Mutations include Mutations::ResolvesNamespace + NUGET_DUPLICATES_FF_ERROR = '`nuget_duplicates_option` feature flag is disabled.' + description <<~DESC These settings can be adjusted by the group Owner or Maintainer. [Issue 370471](https://gitlab.com/gitlab-org/gitlab/-/issues/370471) proposes limiting @@ -41,6 +43,16 @@ module Mutations required: false, description: copy_field_description(Types::Namespace::PackageSettingsType, :generic_duplicate_exception_regex) + argument :nuget_duplicates_allowed, + GraphQL::Types::Boolean, + required: false, + description: copy_field_description(Types::Namespace::PackageSettingsType, :nuget_duplicates_allowed) + + argument :nuget_duplicate_exception_regex, + Types::UntrustedRegexp, + required: false, + description: copy_field_description(Types::Namespace::PackageSettingsType, :nuget_duplicate_exception_regex) + argument :maven_package_requests_forwarding, GraphQL::Types::Boolean, required: false, @@ -79,6 +91,10 @@ module Mutations def resolve(namespace_path:, **args) namespace = authorized_find!(namespace_path: namespace_path) + if nuget_duplicate_settings_present?(args) && Feature.disabled?(:nuget_duplicates_option, namespace) + raise_resource_not_available_error! NUGET_DUPLICATES_FF_ERROR + end + result = ::Namespaces::PackageSettings::UpdateService .new(container: namespace, current_user: current_user, params: args) .execute @@ -94,6 +110,10 @@ module Mutations def find_object(namespace_path:) resolve_namespace(full_path: namespace_path) end + + def nuget_duplicate_settings_present?(args) + args.key?(:nuget_duplicates_allowed) || args.key?(:nuget_duplicate_exception_regex) + end end end end |