Fixed a bug where a user could see every namespace
This commit is contained in:
parent
f2758e239c
commit
92174aac08
1 changed files with 3 additions and 2 deletions
|
@ -67,8 +67,9 @@ func (n *Namespace) checkTeamRights(user *User, r TeamRight) bool {
|
|||
Table("namespaces").
|
||||
Join("LEFT", "team_namespaces", "namespaces.id = team_namespaces.namespace_id").
|
||||
Join("LEFT", "team_members", "team_members.team_id = team_namespaces.team_id").
|
||||
Where("team_members.user_id = ? AND team_namespaces.right = ?", user.ID, r).
|
||||
Or("namespaces.owner_id = ?", user.ID).
|
||||
Where("namespaces.id = ? " +
|
||||
"AND ((team_members.user_id = ? AND team_namespaces.right = ?) " +
|
||||
"OR namespaces.owner_id = ?)", n.ID, user.ID, r, user.ID).
|
||||
Get(&Namespace{})
|
||||
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue