-
Notifications
You must be signed in to change notification settings - Fork 42
feat(api-token): add instance admin token #2657
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Sylwester Piskozub <[email protected]>
Signed-off-by: Sylwester Piskozub <[email protected]>
Signed-off-by: Sylwester Piskozub <[email protected]>
Signed-off-by: Sylwester Piskozub <[email protected]>
Signed-off-by: Sylwester Piskozub <[email protected]>
Signed-off-by: Sylwester Piskozub <[email protected]>
| ALTER TABLE "api_tokens" ALTER COLUMN "organization_id" DROP NOT NULL; | ||
|
|
||
| -- Create index "apitoken_name" to table: "api_tokens" | ||
| CREATE UNIQUE INDEX "apitoken_name" ON "api_tokens" ("name") WHERE ((revoked_at IS NULL) AND (organization_id IS NULL)); |
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.
Does this mean that now you can have an API token with the same name in the same org?
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.
No, you can have an instance admin API token with the same name if the other one with the same name was revoked, the same way as org API tokens in here
chainloop/app/controlplane/pkg/data/ent/schema/apitoken.go
Lines 68 to 69 in 4dc6b0a
| index.Fields("name").Edges("organization").Unique().Annotations( | |
| entsql.IndexWhere("revoked_at IS NULL AND project_id IS NULL"), |
Signed-off-by: Sylwester Piskozub <[email protected]>
Summary
This PR adds support for instance admin tokens to existing api token logic
Changes