authorized_projects and authorized_groups methods for user
This commit is contained in:
parent
83f2a387d6
commit
9df6f7bfad
4 changed files with 26 additions and 16 deletions
|
@ -124,11 +124,15 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def accessed_groups
|
||||
@accessed_groups ||= begin
|
||||
def authorized_groups
|
||||
@authorized_groups ||= begin
|
||||
groups = Group.where(id: self.projects.pluck(:namespace_id)).all
|
||||
groups = groups + self.groups
|
||||
groups.uniq
|
||||
end
|
||||
end
|
||||
|
||||
def authorized_projects
|
||||
Project.authorized_for(self)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue