Example #1
0
    if (isset($_REQUEST['permission_role_id'])) {
        $conductor = new RoleController();
        $response = $conductor->dismissRole($_REQUEST['permission_role_id']);
        if ($response[P_STATUS] == STATUS_OK) {
            echo JsonResponse::message(STATUS_OK, 'Role assignment removed successfully!');
            exit;
        } else {
            //die(var_dump($response));
            echo JsonResponse::error($response[P_MESSAGE]);
            exit;
        }
    } else {
        echo JsonResponse::error('Incomplete request parameters!');
        exit;
    }
} elseif ($intent == "updatePermission") {
    if (isset($_REQUEST['permission_role_id'], $_REQUEST['staff_permission_id'])) {
        $conductor = new RoleController();
        $response = $conductor->updatePermission($_REQUEST['permission_role_id'], $_REQUEST['staff_permission_id']);
        if ($response[P_STATUS] == STATUS_OK) {
            echo JsonResponse::message(STATUS_OK, 'Permission update successful!');
            exit;
        } else {
            echo JsonResponse::error($response[P_MESSAGE]);
            exit;
        }
    } else {
        echo JsonResponse::error('Incomplete request parameters!');
        exit;
    }
}