fix: remove user login must be domain check on machine users (#4065)

* fix: remove user login must be domain check on machine users

* fix: test

Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
Fabi 2022-07-28 16:33:59 +02:00 committed by GitHub
parent f610d48569
commit 8448f88f94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 32 deletions

View File

@ -16,9 +16,6 @@ func (c *Commands) AddMachine(ctx context.Context, orgID string, machine *domain
if err != nil { if err != nil {
return nil, caos_errs.ThrowPreconditionFailed(err, "COMMAND-3M9fs", "Errors.Org.DomainPolicy.NotFound") return nil, caos_errs.ThrowPreconditionFailed(err, "COMMAND-3M9fs", "Errors.Org.DomainPolicy.NotFound")
} }
if !domainPolicy.UserLoginMustBeDomain {
return nil, caos_errs.ThrowPreconditionFailed(nil, "COMMAND-6M0ds", "Errors.User.Invalid")
}
userID, err := c.idGenerator.Next() userID, err := c.idGenerator.Next()
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -76,35 +76,6 @@ func TestCommandSide_AddMachine(t *testing.T) {
err: caos_errs.IsPreconditionFailed, err: caos_errs.IsPreconditionFailed,
}, },
}, },
{
name: "org policy global, precondition error",
fields: fields{
eventstore: eventstoreExpect(
t,
expectFilter(
eventFromEventPusher(
org.NewDomainPolicyAddedEvent(context.Background(),
&user.NewAggregate("user1", "org1").Aggregate,
false,
true,
true,
),
),
),
),
},
args: args{
ctx: context.Background(),
orgID: "org1",
machine: &domain.Machine{
Username: "username",
Name: "name",
},
},
res: res{
err: caos_errs.IsPreconditionFailed,
},
},
{ {
name: "add machine, ok", name: "add machine, ok",
fields: fields{ fields: fields{