Inform users they need to grant extension permissions to their code host and Sourcegraph URL
Created by: lguychard
Having an onboarding flow in the browser extension that ensures necessary permissions are granted would be really helpful in making enterprise deployments successful.
The issue of permissions is twofold:
- If the extension doesn't have permissions to the Sourcegraph URL, it may fail to connect to the instance (#2228 (closed)).
- If the extension doesn't have permissions to the code host's URL, it will fail to provide any features on the code host. This is true for any code host that isn't https://github.com.
We have to work with the following limitations:
- Permissions cannot be pre-set by the admin through GSuite deployment.
- Permissions requests must stem from a user gesture.
The status quo is:
- For 1., the options page now gives the user the option to grant the extension permissions to the Sourcegraph URL if the connection fails.
- For 2., the only fix is to right-click the browser action and click "enable on this domain", which is not very discoverable.
We could benefit from an onboarding, in the form of a web_accessible page (like the options page) opened when the extension is installed (using the runtime.onOninstalled
callback). It could go like this:
- After extension installation, the onboarding page is opened.
- The user is asked to specify his sourcegraph URL, if applicable.
- If the user changes his Sourcegraph URL to something !== sourcegraph.com, we ask for permissions for that URL.
- We make sure the user is logged in to his Sourcegraph instance.
- The user is asked to specify his code hosts' URL (eg. https://ghe.private.org/).
- We ask for permissions for that URL if not already granted.
For people using the extension with sourcegraph.com (eg. just as a tool to see codecov decorations), the onboarding would be as simple as "Are you happy with the URL being sourcegraph.com? OK, looks good!".
That being said, there are ways to make this less intrusive:
- Instead of systematically opening an onboarding page when the extension is install, we add a badge to the browser action until the onboarding has been completed, and do the onboarding directly from the popup:
- Once the extension is connected to the Sourcegraph instance, we could fetch the code host URL from org settings, so that the user doesn't have to type it himself / can't mistype it.