feat(client): add settings clients
This commit is contained in:
parent
76cf1274af
commit
83436eac6a
5 changed files with 56 additions and 2 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"github.com/ihexxa/gocfg"
|
||||
|
||||
"github.com/ihexxa/quickshare/src/db/sitestore"
|
||||
"github.com/ihexxa/quickshare/src/db/userstore"
|
||||
"github.com/ihexxa/quickshare/src/depidx"
|
||||
q "github.com/ihexxa/quickshare/src/handlers"
|
||||
)
|
||||
|
@ -55,6 +56,12 @@ func (h *SettingsSvc) SetClientCfg(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
role := c.MustGet(q.RoleParam).(string)
|
||||
if role != userstore.AdminRole {
|
||||
c.JSON(q.ErrResp(c, 401, q.ErrUnauthorized))
|
||||
return
|
||||
}
|
||||
|
||||
err = h.deps.SiteStore().SetClientCfg(req.ClientCfg)
|
||||
if err != nil {
|
||||
c.JSON(q.ErrResp(c, 500, err))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue