feat(users): enable quota in handlers

This commit is contained in:
hexxa 2021-08-07 17:18:10 +08:00 committed by Hexxa
parent 75e10e6ad9
commit e73947de0d
4 changed files with 60 additions and 34 deletions

View file

@ -354,11 +354,19 @@ func (h *MultiUsersSvc) AddUser(c *gin.Context) {
return
}
spaceLimit := h.cfg.IntOr("Users.SpaceLimit", 1024)
uploadSpeedLimit := h.cfg.IntOr("Users.UploadSpeedLimit", 100*1024)
downloadSpeedLimit := h.cfg.IntOr("Users.DownloadSpeedLimit", 100*1024)
err = h.deps.Users().AddUser(&userstore.User{
ID: uid,
Name: req.Name,
Pwd: string(pwdHash),
Role: req.Role,
Quota: &userstore.Quota{
SpaceLimit: spaceLimit,
UploadSpeedLimit: uploadSpeedLimit,
DownloadSpeedLimit: downloadSpeedLimit,
},
})
if err != nil {
c.JSON(q.ErrResp(c, 500, err))