Third party permissions working

This commit is contained in:
Henrique Dias committed 2017-07-14 08:25:37 +01:00
1 parent 3bcfdb6221
commit e78e106146
4 files changed
+53 -19

No files matched your search

+8
View File
@@ -52,6 +52,10 @@ func usersGetHandler(c *RequestContext, w http.ResponseWriter, r *http.Request)
return renderJSON(w, users)
}
if r.URL.Path == "/base" {
return renderJSON(w, c.FM.DefaultUser)
}
// Otherwise we just want one, specific, user.
sid := strings.TrimPrefix(r.URL.Path, "/")
sid = strings.TrimSuffix(sid, "/")
@@ -277,6 +281,10 @@ func usersPutHandler(c *RequestContext, w http.ResponseWriter, r *http.Request)
u.Password = pw
}
if u.Permissions == nil {
u.Permissions = c.FM.DefaultUser.Permissions
}
// Updates the whole User struct because we always are supposed
// to send a new entire object.
err = c.FM.db.Save(&u)