mirror of
https://github.com/zitadel/zitadel.git
synced 2025-02-28 22:37:24 +00:00
feat: specify org member roles in org setup (#3950)
This commit is contained in:
parent
68f0114671
commit
fa4bc47b3e
@ -3642,6 +3642,7 @@ this is en empty request
|
|||||||
| ----- | ---- | ----------- | ----------- |
|
| ----- | ---- | ----------- | ----------- |
|
||||||
| org | SetUpOrgRequest.Org | - | message.required: true<br /> |
|
| org | SetUpOrgRequest.Org | - | message.required: true<br /> |
|
||||||
| [**oneof**](https://developers.google.com/protocol-buffers/docs/proto3#oneof) user.human | SetUpOrgRequest.Human | oneof field for the user managing the organisation | |
|
| [**oneof**](https://developers.google.com/protocol-buffers/docs/proto3#oneof) user.human | SetUpOrgRequest.Human | oneof field for the user managing the organisation | |
|
||||||
|
| roles | repeated string | specify Org Member Roles for the provided user (default is ORG_OWNER if roles are empty) | |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,6 +66,7 @@ func (s *Server) SetUpOrg(ctx context.Context, req *admin_pb.SetUpOrgRequest) (*
|
|||||||
Name: req.Org.Name,
|
Name: req.Org.Name,
|
||||||
CustomDomain: req.Org.Domain,
|
CustomDomain: req.Org.Domain,
|
||||||
Human: human,
|
Human: human,
|
||||||
|
Roles: req.Roles,
|
||||||
}, userIDs...)
|
}, userIDs...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -19,6 +19,7 @@ type OrgSetup struct {
|
|||||||
Name string
|
Name string
|
||||||
CustomDomain string
|
CustomDomain string
|
||||||
Human AddHuman
|
Human AddHuman
|
||||||
|
Roles []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Commands) SetUpOrg(ctx context.Context, o *OrgSetup, userIDs ...string) (string, *domain.ObjectDetails, error) {
|
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)
|
orgAgg := org.NewAggregate(orgID)
|
||||||
userAgg := user_repo.NewAggregate(userID, orgID)
|
userAgg := user_repo.NewAggregate(userID, orgID)
|
||||||
|
|
||||||
|
roles := []string{domain.RoleOrgOwner}
|
||||||
|
if len(o.Roles) > 0 {
|
||||||
|
roles = o.Roles
|
||||||
|
}
|
||||||
|
|
||||||
validations := []preparation.Validation{
|
validations := []preparation.Validation{
|
||||||
AddOrgCommand(ctx, orgAgg, o.Name, userIDs...),
|
AddOrgCommand(ctx, orgAgg, o.Name, userIDs...),
|
||||||
AddHumanCommand(userAgg, &o.Human, c.userPasswordAlg, c.userEncryption),
|
AddHumanCommand(userAgg, &o.Human, c.userPasswordAlg, c.userEncryption),
|
||||||
c.AddOrgMemberCommand(orgAgg, userID, domain.RoleOrgOwner),
|
c.AddOrgMemberCommand(orgAgg, userID, roles...),
|
||||||
}
|
}
|
||||||
if o.CustomDomain != "" {
|
if o.CustomDomain != "" {
|
||||||
validations = append(validations, AddOrgDomain(orgAgg, o.CustomDomain))
|
validations = append(validations, AddOrgDomain(orgAgg, o.CustomDomain))
|
||||||
|
@ -3099,6 +3099,8 @@ message SetUpOrgRequest {
|
|||||||
// oneof field for the user managing the organisation
|
// oneof field for the user managing the organisation
|
||||||
Human human = 2;
|
Human human = 2;
|
||||||
}
|
}
|
||||||
|
// specify Org Member Roles for the provided user (default is ORG_OWNER if roles are empty)
|
||||||
|
repeated string roles = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SetUpOrgResponse {
|
message SetUpOrgResponse {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user