Fix OwnsProfile fallback to active profile

This commit is contained in:
Theodor S. Midtlien
2026-09-14 14:25:28 +02:00
parent ef402f0bdf
commit 70443a56aa
+11 -9
View File
@@ -2840,21 +2840,23 @@ func (s *Server) SessionHolder() (ipcauth.Principal, bool) {
// This triggers stamping of legacy profiles, and reloads the current config
// if the handle is the active profile.
func (s *Server) OwnsProfile(id ipcauth.Identity, handle string) bool {
act, err := s.profileManager.GetActiveProfileState()
if err != nil {
log.Warnf("failed to get active profile: %v", err)
}
if act != nil {
handle = act.ID.String()
var activeProfile *profilemanager.ActiveProfileState
if handle == "" {
activeState, err := s.profileManager.GetActiveProfileState()
if err != nil {
log.Warnf("failed to get active profile: %v", err)
}
activeProfile = activeState
handle = activeProfile.ID.String()
}
resolved, err := s.resolveProfileHandle(handle, id)
if err != nil {
log.Errorf("failed to resolve profile %q: %v", handle, err)
return false
}
// resolveProfileHandle might stamp legacy profile owners and if
if act != nil {
config, _, err := s.getConfig(act)
// resolveProfileHandle might stamp legacy profile owners
if activeProfile != nil {
config, _, err := s.getConfig(activeProfile)
if err != nil {
log.Errorf("failed to get active profile config: %v", err)
}