MCPcopy Index your code
hub / github.com/rilldata/rill / userToPB

Method userToPB

admin/server/users.go:632–654  ·  view source on GitHub ↗
(u *database.User, isCurrentUser bool)

Source from the content-addressed store, hash-verified

630}
631
632func (s *Server) userToPB(u *database.User, isCurrentUser bool) *adminv1.User {
633 // Compute a HMAC-SHA256 hash of the email if Pylon identity verification is configured.
634 var pylonEmailHash string
635 if isCurrentUser && len(s.opts.PylonIdentitySecret) != 0 {
636 h := hmac.New(sha256.New, s.opts.PylonIdentitySecret)
637 h.Write([]byte(u.Email))
638 pylonEmailHash = hex.EncodeToString(h.Sum(nil))
639 }
640
641 return &adminv1.User{
642 Id: u.ID,
643 Email: u.Email,
644 DisplayName: u.DisplayName,
645 PhotoUrl: u.PhotoURL,
646 Quotas: &adminv1.UserQuotas{
647 SingleuserOrgs: int32(u.QuotaSingleuserOrgs),
648 TrialOrgs: int32(u.QuotaTrialOrgs),
649 },
650 PylonEmailHash: pylonEmailHash,
651 CreatedOn: timestamppb.New(u.CreatedOn),
652 UpdatedOn: timestamppb.New(u.UpdatedOn),
653 }
654}
655
656func orgMemberUserToPB(m *database.OrganizationMemberUser) *adminv1.OrganizationMemberUser {
657 var attributes *structpb.Struct

Callers 7

ListSuperusersMethod · 0.95
SearchUsersMethod · 0.95
GetCurrentUserMethod · 0.95
SudoGetResourceMethod · 0.95
GetUserMethod · 0.95
SudoUpdateUserQuotasMethod · 0.95
SearchProjectUsersMethod · 0.95

Calls 1

WriteMethod · 0.45

Tested by

no test coverage detected