diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2017-01-25 13:17:43 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2017-01-25 13:17:43 +0000 |
commit | 8a9597fc737b9c848b8e1935551edb2f1d09aab0 (patch) | |
tree | 90148cee8da324667d09226486d50e3ca9042327 /app/models/user.rb | |
parent | bc7febfff094531d385bb6dc3f53885fb0a2f400 (diff) | |
parent | 52c5f9c97f20529b608f5b47a7c361383ccadb54 (diff) | |
download | gitlab-ce-8a9597fc737b9c848b8e1935551edb2f1d09aab0.tar.gz |
Merge branch 'dz-nested-groups-access-improvements' into 'master'
Nested groups feature improvemetns
See merge request !8448
Diffstat (limited to 'app/models/user.rb')
-rw-r--r-- | app/models/user.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 2caa66dd9f7..54f5388eb2c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -439,6 +439,15 @@ class User < ActiveRecord::Base Group.where("namespaces.id IN (#{union.to_sql})") end + def nested_groups + Group.member_descendants(id) + end + + def nested_projects + Project.joins(:namespace).where('namespaces.parent_id IS NOT NULL'). + member_descendants(id) + end + def refresh_authorized_projects Users::RefreshAuthorizedProjectsService.new(self).execute end |