feat: backend DB model for fine-grained repo access tokens

This commit is contained in:
Mathieu Fenniak
2026-02-27 17:17:29 +01:00
committed by Mathieu Fenniak
parent 2d4a3e5658
commit a1eff6f0dc
13 changed files with 166 additions and 1 deletions
+9 -1
View File
@@ -205,7 +205,15 @@ func runCreateUser(ctx context.Context, c *cli.Command) error {
// create the access token
if accessTokenScope != "" {
t := &auth_model.AccessToken{Name: accessTokenName, UID: u.ID, Scope: accessTokenScope}
t := &auth_model.AccessToken{
Name: accessTokenName,
UID: u.ID,
Scope: accessTokenScope,
// maintain legacy behaviour until new CLI options are added -- token has access to all resources, is not
// fine-grained
ResourceAllRepos: true,
}
if err := auth_model.NewAccessToken(ctx, t); err != nil {
return err
}
+4
View File
@@ -86,6 +86,10 @@ func runGenerateAccessToken(ctx context.Context, c *cli.Command) error {
}
t.Scope = accessTokenScope
// maintain legacy behaviour until new CLI options are added -- token has access to all resources, is not
// fine-grained
t.ResourceAllRepos = true
// create the token
if err := auth_model.NewAccessToken(ctx, t); err != nil {
return err