diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-20 15:07:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-20 15:07:25 +0300 |
commit | 07b1e2691206717206d40f9c7f0abfd1a30ecbdd (patch) | |
tree | a5b6b9655d73f158c22ecc70bcb65535226fd4ac /app/models/group.rb | |
parent | 65a0673d76bb86d6acca6dc3ab42dc91a04f56c2 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/group.rb')
-rw-r--r-- | app/models/group.rb | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/app/models/group.rb b/app/models/group.rb index 2b5a392e02c..7a9eb12db4e 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -641,13 +641,20 @@ class Group < Namespace .where(source_id: self_and_hierarchy.reorder(nil).select(:id)) end - def direct_and_indirect_members_with_inactive + def hierarchy_members_with_inactive GroupMember .non_request .non_invite .where(source_id: self_and_hierarchy.reorder(nil).select(:id)) end + def descendant_project_members_with_inactive + ProjectMember + .with_source_id(all_projects) + .non_request + .non_invite + end + def users_with_parents User .where(id: members_with_parents.select(:user_id)) @@ -685,20 +692,6 @@ class Group < Namespace ]) end - # Returns all users (also inactive) that are members of the group because: - # 1. They belong to the group - # 2. They belong to a project that belongs to the group - # 3. They belong to a sub-group or project in such sub-group - # 4. They belong to an ancestor group - def direct_and_indirect_users_with_inactive - User.from_union([ - User - .where(id: direct_and_indirect_members_with_inactive.select(:user_id)) - .reorder(nil), - project_users_with_descendants - ]).allow_cross_joins_across_databases(url: "https://gitlab.com/gitlab-org/gitlab/-/issues/417455") # failed in spec/tasks/gitlab/user_management_rake_spec.rb - end - def users_count members.count end |