Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

graphqlbackend: allow siteadmins to view roles on dotcom#60992

Merged
bobheadxi merged 1 commit into
mainfrom
user-roles-dotcom-siteadmin
Mar 11, 2024
Merged

graphqlbackend: allow siteadmins to view roles on dotcom#60992
bobheadxi merged 1 commit into
mainfrom
user-roles-dotcom-siteadmin

Conversation

@bobheadxi

Copy link
Copy Markdown
Member

Currently, listing roles associated with a user on dotcom fails with the error roles are not available on sourcegraph.com. However, roles are available on dotcom and you can configure them for users (e.g. Entitler, #60795), but there's no way to check what roles a user has with the current guard.

This relaxes the restriction to allow site admins to view a user's roles.

Test plan

Test case

@bobheadxi bobheadxi requested review from a team and BolajiOlajide March 11, 2024 10:35
@cla-bot cla-bot Bot added the cla-signed label Mar 11, 2024

@BolajiOlajide BolajiOlajide left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works for the backend but I think we have a guard on the frontend if we ever want to display roles in the user profile.

I'm not sure it affects what you're working on but wanted to bring it to your attention.
https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/client/web/src/user/area/UserArea.tsx?L56%3A9-61%3A10

Asides that, the changes look good to me from a code PoV.

@bobheadxi

Copy link
Copy Markdown
Member Author

This works for the backend but I think we have a guard on the frontend if we ever want to display roles in the user profile.

I'm not sure it affects what you're working on but wanted to bring it to your attention.
https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/client/web/src/user/area/UserArea.tsx?L56%3A9-61%3A10

TIL @skip in GraphQL! But yeah, I don't think I'll change the web app - for administrative purposes in dotcom it's sufficient probably to be able to see it via API directly, and making this work in the frontend probably requires adding another check for siteadmin as well otherwise the query will fail

@bobheadxi bobheadxi merged commit da2e9cf into main Mar 11, 2024
@bobheadxi bobheadxi deleted the user-roles-dotcom-siteadmin branch March 11, 2024 14:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants