At least one team have rw permission

This commit is contained in:
Ulric Qin 2021-12-08 13:18:53 +08:00
parent 12a5f335bd
commit 48247ea7fe
2 changed files with 13 additions and 0 deletions

View File

@ -40,6 +40,7 @@ var (
"No permission to operate the targets: %s": "没有权限操作这些监控对象:%s",
"No permission. You are not admin of BG(%s)": "没有权限操作,您并非业务组(%s)的管理员",
"The business group must retain at least one team": "业务组下要保留至少一个团队",
"At least one team have rw permission": "业务组下至少要有一个具备读写权限的团队",
}
langDict = map[string]map[string]string{
"zh": dict,

View File

@ -24,6 +24,18 @@ func busiGroupAdd(c *gin.Context) {
ginx.Bomb(http.StatusBadRequest, "members empty")
}
rwhas := false
for i := 0; i < len(f.Members); i++ {
if f.Members[i].PermFlag == "rw" {
rwhas = true
break
}
}
if !rwhas {
ginx.Bomb(http.StatusBadRequest, "At least one team have rw permission")
}
username := c.MustGet("username").(string)
ginx.NewRender(c).Message(models.BusiGroupAdd(f.Name, f.Members, username))
}