mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 20:57:31 +00:00
feat: specify org member roles in org setup (#3950)
This commit is contained in:
@@ -19,6 +19,7 @@ type OrgSetup struct {
|
||||
Name string
|
||||
CustomDomain string
|
||||
Human AddHuman
|
||||
Roles []string
|
||||
}
|
||||
|
||||
func (c *Commands) SetUpOrg(ctx context.Context, o *OrgSetup, userIDs ...string) (string, *domain.ObjectDetails, error) {
|
||||
@@ -35,10 +36,15 @@ func (c *Commands) SetUpOrg(ctx context.Context, o *OrgSetup, userIDs ...string)
|
||||
orgAgg := org.NewAggregate(orgID)
|
||||
userAgg := user_repo.NewAggregate(userID, orgID)
|
||||
|
||||
roles := []string{domain.RoleOrgOwner}
|
||||
if len(o.Roles) > 0 {
|
||||
roles = o.Roles
|
||||
}
|
||||
|
||||
validations := []preparation.Validation{
|
||||
AddOrgCommand(ctx, orgAgg, o.Name, userIDs...),
|
||||
AddHumanCommand(userAgg, &o.Human, c.userPasswordAlg, c.userEncryption),
|
||||
c.AddOrgMemberCommand(orgAgg, userID, domain.RoleOrgOwner),
|
||||
c.AddOrgMemberCommand(orgAgg, userID, roles...),
|
||||
}
|
||||
if o.CustomDomain != "" {
|
||||
validations = append(validations, AddOrgDomain(orgAgg, o.CustomDomain))
|
||||
|
Reference in New Issue
Block a user