remove default value and allow empty grants

This commit is contained in:
Johannes Batzill 2023-07-18 16:54:40 -07:00
parent 478ae74e49
commit ac84328a6b
2 changed files with 10 additions and 10 deletions

View File

@ -19,8 +19,7 @@ import (
type CreateTokenInput struct { type CreateTokenInput struct {
UID string `json:"uid"` UID string `json:"uid"`
Lifetime time.Duration `json:"lifetime"` Lifetime time.Duration `json:"lifetime"`
// TODO: Added to unblock UI - Depending on product decision remove default value, or remove Grants completely. Grants enum.AccessGrant `json:"grants"`
Grants enum.AccessGrant `json:"grants" default:"9223372036854775807"`
} }
// CreateToken creates a new service account access token. // CreateToken creates a new service account access token.
@ -37,7 +36,8 @@ func (c *Controller) CreateToken(ctx context.Context, session *auth.Session,
if err = check.TokenLifetime(in.Lifetime); err != nil { if err = check.TokenLifetime(in.Lifetime); err != nil {
return nil, err return nil, err
} }
if err = check.AccessGrant(in.Grants, false); err != nil { // TODO: Added to unblock UI - Depending on product decision enforce grants, or remove Grants completely.
if err = check.AccessGrant(in.Grants, true); err != nil {
return nil, err return nil, err
} }

View File

@ -19,8 +19,7 @@ import (
type CreateTokenInput struct { type CreateTokenInput struct {
UID string `json:"uid"` UID string `json:"uid"`
Lifetime time.Duration `json:"lifetime"` Lifetime time.Duration `json:"lifetime"`
// TODO: Added to unblock UI - Depending on product decision remove default value, or remove Grants completely. Grants enum.AccessGrant `json:"grants"`
Grants enum.AccessGrant `json:"grants" default:"9223372036854775807"`
} }
/* /*
@ -44,7 +43,8 @@ func (c *Controller) CreateAccessToken(ctx context.Context, session *auth.Sessio
if err = check.TokenLifetime(in.Lifetime); err != nil { if err = check.TokenLifetime(in.Lifetime); err != nil {
return nil, err return nil, err
} }
if err = check.AccessGrant(in.Grants, false); err != nil { // TODO: Added to unblock UI - Depending on product decision enforce grants, or remove Grants completely.
if err = check.AccessGrant(in.Grants, true); err != nil {
return nil, err return nil, err
} }