Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions db-connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -6818,7 +6818,7 @@ func fixUserOrg(ctx context.Context, user *User) *User {
}
}

if !found {
if !found && !user.SupportAccess {
user.Orgs = append(user.Orgs, user.ActiveOrg.Id)
}

Expand Down Expand Up @@ -6856,8 +6856,11 @@ func fixUserOrg(ctx context.Context, user *User) *User {

if userFound {
org.Users[orgIndex] = innerUser
} else {
} else if !user.SupportAccess {
org.Users = append(org.Users, innerUser)
} else {
log.Printf("[DEBUG] Skipping org.Users update for support user %s (%s) in org %s — not an official member", user.Username, user.Id, orgId)
return
}

err = SetOrg(ctx, *org, org.Id)
Expand Down
4 changes: 1 addition & 3 deletions shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -13049,7 +13049,6 @@ func HandleCreateSubOrg(resp http.ResponseWriter, request *http.Request) {
Id: orgId,
})

DeleteCache(ctx, fmt.Sprintf("%s_childorgs", parentOrg.Id))
DeleteCache(ctx, fmt.Sprintf("Organizations_%s", parentOrg.Id))

err = SetOrg(ctx, *parentOrg, parentOrg.Id)
Expand Down Expand Up @@ -13093,7 +13092,6 @@ func HandleCreateSubOrg(resp http.ResponseWriter, request *http.Request) {
newOrg.Users = append(newOrg.Users, loopUser)
}

DeleteCache(ctx, fmt.Sprintf("%s_childorgs", newOrg.Id))
err = SetOrg(ctx, newOrg, newOrg.Id)
if err != nil {
log.Printf("[WARNING] Failed setting new org %s: %s", newOrg.Id, err)
Expand Down Expand Up @@ -32659,7 +32657,7 @@ func HandleDeleteOrg(resp http.ResponseWriter, request *http.Request) {

parentOrg.ChildOrgs = newChildOrg

suborgCacheKey := fmt.Sprintf("%s_childorgs", parentOrg.Id)
suborgCacheKey := fmt.Sprintf("%s__childorgs", parentOrg.Id)
DeleteCache(ctx, suborgCacheKey)
DeleteCache(ctx, fmt.Sprintf("Organizations_%s", subOrg.Id))
parentOrg.SyncUsage.MultiTenant.Counter = int64(len(newChildOrg)) + 1
Expand Down
Loading