diff options
author | GitLab Release Tools Bot <robert+release-tools@gitlab.com> | 2019-09-26 13:53:16 +0000 |
---|---|---|
committer | GitLab Release Tools Bot <robert+release-tools@gitlab.com> | 2019-09-26 13:53:16 +0000 |
commit | 7224fd1cc5bda5aa5b0e822f7e5eba66b8d87012 (patch) | |
tree | fb63588b2784b52389db6e2e977308cf6a16ccda /app/models | |
parent | e5ba7aaebae30ff4a2aaf831be4315f9fffe9eff (diff) | |
parent | 90466e7009e5c1791de07590055db35921ac30c5 (diff) | |
download | gitlab-ce-7224fd1cc5bda5aa5b0e822f7e5eba66b8d87012.tar.gz |
Merge branch 'security-fp-stop-jobs-when-blocking-user-12-3' into '12-3-stable'
Cancel all running CI jobs when user is blocked
See merge request gitlab/gitlabhq!3436
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/user.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 66defb4c707..a69db121a0b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -267,6 +267,16 @@ class User < ApplicationRecord BLOCKED_MESSAGE end end + + # rubocop: disable CodeReuse/ServiceClass + # Ideally we should not call a service object here but user.block + # is also bcalled by Users::MigrateToGhostUserService which references + # this state transition object in order to do a rollback. + # For this reason the tradeoff is to disable this cop. + after_transition any => :blocked do |user| + Ci::CancelUserPipelinesService.new.execute(user) + end + # rubocop: enable CodeReuse/ServiceClass end # Scopes |