fix(usergrant): verify project id is equal (#319)

* fix(usergrant): verify project id is equal

* fix: delete wrong code
This commit is contained in:
Silvan 2020-07-02 08:04:43 +02:00 committed by GitHub
parent 9c07711aab
commit fcdf27c683
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -214,7 +214,11 @@ func addUserGrantValidation(resourceOwner string, grant *model.UserGrant) func(.
}
}
//TODO: rethink this function i know it's ugly.
func checkProjectConditions(resourceOwner string, grant *model.UserGrant, project *proj_es_model.Project) error {
if grant.ProjectID != project.AggregateID {
return errors.ThrowInvalidArgument(nil, "EVENT-ixlMx", "project doesn't exist")
}
if project.State == int32(proj_model.ProjectStateRemoved) {
return errors.ThrowPreconditionFailed(nil, "EVENT-Lxp0s", "project doesn't exist")
}