mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2025-01-29 22:35:15 +01:00
feat(aa): add the hat struct.
This commit is contained in:
parent
474481f1d3
commit
72107dcfff
1 changed files with 39 additions and 0 deletions
39
pkg/aa/blocks.go
Normal file
39
pkg/aa/blocks.go
Normal file
|
@ -0,0 +1,39 @@
|
|||
// apparmor.d - Full set of apparmor profiles
|
||||
// Copyright (C) 2021-2024 Alexandre Pujol <alexandre@pujol.io>
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
package aa
|
||||
|
||||
const (
|
||||
tokHAT = "hat"
|
||||
tokCARET = "^"
|
||||
)
|
||||
|
||||
// Hat represents a single AppArmor hat.
|
||||
type Hat struct {
|
||||
RuleBase
|
||||
Name string
|
||||
Rules Rules
|
||||
}
|
||||
|
||||
func (p *Hat) Less(other any) bool {
|
||||
o, _ := other.(*Hat)
|
||||
return p.Name < o.Name
|
||||
}
|
||||
|
||||
func (p *Hat) Equals(other any) bool {
|
||||
o, _ := other.(*Profile)
|
||||
return p.Name == o.Name
|
||||
}
|
||||
|
||||
func (p *Hat) String() string {
|
||||
return renderTemplate(p.Kind(), p)
|
||||
}
|
||||
|
||||
func (p *Hat) Constraint() constraint {
|
||||
return blockKind
|
||||
}
|
||||
|
||||
func (p *Hat) Kind() string {
|
||||
return tokHAT
|
||||
}
|
Loading…
Reference in a new issue