mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 19:14:23 +00:00
5d4351f47c
* feat(console): personal access tokens (#3185) * token dialog, pat module * pat components * i18n, warn dialog, add token dialog * cleanup dialog * clipboard * return creationDate of pat * i18n Co-authored-by: Livio Amstutz <livio.a@gmail.com> * fix(cockroach): update to 21.2.5 (#3189) Co-authored-by: Max Peintner <max@caos.ch> Co-authored-by: Silvan <silvan.reusser@gmail.com>
26 lines
814 B
Go
26 lines
814 B
Go
package user
|
|
|
|
import (
|
|
"google.golang.org/protobuf/types/known/timestamppb"
|
|
|
|
"github.com/caos/zitadel/internal/api/grpc/object"
|
|
"github.com/caos/zitadel/internal/query"
|
|
"github.com/caos/zitadel/pkg/grpc/user"
|
|
)
|
|
|
|
func PersonalAccessTokensToPb(tokens []*query.PersonalAccessToken) []*user.PersonalAccessToken {
|
|
t := make([]*user.PersonalAccessToken, len(tokens))
|
|
for i, token := range tokens {
|
|
t[i] = PersonalAccessTokenToPb(token)
|
|
}
|
|
return t
|
|
}
|
|
func PersonalAccessTokenToPb(token *query.PersonalAccessToken) *user.PersonalAccessToken {
|
|
return &user.PersonalAccessToken{
|
|
Id: token.ID,
|
|
Details: object.ToViewDetailsPb(token.Sequence, token.CreationDate, token.ChangeDate, token.ResourceOwner),
|
|
ExpirationDate: timestamppb.New(token.Expiration),
|
|
Scopes: token.Scopes,
|
|
}
|
|
}
|