feat(aa): add merge methods to the rule interface.
This commit is contained in:
parent
a91e2ddf56
commit
6791dcde28
14 changed files with 192 additions and 11 deletions
|
|
@ -132,11 +132,13 @@ func (r *File) Compare(other Rule) int {
|
|||
|
||||
func (r *File) Merge(other Rule) bool {
|
||||
o, _ := other.(*File)
|
||||
if r.Path == o.Path {
|
||||
r.Access = append(r.Access, o.Access...)
|
||||
slices.SortFunc(r.Access, compareFileAccess)
|
||||
r.Access = slices.Compact(r.Access)
|
||||
return true
|
||||
|
||||
if !r.Qualifier.Equal(o.Qualifier) {
|
||||
return false
|
||||
}
|
||||
if r.Owner == o.Owner && r.Path == o.Path && r.Target == o.Target {
|
||||
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
|
||||
return r.RuleBase.merge(o.RuleBase)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue