(u *database.User, isCurrentUser bool)
| 630 | } |
| 631 | |
| 632 | func (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 | |
| 656 | func orgMemberUserToPB(m *database.OrganizationMemberUser) *adminv1.OrganizationMemberUser { |
| 657 | var attributes *structpb.Struct |
no test coverage detected