diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-03 21:10:18 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-03 21:10:18 +0300 |
commit | 9be457ffc1727f6a942a68c16e47ca0bcaa2f64a (patch) | |
tree | 5c006f5e268f88603a69da3c1c3056030b0afca7 /app/services/users | |
parent | 388e0fbbd00e04a10e3ac1084945aa18a781c40c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/users')
-rw-r--r-- | app/services/users/refresh_authorized_projects_service.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/services/users/refresh_authorized_projects_service.rb b/app/services/users/refresh_authorized_projects_service.rb index b1ffd006795..197260a80ca 100644 --- a/app/services/users/refresh_authorized_projects_service.rb +++ b/app/services/users/refresh_authorized_projects_service.rb @@ -67,8 +67,10 @@ module Users def update_authorizations(remove = [], add = []) log_refresh_details(remove, add) - ProjectAuthorization.delete_all_in_batches_for_user(user: user, project_ids: remove) if remove.any? - ProjectAuthorization.insert_all_in_batches(add) if add.any? + ProjectAuthorizations::Changes.new do |changes| + changes.add(add) + changes.remove_projects_for_user(user, remove) + end.apply! # Since we batch insert authorization rows, Rails' associations may get # out of sync. As such we force a reload of the User object. |