diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-21 12:17:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-21 12:17:08 +0300 |
commit | 4ecd816dcbbf2c3a83087ea1add13f087530e9eb (patch) | |
tree | faf1d225bf16fa64dea1244217b3f8b6e7dac46d /lib/api/helpers.rb | |
parent | a293ae1ab5e4253f6003123c79c00bf7b953a7e5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r-- | lib/api/helpers.rb | 23 |
1 files changed, 5 insertions, 18 deletions
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 |