mirror of
https://github.com/zitadel/zitadel.git
synced 2025-02-28 16:57:23 +00:00
fix: return userID on org setup (#3623)
This commit is contained in:
parent
f70990709b
commit
734cfdddae
@ -57,7 +57,7 @@ func (s *Server) SetUpOrg(ctx context.Context, req *admin_pb.SetUpOrgRequest) (*
|
||||
org := setUpOrgOrgToDomain(req.Org) //TODO: handle domain
|
||||
_ = org
|
||||
|
||||
objectDetails, err := s.command.SetUpOrg(ctx, &command.OrgSetup{
|
||||
userID, objectDetails, err := s.command.SetUpOrg(ctx, &command.OrgSetup{
|
||||
Name: req.Org.Name,
|
||||
Human: human,
|
||||
})
|
||||
@ -66,6 +66,8 @@ func (s *Server) SetUpOrg(ctx context.Context, req *admin_pb.SetUpOrgRequest) (*
|
||||
}
|
||||
return &admin_pb.SetUpOrgResponse{
|
||||
Details: object.DomainToAddDetailsPb(objectDetails),
|
||||
OrgId: objectDetails.ResourceOwner,
|
||||
UserId: userID,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ func (l *Login) handleRegisterOrgCheck(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
_ = userIDs //TODO: handle userIDs
|
||||
_, err = l.command.SetUpOrg(ctx, data.toCommandOrg())
|
||||
_, _, err = l.command.SetUpOrg(ctx, data.toCommandOrg())
|
||||
if err != nil {
|
||||
l.renderRegisterOrg(w, r, authRequest, data, err)
|
||||
return
|
||||
|
@ -21,15 +21,15 @@ type OrgSetup struct {
|
||||
Human AddHuman
|
||||
}
|
||||
|
||||
func (c *Commands) SetUpOrg(ctx context.Context, o *OrgSetup) (*domain.ObjectDetails, error) {
|
||||
func (c *Commands) SetUpOrg(ctx context.Context, o *OrgSetup) (string, *domain.ObjectDetails, error) {
|
||||
orgID, err := id.SonyFlakeGenerator.Next()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return "", nil, err
|
||||
}
|
||||
|
||||
userID, err := id.SonyFlakeGenerator.Next()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return "", nil, err
|
||||
}
|
||||
|
||||
orgAgg := org.NewAggregate(orgID)
|
||||
@ -41,14 +41,14 @@ func (c *Commands) SetUpOrg(ctx context.Context, o *OrgSetup) (*domain.ObjectDet
|
||||
c.AddOrgMemberCommand(orgAgg, userID, domain.RoleOrgOwner),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return "", nil, err
|
||||
}
|
||||
|
||||
events, err := c.eventstore.Push(ctx, cmds...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return "", nil, err
|
||||
}
|
||||
return &domain.ObjectDetails{
|
||||
return userID, &domain.ObjectDetails{
|
||||
Sequence: events[len(events)-1].Sequence(),
|
||||
EventDate: events[len(events)-1].CreationDate(),
|
||||
ResourceOwner: orgID,
|
||||
|
Loading…
x
Reference in New Issue
Block a user