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

rbac: add dotcom-only roles and productsubscription roles#60795

Merged
bobheadxi merged 8 commits into
mainfrom
rbac-add-productsubscription-accounts
Mar 11, 2024
Merged

rbac: add dotcom-only roles and productsubscription roles#60795
bobheadxi merged 8 commits into
mainfrom
rbac-add-productsubscription-accounts

Conversation

@bobheadxi

@bobheadxi bobheadxi commented Feb 29, 2024

Copy link
Copy Markdown
Member

Adds productsubscription RBAC roles (read and write), with the intent of replacing "cody gateway feature flag service account": https://github.com/sourcegraph/sourcegraph/pull/60796

This could be used with Security team's "Entitler" service to help CEs manage subscriptions and licenses, at least until RFC 885

Test plan

CI tests - the real fun is in https://github.com/sourcegraph/sourcegraph/pull/60796

@cla-bot cla-bot Bot added the cla-signed label Feb 29, 2024

bobheadxi commented Feb 29, 2024

Copy link
Copy Markdown
Member Author

@bobheadxi bobheadxi requested review from a team and BolajiOlajide February 29, 2024 12:31
@bobheadxi bobheadxi force-pushed the rbac-add-productsubscription-accounts branch 2 times, most recently from 4bfe7f4 to d398418 Compare February 29, 2024 12:39

@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.

LGTM!

@bobheadxi bobheadxi marked this pull request as ready for review February 29, 2024 13:16
@bobheadxi bobheadxi requested a review from rafax February 29, 2024 13:16
@bobheadxi bobheadxi changed the title rbac: add dotcom-only coles and productsubscription roles rbac: add dotcom-only roles and productsubscription roles Feb 29, 2024
@bobheadxi bobheadxi force-pushed the rbac-add-productsubscription-accounts branch from 19ba930 to 93561ac Compare March 4, 2024 22:35
@bobheadxi bobheadxi requested a review from a team March 4, 2024 23:49

@eseliger eseliger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we agree on the naming for the role here, so that I can make https://github.com/sourcegraph/sourcegraph/pull/60014 stack on top of this?

The goal of that PR is to decouple license mgmt from site admin for UI access, but it seems similar enough to what you're doing here :)

@bobheadxi

Copy link
Copy Markdown
Member Author

The goal of that PR is to decouple license mgmt from site admin for UI access, but it seems similar enough to what you're doing here :)

I would vote for "product subscriptions" and write == "can manage licenses". I think I'd like to make sure we help people remember that subscriptions as an entity exists, especially with longer-lived "subscription" traits like CG rate limits. WDYT?

@eseliger

eseliger commented Mar 5, 2024

Copy link
Copy Markdown
Member

Makes sense to me, resembles the entity name as well. Thanks for entertaining me :)

@bobheadxi bobheadxi merged commit 55a5ece into main Mar 11, 2024
@bobheadxi bobheadxi deleted the rbac-add-productsubscription-accounts branch March 11, 2024 07:01
bobheadxi added a commit that referenced this pull request Mar 11, 2024
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 referenced this pull request Mar 12, 2024
…lags (#60796)

Removes the feature flag service account stuff, replacing it with "real RBAC" on permissions introduced in https://github.com/sourcegraph/sourcegraph/pull/60795. Cody Gateway SAs will need to use roles with these permissions.

This change does **not** migrate all product-subscriptions-related CRUD to check for the new roles - it only updates the helper used by Cody Gateway related functionality. This _could_ be used with Security team's "Entitler" service to help CEs manage subscriptions and licenses if we expand the RBAC checks, at least until [RFC 885](https://docs.google.com/document/d/1tiaW1IVKm_YSSYhH-z7Q8sv4HSO_YJ_Uu6eYDjX7uU4/edit#heading=h.tdaxc5h34u7q), which is still some time away.

The new roles have been rolled out: https://github.com/sourcegraph/sourcegraph/pull/60796#issuecomment-1989842548
bobheadxi referenced this pull request Apr 15, 2024
…otcom-mode (#61893)

See https://sourcegraph.slack.com/archives/C06TEEJLAET/p1712838707915619 (INC-292) - this should have been included as part of https://github.com/sourcegraph/sourcegraph/pull/60795

## Test plan

New integration test on `TestUpdatePermissions` for dotcom scenario to assert user perms in dotcom mode.
jtibshirani referenced this pull request Apr 15, 2024
…otcom-mode (#61893)

See https://sourcegraph.slack.com/archives/C06TEEJLAET/p1712838707915619 (INC-292) - this should have been included as part of https://github.com/sourcegraph/sourcegraph/pull/60795

## Test plan

New integration test on `TestUpdatePermissions` for dotcom scenario to assert user perms in dotcom mode.
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.

6 participants