def METHOD_NAME(
        group_role_id: uuid.UUID, direction: str) -> Response:
    """Add/delete a privilege to/from a role depending on `direction`."""
    assert direction in ("ADD", "DELETE")
    def __render__():
        return redirect(url_for(
            "oauth2.group.group_role", group_role_id=group_role_id))
    def __error__(error):
        err = process_error(error)
        flash(f"{err['error']}: {err['error_description']}", "alert-danger")
        return __render__()
    def __success__(success):
        flash(success["description"], "alert-success")
        return __render__()
    try:
        form = request.form
        privilege_id = form.get("privilege_id")
        assert bool(privilege_id), "Privilege to add must be provided"
        uris = {
            "ADD": f"oauth2/group/role/{group_role_id}/privilege/add",
            "DELETE": f"oauth2/group/role/{group_role_id}/privilege/delete"
        }
        return oauth2_post(
            uris[direction],
            data={
                "group_role_id": group_role_id,
                "privilege_id": privilege_id
            }).either(__error__, __success__)
    except AssertionError as aerr:
        flash(aerr.args[0], "alert-danger")
        return redirect(url_for(
            "oauth2.group.group_role", group_role_id=group_role_id))