Fixed user_namespace relation not working

This commit is contained in:
kolaente 2018-09-06 18:52:10 +02:00
parent 6d971c5fe1
commit 37de3ef232
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -87,8 +87,8 @@ func (n *Namespace) checkUserRights(user *User, r UserRight) bool {
exists, err := x.Select("namespaces.*"). exists, err := x.Select("namespaces.*").
Table("namespaces"). Table("namespaces").
Join("LEFT", "users_namespace", "users_namespace.namespace_id = namespaces.id"). Join("LEFT", "users_namespace", "users_namespace.namespace_id = namespaces.id").
Where("namespaces.id = ? "+ Where("namespaces.id = ? AND ("+
"OR namespaces.owner_id = ? "+ "namespaces.owner_id = ? "+
"OR (users_namespace.user_id = ? AND users_namespace.right = ?))", n.ID, user.ID, user.ID, r). "OR (users_namespace.user_id = ? AND users_namespace.right = ?))", n.ID, user.ID, user.ID, r).
Get(&Namespace{}) Get(&Namespace{})