GetCurrentUser gets the current authenticated user.
(ctx context.Context, _ *connect.Request[emptypb.Empty])
| 119 | |
| 120 | // GetCurrentUser gets the current authenticated user. |
| 121 | func (s *UserService) GetCurrentUser(ctx context.Context, _ *connect.Request[emptypb.Empty]) (*connect.Response[v1pb.User], error) { |
| 122 | user, ok := GetUserFromContext(ctx) |
| 123 | if !ok || user == nil { |
| 124 | return nil, connect.NewError(connect.CodeUnauthenticated, errors.Errorf("authenticated user not found")) |
| 125 | } |
| 126 | v1User, err := convertToUser(ctx, s.iamManager, user) |
| 127 | if err != nil { |
| 128 | return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to convert user")) |
| 129 | } |
| 130 | return connect.NewResponse(v1User), nil |
| 131 | } |
| 132 | |
| 133 | // ListUsers lists all users. |
| 134 | func (s *UserService) ListUsers(ctx context.Context, request *connect.Request[v1pb.ListUsersRequest]) (*connect.Response[v1pb.ListUsersResponse], error) { |
nothing calls this directly
no test coverage detected