fix: rolecascade (#434)

* fix: project role delete

* fix: project role delete
This commit is contained in:
Fabi
2020-07-09 17:28:14 +02:00
committed by GitHub
parent 66376f9213
commit 5add7eae6d

View File

@@ -342,14 +342,15 @@ func (es *ProjectEventstore) PrepareRemoveProjectRole(ctx context.Context, role
func (es *ProjectEventstore) RemoveRoleFromGrants(existing *model.Project, roleKey string) []*model.ProjectGrant {
grants := make([]*model.ProjectGrant, len(existing.Grants))
for i, grant := range existing.Grants {
newGrant := *grant
roles := make([]string, 0)
for _, role := range grant.RoleKeys {
for _, role := range newGrant.RoleKeys {
if role != roleKey {
roles = append(roles, role)
}
}
grant.RoleKeys = roles
grants[i] = grant
newGrant.RoleKeys = roles
grants[i] = &newGrant
}
return grants
}