RFC 113: Implement `PermsFetcher` interface for GitHub authz provider
Created by: unknwon
Essentially, add two methods to GitHub authz provider: enterprise/cmd/frontend/internal/authz/github
An example implementation for GitLab can be found at https://github.com/sourcegraph/sourcegraph/blob/master/enterprise/cmd/frontend/internal/authz/gitlab/sudo.go
Things to note
- Return partial but valid results whenever possible.
- When fetch in user-centric:
- Use token extracted from
github.GetExternalAccountData(&userAccount.ExternalAccountData)
. - The GraphQL node ID as the
extsvc.ExternalAccountID
for results. - The API is same as what we use for
RepoPerms
today.
- Use token extracted from
- When fetch in repo-centric:
- Use the admin token configured in external service.
- The GraphQL node ID as the
extsvc.ExternalRepoID
for results. -
API example (
login
is not required, just for debugging):
{ repository(name: "sourcegraph", owner: "sourcegraph") { id collaborators(affiliation: ALL) { edges { node { id login } } pageInfo { endCursor hasNextPage } } } }
Let me know when you have any questions!