mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-09-20 02:00:14 +00:00
fix(controller): enforce ownership on notification group, NAT server, and batch move
Co-authored-by: naiba/CloudCode <hi+cloudcode@nai.ba>
This commit is contained in:
@@ -53,10 +53,15 @@ func createNAT(c *gin.Context) (uint64, error) {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
if server, ok := singleton.ServerShared.Get(nf.ServerID); ok {
|
||||
if !server.HasPermission(c) {
|
||||
return 0, singleton.Localizer.ErrorT("permission denied")
|
||||
}
|
||||
if nf.ServerID == 0 {
|
||||
return 0, singleton.Localizer.ErrorT("have invalid server id")
|
||||
}
|
||||
server, ok := singleton.ServerShared.Get(nf.ServerID)
|
||||
if !ok {
|
||||
return 0, singleton.Localizer.ErrorT("have invalid server id")
|
||||
}
|
||||
if !server.HasPermission(c) {
|
||||
return 0, singleton.Localizer.ErrorT("permission denied")
|
||||
}
|
||||
|
||||
uid := getUid(c)
|
||||
@@ -101,10 +106,15 @@ func updateNAT(c *gin.Context) (any, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if server, ok := singleton.ServerShared.Get(nf.ServerID); ok {
|
||||
if !server.HasPermission(c) {
|
||||
return nil, singleton.Localizer.ErrorT("permission denied")
|
||||
}
|
||||
if nf.ServerID == 0 {
|
||||
return nil, singleton.Localizer.ErrorT("have invalid server id")
|
||||
}
|
||||
server, ok := singleton.ServerShared.Get(nf.ServerID)
|
||||
if !ok {
|
||||
return nil, singleton.Localizer.ErrorT("have invalid server id")
|
||||
}
|
||||
if !server.HasPermission(c) {
|
||||
return nil, singleton.Localizer.ErrorT("permission denied")
|
||||
}
|
||||
|
||||
var n model.NAT
|
||||
|
||||
Reference in New Issue
Block a user