fix: check if project has resourceOwner and ownerID (#8725)

# Which Problems Are Solved

There is no check that the creation of a project also has a resource
owner.

# How the Problems Are Solved

Check if resource owner and the ID of the owner are provided on command
side.

# Additional Changes

None

# Additional Context

Closes #7794
This commit is contained in:
Stefan Benz
2024-10-08 17:07:27 +02:00
committed by GitHub
parent 34195157ce
commit 911cb42d70
2 changed files with 58 additions and 0 deletions

View File

@@ -52,6 +52,52 @@ func TestCommandSide_AddProject(t *testing.T) {
err: zerrors.IsErrorInvalidArgument,
},
},
{
name: "org with project owner, resourceowner empty",
fields: fields{
eventstore: eventstoreExpect(
t,
),
},
args: args{
ctx: context.Background(),
project: &domain.Project{
Name: "project",
ProjectRoleAssertion: true,
ProjectRoleCheck: true,
HasProjectCheck: true,
PrivateLabelingSetting: domain.PrivateLabelingSettingAllowLoginUserResourceOwnerPolicy,
},
resourceOwner: "",
ownerID: "user1",
},
res: res{
err: zerrors.IsErrorInvalidArgument,
},
},
{
name: "org with project owner, ownerID empty",
fields: fields{
eventstore: eventstoreExpect(
t,
),
},
args: args{
ctx: context.Background(),
project: &domain.Project{
Name: "project",
ProjectRoleAssertion: true,
ProjectRoleCheck: true,
HasProjectCheck: true,
PrivateLabelingSetting: domain.PrivateLabelingSettingAllowLoginUserResourceOwnerPolicy,
},
resourceOwner: "org1",
ownerID: "",
},
res: res{
err: zerrors.IsErrorInvalidArgument,
},
},
{
name: "org with project owner, error already exists",
fields: fields{