mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2024-11-14 23:43:56 +01:00
feat(aa): add basic rules getter
This commit is contained in:
parent
ad81c39e31
commit
3ad55927bf
@ -32,3 +32,24 @@ type Rules []Rule
|
||||
func (r Rules) String() string {
|
||||
return renderTemplate("rules", r)
|
||||
}
|
||||
|
||||
func (r Rules) Get(filter string) Rules {
|
||||
res := make(Rules, 0)
|
||||
for _, rule := range r {
|
||||
if rule.Kind() == filter {
|
||||
res = append(res, rule)
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func (r Rules) GetVariables() []*Variable {
|
||||
res := make([]*Variable, 0)
|
||||
for _, rule := range r {
|
||||
switch rule.(type) {
|
||||
case *Variable:
|
||||
res = append(res, rule.(*Variable))
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user