Commit 46b0e4a2 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch 'if-10137-ee_specific_lines_groups_api_refactored' into 'master'

Refactor EE specific params override in API::Groups

See merge request gitlab-org/gitlab-ee!13175
parents 52366f68 3bef9c0e
...@@ -7,21 +7,17 @@ module EE ...@@ -7,21 +7,17 @@ module EE
extend ActiveSupport::Concern extend ActiveSupport::Concern
prepended do prepended do
included do params :optional_params_ee do
helpers do optional :membership_lock, type: ::Grape::API::Boolean, desc: 'Prevent adding new members to project membership within this group'
params :optional_params_ee do optional :ldap_cn, type: String, desc: 'LDAP Common Name'
optional :membership_lock, type: ::Grape::API::Boolean, desc: 'Prevent adding new members to project membership within this group' optional :ldap_access, type: Integer, desc: 'A valid access level'
optional :ldap_cn, type: String, desc: 'LDAP Common Name' optional :shared_runners_minutes_limit, type: Integer, desc: '(admin-only) Pipeline minutes quota for this group'
optional :ldap_access, type: Integer, desc: 'A valid access level' optional :extra_shared_runners_minutes_limit, type: Integer, desc: '(admin-only) Extra pipeline minutes quota for this group'
optional :shared_runners_minutes_limit, type: Integer, desc: '(admin-only) Pipeline minutes quota for this group' all_or_none_of :ldap_cn, :ldap_access
optional :extra_shared_runners_minutes_limit, type: Integer, desc: '(admin-only) Extra pipeline minutes quota for this group' end
all_or_none_of :ldap_cn, :ldap_access
end
params :optional_update_params_ee do params :optional_update_params_ee do
optional :file_template_project_id, type: Integer, desc: 'The ID of a project to use for custom templates in this group' optional :file_template_project_id, type: Integer, desc: 'The ID of a project to use for custom templates in this group'
end
end
end end
end end
end end
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe API::Members do describe API::Members do
......
...@@ -7,34 +7,9 @@ module API ...@@ -7,34 +7,9 @@ module API
before { authenticate_non_get! } before { authenticate_non_get! }
helpers do helpers Helpers::GroupsHelpers
params :optional_params_ce do
optional :description, type: String, desc: 'The description of the group'
optional :visibility, type: String,
values: Gitlab::VisibilityLevel.string_values,
default: Gitlab::VisibilityLevel.string_level(
Gitlab::CurrentSettings.current_application_settings.default_group_visibility),
desc: 'The visibility of the group'
optional :lfs_enabled, type: Boolean, desc: 'Enable/disable LFS for the projects in this group'
optional :request_access_enabled, type: Boolean, desc: 'Allow users to request member access'
optional :share_with_group_lock, type: Boolean, desc: 'Prevent sharing a project with another group within this group'
end
params :optional_params_ee do
end
params :optional_update_params_ee do
end
end
include ::API::Helpers::GroupsHelpers
helpers do helpers do
params :optional_params do
use :optional_params_ce
use :optional_params_ee
end
params :statistics_params do params :statistics_params do
optional :statistics, type: Boolean, default: false, desc: 'Include project statistics' optional :statistics, type: Boolean, default: false, desc: 'Include project statistics'
end end
......
...@@ -4,6 +4,30 @@ module API ...@@ -4,6 +4,30 @@ module API
module Helpers module Helpers
module GroupsHelpers module GroupsHelpers
extend ActiveSupport::Concern extend ActiveSupport::Concern
extend Grape::API::Helpers
params :optional_params_ce do
optional :description, type: String, desc: 'The description of the group'
optional :visibility, type: String,
values: Gitlab::VisibilityLevel.string_values,
default: Gitlab::VisibilityLevel.string_level(
Gitlab::CurrentSettings.current_application_settings.default_group_visibility),
desc: 'The visibility of the group'
optional :lfs_enabled, type: Boolean, desc: 'Enable/disable LFS for the projects in this group'
optional :request_access_enabled, type: Boolean, desc: 'Allow users to request member access'
optional :share_with_group_lock, type: Boolean, desc: 'Prevent sharing a project with another group within this group'
end
params :optional_params_ee do
end
params :optional_update_params_ee do
end
params :optional_params do
use :optional_params_ce
use :optional_params_ee
end
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment