mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-14 03:54:21 +00:00
6b1f7ba333
* fix: fix setup * fix oidc app change * fix: fix migration and proto * fix: fix granted projects * setup1 apis instead of apps * fix: add object detail with creation date * fix user phone change * add localizer to AddOIDCAppResponse * fix test * fix domain test * fix: converter Co-authored-by: Livio Amstutz <livio.a@gmail.com>
40 lines
1.0 KiB
Go
40 lines
1.0 KiB
Go
package auth
|
|
|
|
import (
|
|
"context"
|
|
|
|
object_grpc "github.com/caos/zitadel/internal/api/grpc/object"
|
|
user_grpc "github.com/caos/zitadel/internal/api/grpc/user"
|
|
auth_pb "github.com/caos/zitadel/pkg/grpc/auth"
|
|
)
|
|
|
|
func (s *Server) GetMyProfile(ctx context.Context, req *auth_pb.GetMyProfileRequest) (*auth_pb.GetMyProfileResponse, error) {
|
|
profile, err := s.repo.MyProfile(ctx)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &auth_pb.GetMyProfileResponse{
|
|
Profile: user_grpc.ProfileToPb(profile),
|
|
Details: object_grpc.ToViewDetailsPb(
|
|
profile.Sequence,
|
|
profile.CreationDate,
|
|
profile.ChangeDate,
|
|
profile.ResourceOwner,
|
|
),
|
|
}, nil
|
|
}
|
|
|
|
func (s *Server) UpdateMyProfile(ctx context.Context, req *auth_pb.UpdateMyProfileRequest) (*auth_pb.UpdateMyProfileResponse, error) {
|
|
profile, err := s.command.ChangeHumanProfile(ctx, UpdateProfileToDomain(ctx, req))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &auth_pb.UpdateMyProfileResponse{
|
|
Details: object_grpc.ChangeToDetailsPb(
|
|
profile.Sequence,
|
|
profile.ChangeDate,
|
|
profile.ResourceOwner,
|
|
),
|
|
}, nil
|
|
}
|