@@ -6,10 +6,20 @@ import (
|
||||
|
||||
"github.com/yauthdev/yauth/server/db"
|
||||
"github.com/yauthdev/yauth/server/graph/model"
|
||||
"github.com/yauthdev/yauth/server/utils"
|
||||
)
|
||||
|
||||
func Users(ctx context.Context) ([]*model.User, error) {
|
||||
gc, err := utils.GinContextFromContext(ctx)
|
||||
var res []*model.User
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
|
||||
if !utils.IsSuperAdmin(gc) {
|
||||
return res, fmt.Errorf("unauthorized")
|
||||
}
|
||||
|
||||
users, err := db.Mgr.GetUsers()
|
||||
if err != nil {
|
||||
return res, err
|
||||
|
Reference in New Issue
Block a user