isChangeRole
This commit is contained in:
parent
db92e99698
commit
ff6a951231
|
@ -180,9 +180,17 @@ func (s *StaffUser) Update(sess *session.AdminSession, req *api.StaffUpdateReq)
|
|||
if oldCfg == nil {
|
||||
oldCfg = make(map[string]interface{})
|
||||
}
|
||||
isChangeRole := false
|
||||
for k, v := range newCfg {
|
||||
oldCfg[k] = v
|
||||
if k == "user_role" {
|
||||
isChangeRole = true
|
||||
}
|
||||
}
|
||||
if isChangeRole && !sess.GetAdmin().GetConfig().IsAdmin() {
|
||||
panic(config.ErrPriv.New())
|
||||
}
|
||||
|
||||
staffUser.Config = goutil.EncodeJSON(oldCfg)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue