Commit 4617dd51 authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1895593: Delete client connection config



When deleting client connection

Change-Id: I35987e2d2bf7555c1e459aa458fa100703a72b14
Signed-off-by: default avatarRobert Lyon <robertl@catalyst.net.nz>
parent 12f719e5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -112,6 +112,7 @@ $string['emptyoauthkey'] = 'Consumer key must be supplied for OAuth1.x';
$string['emptyoauthsecret'] = 'Secret must be supplied for OAuth1.x';
$string['consumer'] = 'Consumer key';
$string['secret'] = 'Secret';
$string['deleteconnection'] = 'Delete connection object?';

// core webservices strings start here
$string['control_webservices'] = 'Switch web services on or off: ';
+8 −5
Original line number Diff line number Diff line
@@ -10,11 +10,14 @@
    }

    function removeConnection(id) {
        var r = confirm(get_string('deleteconnection', 'auth.webservice'));
        if (r == true) {
            sendjsonrequest('{{$WWWROOT}}webservice/admin/addconnection.php', {'i': '{{$institution}}', 'id': id, 'delete': 1}, 'GET', function (data) {
                if (data.rc == 'succeeded') {
                    location.reload();
                }
            });
        }
        return false;
    }

+6 −5
Original line number Diff line number Diff line
@@ -67,13 +67,14 @@ if ($delete) {
    catch (UserException $e) {
        json_reply(true, $e->getMessage());
    }

    if (!delete_records('client_connections_institution', 'id', $connectionid)) {
        $rc = 'failed';
    }
    else {
    try {
        delete_records('client_connections_config', 'connection', $connectionid);
        delete_records('client_connections_institution', 'id', $connectionid);
        $rc = 'succeeded';
    }
    catch (SQLException $e) {
        $rc = 'failed';
    }
    json_reply($rc == 'failed', array('rc' => $rc));
    exit();
}
+1 −1
Original line number Diff line number Diff line
@@ -235,7 +235,7 @@ $institutionselector = pieform(array(
// render the page
$form = webservice_client_connections($institution);

$smarty = smarty();
$smarty = smarty(array(), array(), array('auth.webservice' => array('auth.webservice' => 'deleteconnection')));
setpageicon($smarty, 'icon-project-diagram');
safe_require('auth', 'webservice');
$smarty->assign('INLINEJAVASCRIPT', $js);