mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-11 23:54:22 +08:00
fix node id acl validation
This commit is contained in:
parent
0e3e9162c7
commit
1db150c65b
2 changed files with 24 additions and 9 deletions
|
@ -290,11 +290,19 @@ func IsAclPolicyValid(acl models.Acl) bool {
|
|||
if srcI.Value == "*" {
|
||||
continue
|
||||
}
|
||||
// check if tag is valid
|
||||
_, err := GetTag(models.TagID(srcI.Value))
|
||||
if err != nil {
|
||||
return false
|
||||
if srcI.ID == models.NodeTagID {
|
||||
// check if tag is valid
|
||||
_, err := GetTag(models.TagID(srcI.Value))
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
_, err := GetNodeByID(srcI.Value)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
for _, dstI := range acl.Dst {
|
||||
|
||||
|
@ -307,10 +315,17 @@ func IsAclPolicyValid(acl models.Acl) bool {
|
|||
if dstI.Value == "*" {
|
||||
continue
|
||||
}
|
||||
// check if tag is valid
|
||||
_, err := GetTag(models.TagID(dstI.Value))
|
||||
if err != nil {
|
||||
return false
|
||||
if dstI.ID == models.NodeTagID {
|
||||
// check if tag is valid
|
||||
_, err := GetTag(models.TagID(dstI.Value))
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
_, err := GetNodeByID(dstI.Value)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ const (
|
|||
UserAclID AclGroupType = "user"
|
||||
UserGroupAclID AclGroupType = "user-group"
|
||||
NodeTagID AclGroupType = "tag"
|
||||
NodeID AclGroupType = "node_id"
|
||||
NodeID AclGroupType = "device"
|
||||
NetmakerIPAclID AclGroupType = "ip"
|
||||
NetmakerSubNetRangeAClID AclGroupType = "ipset"
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue