mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-15 12:27:59 +00:00
fa9f581d56
* chore: move to new org * logging * fix: org rename caos -> zitadel Co-authored-by: adlerhurst <silvan.reusser@gmail.com>
26 lines
823 B
Go
26 lines
823 B
Go
package user
|
|
|
|
import (
|
|
"google.golang.org/protobuf/types/known/timestamppb"
|
|
|
|
"github.com/zitadel/zitadel/internal/api/grpc/object"
|
|
"github.com/zitadel/zitadel/internal/query"
|
|
"github.com/zitadel/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,
|
|
}
|
|
}
|