INNER CODE UNIT · JavaScript
handleRemove
infrahq/infra · ui/pages/destinations/[id]/index.js:185
function handleRemove(resource) {
const deleteGrantIdList = grantsList
.filter(g => g.resource === resource)
.filter(g => g.user === grant.user)
.filter(g => g.group === grant.group)
.map(g => g.id)
onRemove(deleteGrantIdList)
}
function handleUpdate(newPrivilege, selectedPrivilege, resource) {
// update to add roles
if (newPrivilege.length > selectedPrivilege.length) {
const newRole = newPrivilege.filter(x => !selectedPrivilege.includes(x))
onUpdate(newRole, resource)
} else {
// update to delete roles
const removeRoles = selectedPrivilege.filter(