mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-02 12:22:15 +00:00
feat: remove phone (#349)
* feat: remove phone number * feat: remove phone number tests * feat: remove phone number tests * fix: regenerate protos
This commit is contained in:
@@ -125,6 +125,11 @@ var ManagementService_AuthMethods = utils_auth.MethodMapping{
|
||||
CheckParam: "",
|
||||
},
|
||||
|
||||
"/caos.zitadel.management.api.v1.ManagementService/RemoveUserPhone": utils_auth.Option{
|
||||
Permission: "user.write",
|
||||
CheckParam: "",
|
||||
},
|
||||
|
||||
"/caos.zitadel.management.api.v1.ManagementService/ResendPhoneVerificationCode": utils_auth.Option{
|
||||
Permission: "user.write",
|
||||
CheckParam: "",
|
||||
|
||||
+1285
-1239
File diff suppressed because it is too large
Load Diff
@@ -699,6 +699,33 @@ func request_ManagementService_ChangeUserPhone_0(ctx context.Context, marshaler
|
||||
|
||||
}
|
||||
|
||||
func request_ManagementService_RemoveUserPhone_0(ctx context.Context, marshaler runtime.Marshaler, client ManagementServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq UserID
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
}
|
||||
|
||||
protoReq.Id, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||
}
|
||||
|
||||
msg, err := client.RemoveUserPhone(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_ManagementService_ResendPhoneVerificationCode_0(ctx context.Context, marshaler runtime.Marshaler, client ManagementServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq UserID
|
||||
var metadata runtime.ServerMetadata
|
||||
@@ -4205,6 +4232,26 @@ func RegisterManagementServiceHandlerClient(ctx context.Context, mux *runtime.Se
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("DELETE", pattern_ManagementService_RemoveUserPhone_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_ManagementService_RemoveUserPhone_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_ManagementService_RemoveUserPhone_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_ManagementService_ResendPhoneVerificationCode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@@ -6099,6 +6146,8 @@ var (
|
||||
|
||||
pattern_ManagementService_ChangeUserPhone_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1, 2, 2}, []string{"users", "id", "phone"}, ""))
|
||||
|
||||
pattern_ManagementService_RemoveUserPhone_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1, 2, 2}, []string{"users", "id", "phone"}, ""))
|
||||
|
||||
pattern_ManagementService_ResendPhoneVerificationCode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1, 2, 2, 2, 3}, []string{"users", "id", "phone", "_resendverification"}, ""))
|
||||
|
||||
pattern_ManagementService_GetUserAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1, 2, 2}, []string{"users", "id", "address"}, ""))
|
||||
@@ -6335,6 +6384,8 @@ var (
|
||||
|
||||
forward_ManagementService_ChangeUserPhone_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_ManagementService_RemoveUserPhone_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_ManagementService_ResendPhoneVerificationCode_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_ManagementService_GetUserAddress_0 = runtime.ForwardResponseMessage
|
||||
|
||||
@@ -3195,6 +3195,28 @@
|
||||
"ManagementService"
|
||||
]
|
||||
},
|
||||
"delete": {
|
||||
"operationId": "RemoveUserPhone",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"properties": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"ManagementService"
|
||||
]
|
||||
},
|
||||
"put": {
|
||||
"operationId": "ChangeUserPhone",
|
||||
"responses": {
|
||||
|
||||
@@ -1717,6 +1717,26 @@ func (mr *MockManagementServiceClientMockRecorder) RemoveUserGrant(arg0, arg1 in
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveUserGrant", reflect.TypeOf((*MockManagementServiceClient)(nil).RemoveUserGrant), varargs...)
|
||||
}
|
||||
|
||||
// RemoveUserPhone mocks base method
|
||||
func (m *MockManagementServiceClient) RemoveUserPhone(arg0 context.Context, arg1 *grpc.UserID, arg2 ...grpc0.CallOption) (*emptypb.Empty, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0, arg1}
|
||||
for _, a := range arg2 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "RemoveUserPhone", varargs...)
|
||||
ret0, _ := ret[0].(*emptypb.Empty)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// RemoveUserPhone indicates an expected call of RemoveUserPhone
|
||||
func (mr *MockManagementServiceClientMockRecorder) RemoveUserPhone(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0, arg1}, arg2...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveUserPhone", reflect.TypeOf((*MockManagementServiceClient)(nil).RemoveUserPhone), varargs...)
|
||||
}
|
||||
|
||||
// ResendEmailVerificationMail mocks base method
|
||||
func (m *MockManagementServiceClient) ResendEmailVerificationMail(arg0 context.Context, arg1 *grpc.UserID, arg2 ...grpc0.CallOption) (*emptypb.Empty, error) {
|
||||
m.ctrl.T.Helper()
|
||||
|
||||
@@ -149,6 +149,10 @@ func (s *Server) ChangeUserPhone(ctx context.Context, request *UpdateUserPhoneRe
|
||||
return phoneFromModel(phone), nil
|
||||
}
|
||||
|
||||
func (s *Server) RemoveUserPhone(ctx context.Context, userID *UserID) (*empty.Empty, error) {
|
||||
err := s.user.RemovePhone(ctx, userID.Id)
|
||||
return &empty.Empty{}, err
|
||||
}
|
||||
func (s *Server) ResendPhoneVerificationCode(ctx context.Context, in *UserID) (*empty.Empty, error) {
|
||||
err := s.user.CreatePhoneVerificationCode(ctx, in.Id)
|
||||
return &empty.Empty{}, err
|
||||
|
||||
@@ -291,6 +291,16 @@ service ManagementService {
|
||||
};
|
||||
}
|
||||
|
||||
rpc RemoveUserPhone(UserID) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
delete: "/users/{id}/phone"
|
||||
};
|
||||
|
||||
option (caos.zitadel.utils.v1.auth_option) = {
|
||||
permission: "user.write"
|
||||
};
|
||||
}
|
||||
|
||||
rpc ResendPhoneVerificationCode(UserID) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
post: "/users/{id}/phone/_resendverification"
|
||||
|
||||
Reference in New Issue
Block a user