-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[papi] add api to allow organization owner to create a temporary token #19324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b5e96c5 to
66f72f5
Compare
| export class AdminUserAddAdminRole1705591447620 implements MigrationInterface { | ||
| public async up(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query( | ||
| `UPDATE d_b_user SET rolesOrPermissions = '["admin"]' WHERE id = '${BUILTIN_INSTLLATION_ADMIN_USER_ID}'`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to add this role back? It looks like FGA doesn't care given this code in authorizer.ts:
export function createInitializingAuthorizer(spiceDbAuthorizer: SpiceDBAuthorizer): Authorizer {
const target = new Authorizer(spiceDbAuthorizer);
const initialized = (async () => {
await target.addInstallationAdminRole(BUILTIN_INSTLLATION_ADMIN_USER_ID);
await target.addUser(BUILTIN_INSTLLATION_ADMIN_USER_ID);
})().catch((err) => log.error("Failed to initialize authorizer", err));
return new Proxy(target, {
get(target, propKey, receiver) {
const originalMethod = target[propKey as keyof typeof target];
if (typeof originalMethod === "function") {
return async function (...args: any[]) {
await initialized;
return (originalMethod as any).apply(target, args);
};
} else {
return originalMethod;
}
},
});
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
installation#admin will be removed by regular job because it doesn't have role: admin in database
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, ok that gets executed when ever we bump the version. 👍
3e509a9 to
d286edd
Compare

Description
Related Issue(s)
Fixes EXP-1084, EXP-1085
How to test
Without OIDC, test script mentioned below should failed. Since there's no organization owned users even you have Feature Flag enabled.
gitpod/test/tests/smoke-test/papi_create_temp_token_test.go
Lines 22 to 33 in 9c645b1
Create an OIDC preview env youself
Documentation
Preview status
gitpod:summary
Build Options
Build
Run the build with werft instead of GHA
Run Leeway with
--dont-testPublish
Installer
Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
If enabled this will build
install/previewIf enabled this will create the environment on GCE infra
Saves cost. Untick this only if you're really sure you need a non-preemtible machine.
Valid options are
all,workspace,webapp,ide,jetbrains,vscode,ssh. If enabled,with-previewandwith-large-vmwill be enabled./hold