Fix security issues with teams
This commit is contained in:
parent
3ddd9f753c
commit
6350b32a3d
4 changed files with 16 additions and 7 deletions
|
@ -295,4 +295,15 @@ class User < ActiveRecord::Base
|
|||
def namespace_id
|
||||
namespace.try :id
|
||||
end
|
||||
|
||||
def authorized_teams
|
||||
@authorized_teams ||= begin
|
||||
ids = []
|
||||
ids << UserTeam.with_member(self).pluck('user_teams.id')
|
||||
ids << UserTeam.created_by(self).pluck('user_teams.id')
|
||||
ids.flatten
|
||||
|
||||
UserTeam.where(id: ids)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue