Use list of owners

This commit is contained in:
Theodor S. Midtlien
2026-09-07 11:05:31 +02:00
parent 83055cdc94
commit 1c93b3f845
2 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -211,7 +211,7 @@ type Config struct {
// (HasKey, ManagedKeys, IsEmpty).
policy *mdm.Policy `json:"-"`
Owner string
Owners []string
}
// Policy returns the MDM policy applied to this Config. Returns a non-nil
@@ -718,7 +718,7 @@ func (config *Config) apply(input ConfigInput) (updated bool, err error) {
if input.Owner != nil {
ownerString := ipcauth.OwnerPrincipalForIdentity(*input.Owner)
config.Owner = ownerString
config.Owners = append([]string{}, ownerString)
log.Infof("setting '%s' as owner for profile %s", ownerString, config.Name)
updated = true
}
+6 -6
View File
@@ -56,7 +56,7 @@ type profileMeta struct {
// nolint:unused
type ownerMeta struct {
Owner string
Owners []string
}
func (e *ErrAmbiguousHandle) Error() string {
@@ -578,16 +578,16 @@ func readProfileName(path string) string {
}
// nolint: unused,unusedfunc
func readProfileOwner(path string) string {
func readProfileOwner(path string) []string {
data, err := os.ReadFile(path)
if err != nil {
return ""
return []string{}
}
var meta ownerMeta
if err := json.Unmarshal(data, &meta); err != nil {
return ""
return []string{}
}
return meta.Owner
return meta.Owners
}
// nolint: unused,unusedfunc
@@ -600,7 +600,7 @@ func stampOwner(path string, owner ipcauth.Identity) error {
if err := json.Unmarshal(data, &cfg); err != nil {
return err
}
cfg.Owner = ipcauth.OwnerPrincipalForIdentity(owner)
cfg.Owners = append([]string{}, ipcauth.OwnerPrincipalForIdentity(owner))
if err := util.WriteJson(context.Background(), path, cfg); err != nil {
return fmt.Errorf("failed to write profile owner: %w", err)