Fix inherited permissions being set at user level & unable to unselect existing perms

This commit is contained in:
shamoon 2023-02-20 01:27:44 -08:00
parent 73b1b942a9
commit eb4c8e1b1e

View File

@ -69,6 +69,10 @@ export class PermissionsSelectComponent
} }
writeValue(permissions: string[]): void { writeValue(permissions: string[]): void {
if (this.permissions === permissions) {
return
}
this.permissions = permissions ?? [] this.permissions = permissions ?? []
const allPerms = this._inheritedPermissions.concat(this.permissions) const allPerms = this._inheritedPermissions.concat(this.permissions)
@ -138,7 +142,10 @@ export class PermissionsSelectComponent
this.typesWithAllActions.delete(typeKey) this.typesWithAllActions.delete(typeKey)
} }
}) })
this.onChange(permissions)
this.onChange(
permissions.filter((p) => !this._inheritedPermissions.includes(p))
)
}) })
} }