webservice MDL-17135 add logging to add/edit/delete service action
authorjerome mouneyrac <jerome@moodle.com>
Fri, 6 Nov 2009 08:17:09 +0000 (08:17 +0000)
committerjerome mouneyrac <jerome@moodle.com>
Fri, 6 Nov 2009 08:17:09 +0000 (08:17 +0000)
admin/webservice/service.php
lang/en_utf8/webservice.php

index 422a9b2f78c317da63e75cd5332b77ec7891e77a..63771d15e13566a9015d1bca3508d812c4f34c44 100644 (file)
@@ -57,6 +57,7 @@ if ($action == 'delete' and confirm_sesskey() and $service and empty($service->c
     $DB->delete_records('external_services_users', array('externalserviceid'=>$service->id));
     $DB->delete_records('external_services_functions', array('externalserviceid'=>$service->id));
     $DB->delete_records('external_services', array('id'=>$service->id));
+    add_to_log(1, 'webservice', 'delete', $CFG->wwwroot."/admin/settings.php?section=externalservices", get_string('deleteservice', 'webservice', $service));
     redirect($returnurl);
 }
 
@@ -74,12 +75,12 @@ if ($mform->is_cancelled()) {
 
     if (empty($data->id)) {
         $data->timecreated = mktime();
-        $DB->insert_record('external_services', $data);
-        //TODO: logging
+        $data->id = $DB->insert_record('external_services', $data);
+        add_to_log(1, 'webservice', 'add', $CFG->wwwroot."/admin/settings.php?section=externalservices", get_string('addservice', 'webservice', $data));
     } else {
         $data->timemodified = mktime();
         $DB->update_record('external_services', $data);
-        //TODO: logging
+        add_to_log(1, 'webservice', 'edit', $CFG->wwwroot."/admin/settings.php?section=externalservices", get_string('editservice', 'webservice', $data));
     }
     
     redirect($returnurl);
index e7a1ae9aac37bc6c185b5ebf0ad10f65553caa74..5d392f245d9d308b18bdcbc2f95bde028f78968a 100644 (file)
@@ -4,10 +4,13 @@ $string['accessexception'] = 'Access control exception';
 $string['addfunction'] = 'Add function';
 $string['addfunctionhelp'] = 'Select the function to add to the service.';
 $string['addrequiredcapability'] = 'Assign/Unassign the required capability';
+$string['addservice'] = 'Add a new service: $a->name (id: $a->id)';
 $string['actwebserviceshhdr'] = 'Active web service protocols';
 $string['configwebserviceplugins'] = 'For security reasons enable only protocols that are used.';
+$string['deleteservice'] = 'Delete the service: $a->name (id: $a->id)';
 $string['deleteserviceconfirm'] = 'Do you really want to delete external service \"$a\"?';
 $string['disabledwarning'] = 'All webs service protocols are disabled, the \Enable web services\" setting can be found in the \"Advanced features\" section.';
+$string['editservice'] = 'Edit the service: $a->name (id: $a->id)';
 $string['enabled'] = 'Enabled';
 $string['execute'] = 'Execute';
 $string['executewarnign'] = 'WARNING: if you press execute your database will be modified and changes can not be reverted automatically!';
@@ -26,6 +29,7 @@ $string['protocol'] = 'Protocol';
 $string['removefunction'] = 'Remove';
 $string['removefunctionconfirm'] = 'Do you really want to remove function \"$a->function\" from service \"$a->service\"?';
 $string['requiredcapability'] = 'Required capability';
+$string['selectedcapabilitydoesntexit'] = 'The currently set required capability ($a) doesn\'t exist anymore. Please change it and save the changes.';
 $string['restrictedusers'] = 'Authorised users only';
 $string['selectedcapability'] = 'Selected';
 $string['servicename'] = 'Service name';