diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /app/services/projects/transfer_service.rb | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'app/services/projects/transfer_service.rb')
-rw-r--r-- | app/services/projects/transfer_service.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/services/projects/transfer_service.rb b/app/services/projects/transfer_service.rb index 51c0989ee55..2ad5c303be2 100644 --- a/app/services/projects/transfer_service.rb +++ b/app/services/projects/transfer_service.rb @@ -121,6 +121,7 @@ module Projects # Overridden in EE def post_update_hooks(project) move_pages(project) + ensure_personal_project_owner_membership(project) end # Overridden in EE @@ -152,6 +153,19 @@ module Projects project.track_project_repository end + def ensure_personal_project_owner_membership(project) + # In case of personal projects, we want to make sure that + # a membership record with `OWNER` access level exists for the owner of the namespace. + return unless project.personal? + + namespace_owner = project.namespace.owner + existing_membership_record = project.member(namespace_owner) + + return if existing_membership_record.present? && existing_membership_record.access_level == Gitlab::Access::OWNER + + project.add_owner(namespace_owner) + end + def refresh_permissions # This ensures we only schedule 1 job for every user that has access to # the namespaces. |