More work on perms page

This commit is contained in:
simon987
2019-02-17 14:09:52 -05:00
parent b936513eb9
commit 94c3ce3267
30 changed files with 425 additions and 70 deletions

View File

@@ -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)