Skip to content

auth.userOrgMap is only made effective after a new user is added

Created by: dadlerj

Reported by https://app.hubspot.com/contacts/2762526/company/557475882

I created an organization and added the auth.userOrgMap config option to auto-add people. Will that only add new uses or does it also add every existing user to the org?

My response:

Existing users should be added as well. Are you not seeing that happen?

Him:

Not yet, but it did say that a server restart was needed. $REDACTED-ADMIN restarted the frontend instance, so it sounds like we probably need to restart the other services as well

My response:

Interesting, thanks. I’m looking at the code for this now, and I have one request: could you try adding a new user, and then after that new user is created, see if all users have been added to the global org?

Him:

Ok now they’re there!

My response:

was that after restarting all pods, or after creating a user?

Him:

We only restarted the frontend instance. I suppose there’s a chance that the adding of users was just taking a while and happened after I updated the site config and checked the org.. but I think creating a new user triggered it

It looks like we're only adding users to orgs based on this config option when new users are created: https://sourcegraph.com/github.com/sourcegraph/sourcegraph@95988dbc65ccb89d9a58b111219cfb62cfe45e6f/-/blob/internal/db/users.go#L282:1

Just for fun, how I (a non-core dev) used Sourcegraph to diagnose this issue in <60s for the customer :) :

(Tagging @tsenart for triage and assignment—this is not a high priority issue, so leaving it up to you)