You've already forked filebrowser
mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-11-26 14:25:26 +08:00
Third party permissions working
Former-commit-id: 4b764bddd794d93565dc2a0929c193869101e4e3 [formerly 613db1e61cb4b79e1b6415c1619d7fa66cf7217d] [formerly 6091413c496e4d62db130f7ec99c27fab928d84d [formerly e78e106146]]
Former-commit-id: df9abaa4e53da7d9216c702c9162203186c594c0 [formerly 5e43c76b511d3e152f5c0d1b8024a98ae6d899e1]
Former-commit-id: e10ca024c0c9429e876bf1de060849133fc19a8e
This commit is contained in:
8
users.go
8
users.go
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user