/namepspaces/{namespacesID}/users now also returns the user right

This commit is contained in:
kolaente 2018-09-17 19:39:14 +02:00
parent b1564659c4
commit cf6577445d
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
3 changed files with 6 additions and 7 deletions

View file

@ -18,3 +18,8 @@ type ListUser struct {
func (ListUser) TableName() string {
return "users_list"
}
type userWithRight struct {
User `xorm:"extends"`
Right UserRight `json:"right"`
}

View file

@ -11,11 +11,6 @@ func (ul *ListUser) ReadAll(user *User) (interface{}, error) {
return nil, ErrNeedToHaveListReadAccess{}
}
type userWithRight struct {
User `xorm:"extends"`
Right UserRight `json:"right"`
}
// Get all users
all := []*userWithRight{}
err = x.

View file

@ -12,9 +12,8 @@ func (un *NamespaceUser) ReadAll(user *User) (interface{}, error) {
}
// Get all users
all := []*User{}
all := []*userWithRight{}
err = x.
Select("users.*").
Join("INNER", "users_namespace", "user_id = users.id").
Where("users_namespace.namespace_id = ?", un.NamespaceID).
Find(&all)