add event write perm check

This commit is contained in:
710leo 2021-05-25 17:54:09 +08:00
parent 01420ff1d8
commit 22f0aee55d
1 changed files with 13 additions and 0 deletions

View File

@ -259,6 +259,12 @@ func eventHisGets(c *gin.Context) {
func eventCurDel(c *gin.Context) {
eventCur := mustEventCur(urlParamInt64(c, "id"))
can, err := models.UsernameCandoNodeOp(loginUsername(c), "mon_event_write", eventCur.Nid)
errors.Dangerous(err)
if !can {
errors.Bomb(_s("no privilege"))
}
renderMessage(c, eventCur.EventIgnore())
}
@ -404,6 +410,13 @@ func eventCurClaim(c *gin.Context) {
var f claimForm
errors.Dangerous(c.ShouldBind(&f))
eventCur := mustEventCur(f.Id)
can, err := models.UsernameCandoNodeOp(username, "mon_event_write", eventCur.Nid)
errors.Dangerous(err)
if !can {
errors.Bomb(_s("no privilege"))
}
id := f.Id
nodePath := f.NodePath