mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 06:57:33 +00:00
fix: rolecascade (#434)
* fix: project role delete * fix: project role delete
This commit is contained in:
@@ -342,14 +342,15 @@ 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, len(existing.Grants))
|
grants := make([]*model.ProjectGrant, len(existing.Grants))
|
||||||
for i, grant := range existing.Grants {
|
for i, grant := range existing.Grants {
|
||||||
|
newGrant := *grant
|
||||||
roles := make([]string, 0)
|
roles := make([]string, 0)
|
||||||
for _, role := range grant.RoleKeys {
|
for _, role := range newGrant.RoleKeys {
|
||||||
if role != roleKey {
|
if role != roleKey {
|
||||||
roles = append(roles, role)
|
roles = append(roles, role)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
grant.RoleKeys = roles
|
newGrant.RoleKeys = roles
|
||||||
grants[i] = grant
|
grants[i] = &newGrant
|
||||||
}
|
}
|
||||||
return grants
|
return grants
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user