mirror of
https://github.com/harness/drone.git
synced 2025-05-07 04:51:44 +08:00
remove default value and allow empty grants
This commit is contained in:
parent
478ae74e49
commit
ac84328a6b
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user