/namepspaces/{namespacesID}/users now also returns the user right
This commit is contained in:
parent
b1564659c4
commit
cf6577445d
3 changed files with 6 additions and 7 deletions
|
@ -18,3 +18,8 @@ type ListUser struct {
|
||||||
func (ListUser) TableName() string {
|
func (ListUser) TableName() string {
|
||||||
return "users_list"
|
return "users_list"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type userWithRight struct {
|
||||||
|
User `xorm:"extends"`
|
||||||
|
Right UserRight `json:"right"`
|
||||||
|
}
|
||||||
|
|
|
@ -11,11 +11,6 @@ func (ul *ListUser) ReadAll(user *User) (interface{}, error) {
|
||||||
return nil, ErrNeedToHaveListReadAccess{}
|
return nil, ErrNeedToHaveListReadAccess{}
|
||||||
}
|
}
|
||||||
|
|
||||||
type userWithRight struct {
|
|
||||||
User `xorm:"extends"`
|
|
||||||
Right UserRight `json:"right"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get all users
|
// Get all users
|
||||||
all := []*userWithRight{}
|
all := []*userWithRight{}
|
||||||
err = x.
|
err = x.
|
||||||
|
|
|
@ -12,9 +12,8 @@ func (un *NamespaceUser) ReadAll(user *User) (interface{}, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all users
|
// Get all users
|
||||||
all := []*User{}
|
all := []*userWithRight{}
|
||||||
err = x.
|
err = x.
|
||||||
Select("users.*").
|
|
||||||
Join("INNER", "users_namespace", "user_id = users.id").
|
Join("INNER", "users_namespace", "user_id = users.id").
|
||||||
Where("users_namespace.namespace_id = ?", un.NamespaceID).
|
Where("users_namespace.namespace_id = ?", un.NamespaceID).
|
||||||
Find(&all)
|
Find(&all)
|
||||||
|
|
Loading…
Add table
Reference in a new issue