From 1c93b3f845bbb5d421b239fbe0da662ead3c7330 Mon Sep 17 00:00:00 2001 From: "Theodor S. Midtlien" Date: Mon, 7 Sep 2026 11:05:31 +0200 Subject: [PATCH] Use list of owners --- client/internal/profilemanager/config.go | 4 ++-- client/internal/profilemanager/service.go | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client/internal/profilemanager/config.go b/client/internal/profilemanager/config.go index 4239c2dd1..6f7ae2be0 100644 --- a/client/internal/profilemanager/config.go +++ b/client/internal/profilemanager/config.go @@ -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 } diff --git a/client/internal/profilemanager/service.go b/client/internal/profilemanager/service.go index 316164760..7bff4d969 100644 --- a/client/internal/profilemanager/service.go +++ b/client/internal/profilemanager/service.go @@ -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)