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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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 {
grants := make([]*model.ProjectGrant, 0)
for _, grant := range existing.Grants {
for i, role := range grant.RoleKeys {
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]
for _, role := range grant.RoleKeys {
if role != roleKey {
grants = append(grants, grant)
}
}