fix: project role (#428)

This commit is contained in:
Fabi
2020-07-09 16:02:00 +02:00
committed by GitHub
parent 6128c0c672
commit 49a3339425

View File

@@ -343,11 +343,8 @@ func (es *ProjectEventstore) PrepareRemoveProjectRole(ctx context.Context, role
func (es *ProjectEventstore) RemoveRoleFromGrants(existing *model.Project, roleKey string) []*model.ProjectGrant { func (es *ProjectEventstore) RemoveRoleFromGrants(existing *model.Project, roleKey string) []*model.ProjectGrant {
grants := make([]*model.ProjectGrant, 0) grants := make([]*model.ProjectGrant, 0)
for _, grant := range existing.Grants { for _, grant := range existing.Grants {
for i, role := range grant.RoleKeys { for _, role := range grant.RoleKeys {
if role == roleKey { if role != roleKey {
grant.RoleKeys[i] = grant.RoleKeys[len(grant.RoleKeys)-1]
grant.RoleKeys[len(grant.RoleKeys)-1] = ""
grant.RoleKeys = grant.RoleKeys[:len(grant.RoleKeys)-1]
grants = append(grants, grant) grants = append(grants, grant)
} }
} }