Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-12-21 12:17:08 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-12-21 12:17:08 +0300
commit4ecd816dcbbf2c3a83087ea1add13f087530e9eb (patch)
treefaf1d225bf16fa64dea1244217b3f8b6e7dac46d /lib/api
parenta293ae1ab5e4253f6003123c79c00bf7b953a7e5 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/entities/group.rb1
-rw-r--r--lib/api/groups.rb6
-rw-r--r--lib/api/helpers.rb23
3 files changed, 6 insertions, 24 deletions
diff --git a/lib/api/entities/group.rb b/lib/api/entities/group.rb
index 14491c2396a..1a1765c2e0a 100644
--- a/lib/api/entities/group.rb
+++ b/lib/api/entities/group.rb
@@ -23,7 +23,6 @@ module API
expose :full_name, :full_path
expose :created_at
expose :parent_id
- expose :organization_id
expose :shared_runners_setting
expose :custom_attributes, using: 'API::Entities::CustomAttribute', if: :with_custom_attributes
diff --git a/lib/api/groups.rb b/lib/api/groups.rb
index 7b755a76f29..1ff64cd2ffd 100644
--- a/lib/api/groups.rb
+++ b/lib/api/groups.rb
@@ -213,15 +213,11 @@ module API
requires :name, type: String, desc: 'The name of the group'
requires :path, type: String, desc: 'The path of the group'
optional :parent_id, type: Integer, desc: 'The parent group id for creating nested group'
- optional :organization_id, type: Integer, desc: 'The organization id for the group'
use :optional_params
end
post feature_category: :groups_and_projects, urgency: :low do
- organization = find_organization!(params[:organization_id]) if params[:organization_id].present?
- authorize! :create_group, organization if organization
-
- parent_group = find_group!(params[:parent_id], organization: organization) if params[:parent_id].present?
+ parent_group = find_group!(params[:parent_id]) if params[:parent_id].present?
if parent_group
authorize! :create_subgroup, parent_group
else
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index a59734d643d..6cb9d19a2ad 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -211,25 +211,18 @@ module API
not_found!('Pipeline')
end
- def find_organization!(id)
- organization = Organizations::Organization.find_by_id(id)
- check_organization_access(organization)
- end
-
# rubocop: disable CodeReuse/ActiveRecord
- def find_group(id, organization: nil)
- collection = organization.present? ? Group.in_organization(organization) : Group.all
-
+ def find_group(id)
if id.to_s =~ INTEGER_ID_REGEX
- collection.find_by(id: id)
+ Group.find_by(id: id)
else
- collection.find_by_full_path(id)
+ Group.find_by_full_path(id)
end
end
# rubocop: enable CodeReuse/ActiveRecord
- def find_group!(id, organization: nil)
- group = find_group(id, organization: organization)
+ def find_group!(id)
+ group = find_group(id)
check_group_access(group)
end
@@ -842,12 +835,6 @@ module API
@sudo_identifier ||= params[SUDO_PARAM] || env[SUDO_HEADER]
end
- def check_organization_access(organization)
- return organization if can?(current_user, :read_organization, organization)
-
- not_found!('Organization')
- end
-
def secret_token
Gitlab::Shell.secret_token
end