diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-18 20:02:30 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-18 20:02:30 +0000 |
commit | 41fe97390ceddf945f3d967b8fdb3de4c66b7dea (patch) | |
tree | 9c8d89a8624828992f06d892cd2f43818ff5dcc8 /app/services/groups | |
parent | 0804d2dc31052fb45a1efecedc8e06ce9bc32862 (diff) | |
download | gitlab-ce-41fe97390ceddf945f3d967b8fdb3de4c66b7dea.tar.gz |
Add latest changes from gitlab-org/gitlab@14-9-stable-eev14.9.0-rc42
Diffstat (limited to 'app/services/groups')
-rw-r--r-- | app/services/groups/deploy_tokens/create_service.rb | 2 | ||||
-rw-r--r-- | app/services/groups/deploy_tokens/destroy_service.rb | 2 | ||||
-rw-r--r-- | app/services/groups/deploy_tokens/revoke_service.rb | 16 | ||||
-rw-r--r-- | app/services/groups/destroy_service.rb | 4 |
4 files changed, 24 insertions, 0 deletions
diff --git a/app/services/groups/deploy_tokens/create_service.rb b/app/services/groups/deploy_tokens/create_service.rb index aee423659ef..4b0541e78a1 100644 --- a/app/services/groups/deploy_tokens/create_service.rb +++ b/app/services/groups/deploy_tokens/create_service.rb @@ -13,3 +13,5 @@ module Groups end end end + +Groups::DeployTokens::CreateService.prepend_mod diff --git a/app/services/groups/deploy_tokens/destroy_service.rb b/app/services/groups/deploy_tokens/destroy_service.rb index 6dae22f29d2..4745d00ed7f 100644 --- a/app/services/groups/deploy_tokens/destroy_service.rb +++ b/app/services/groups/deploy_tokens/destroy_service.rb @@ -11,3 +11,5 @@ module Groups end end end + +Groups::DeployTokens::DestroyService.prepend_mod diff --git a/app/services/groups/deploy_tokens/revoke_service.rb b/app/services/groups/deploy_tokens/revoke_service.rb new file mode 100644 index 00000000000..cf91d3b27fa --- /dev/null +++ b/app/services/groups/deploy_tokens/revoke_service.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Groups + module DeployTokens + class RevokeService < BaseService + attr_accessor :token + + def execute + @token = group.deploy_tokens.find(params[:id]) + @token.revoke! + end + end + end +end + +Groups::DeployTokens::RevokeService.prepend_mod diff --git a/app/services/groups/destroy_service.rb b/app/services/groups/destroy_service.rb index 5ffa746e109..c88c139a22e 100644 --- a/app/services/groups/destroy_service.rb +++ b/app/services/groups/destroy_service.rb @@ -11,11 +11,15 @@ module Groups # rubocop: disable CodeReuse/ActiveRecord def execute + # TODO - add a policy check here https://gitlab.com/gitlab-org/gitlab/-/issues/353082 + raise DestroyError, "You can't delete this group because you're blocked." if current_user.blocked? + group.prepare_for_destroy group.projects.includes(:project_feature).each do |project| # Execute the destruction of the models immediately to ensure atomic cleanup. success = ::Projects::DestroyService.new(project, current_user).execute + raise DestroyError, "Project #{project.id} can't be deleted" unless success end |