mirror of
https://github.com/simon987/task_tracker.git
synced 2025-12-13 23:09:02 +00:00
More work on perms page
This commit is contained in:
26
api/auth.go
26
api/auth.go
@@ -155,6 +155,32 @@ func (api *WebAPI) GetManagerList(r *Request) {
|
||||
})
|
||||
}
|
||||
|
||||
func (api *WebAPI) GetManagerListWithRoleOn(r *Request) {
|
||||
|
||||
pid, err := strconv.ParseInt(r.Ctx.UserValue("id").(string), 10, 64)
|
||||
handleErr(err, r) //todo handle invalid id
|
||||
|
||||
sess := api.Session.StartFasthttp(r.Ctx)
|
||||
manager := sess.Get("manager")
|
||||
|
||||
if manager == nil {
|
||||
r.Json(JsonResponse{
|
||||
Ok: false,
|
||||
Message: "Unauthorized",
|
||||
}, 401)
|
||||
return
|
||||
}
|
||||
|
||||
managers := api.Database.GetManagerListWithRoleOn(pid)
|
||||
|
||||
r.OkJson(JsonResponse{
|
||||
Ok: true,
|
||||
Content: GetManagerListWithRoleOnResponse{
|
||||
Managers: managers,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func (api *WebAPI) PromoteManager(r *Request) {
|
||||
|
||||
id, err := strconv.ParseInt(r.Ctx.UserValue("id").(string), 10, 64)
|
||||
|
||||
Reference in New Issue
Block a user