mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:07:31 +00:00
feat(api): add organisation service (#6340)
* setup org with multiple admins * tests * add missing proto * remove machine users (for now) * update tests with idp case * fix package * organisation -> organization * fix test
This commit is contained in:
@@ -72,18 +72,26 @@ func (s *Server) SetUpOrg(ctx context.Context, req *admin_pb.SetUpOrgRequest) (*
|
||||
}
|
||||
human := setUpOrgHumanToCommand(req.User.(*admin_pb.SetUpOrgRequest_Human_).Human) //TODO: handle machine
|
||||
|
||||
userID, objectDetails, err := s.command.SetUpOrg(ctx, &command.OrgSetup{
|
||||
createdOrg, err := s.command.SetUpOrg(ctx, &command.OrgSetup{
|
||||
Name: req.Org.Name,
|
||||
CustomDomain: req.Org.Domain,
|
||||
Human: human,
|
||||
Roles: req.Roles,
|
||||
}, userIDs...)
|
||||
Admins: []*command.OrgSetupAdmin{
|
||||
{
|
||||
Human: human,
|
||||
Roles: req.Roles,
|
||||
},
|
||||
},
|
||||
}, true, userIDs...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var userID string
|
||||
if len(createdOrg.CreatedAdmins) == 1 {
|
||||
userID = createdOrg.CreatedAdmins[0].ID
|
||||
}
|
||||
return &admin_pb.SetUpOrgResponse{
|
||||
Details: object.DomainToAddDetailsPb(objectDetails),
|
||||
OrgId: objectDetails.ResourceOwner,
|
||||
Details: object.DomainToAddDetailsPb(createdOrg.ObjectDetails),
|
||||
OrgId: createdOrg.ObjectDetails.ResourceOwner,
|
||||
UserId: userID,
|
||||
}, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user