Repository navigation
feat(computers): shared cloud computers that admins grant to members and agents - #7902
Open
benjaminshafii wants to merge 1 commit into
Open
benjaminshafii wants to merge 1 commit into
benjaminshafii wants to merge 1 commit into
Conversation
…hem to members and agents An admin can record a named cloud computer that belongs to the organization instead of to a member, and grant it to one member or one agent at a time. The access check gains a form that lets in a granted current member, with exactly an owner's rights, and nobody else. A revoke takes effect on the next check, and removing a member, archiving an agent or deleting the organization deletes the grants involved. A member's own computer can never be granted. Members and agents cannot open a shared computer yet. No machine is started and no token is made; this ships the record, the grants, the access check and the listings. The feature document lists what reaching one still needs. Everything is behind the computerGrants flag, which is off by default and cloud only. With it off the six new routes answer 404 and nothing else changes. The routes live under /v1/org/computers/shared; creating, granting and revoking need computers.create with a recent sign-in, and the lists need computers.view. The CLI gains computers create --name, grant, revoke and grants. Adds migration 0232_cloud_computer_grant: a nullable worker.shared_name with a unique index per organization, and the cloud_computer_grant table with a unique index on worker and member. Tested with ee/apps/den-api/test/api/computer-grants.api.test.ts (16 tests: flag off, wrong role, another organization's ids, personal computers never grantable, the access check, revoke, member removal, organization deletion) and the CLI tests in packages/cli/test/agents.test.ts. The access check ran only in tests with the cloud runtime replaced by stand-ins.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this about?
An admin can record a named cloud computer that belongs to the organization and grant it to members and agents one by one. Off by default behind
computerGrants.Nobody can open a shared computer yet. This PR ships the record, the grants, the access check and the listings only.
What problem does it solve?
Every cloud computer belonged to exactly one member. There was no way to say "this build machine is the organization's, and Priya and the Build helper agent may use it".
What was the situation before?
A cloud computer always had one owner, and only that owner could use it. Nothing in the data could express a computer without an owner, or a second person allowed on one.
How is this implemented?
0232_cloud_computer_grant: acloud_computer_granttable and a nullableworker.shared_name, unique per organization./v1/org/computers/sharedinee/apps/den-api/src/routes/org/computers.ts, logic inorganization-shared-computers.ts. Create, grant and revoke needcomputers.createand a recent sign-in.workers/worker-access.tsgains "this computer, for this member": yes only for a computer with a shared name and no owner, in the caller's organization, with a live grant. A member's own computer can never be granted, even with a grant row written straight into the database.openwork computers create --name,grant,revoke,grants.packages/features/src/flags/computer-grants.ts,docs/features/computer-grants/README.md.What else changed?
Release note
none
Evidence
computer-grants.api.test.ts(16 tests against MySQL, including other organizations' ids and the personal-computer refusal) and the CLI tests.