Commit 49abeac5 authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1873709: Allow mahara web service api docs be public viewable



This looks to have been an oversight when originally merged

Also add an index page of the functions in the site

Change-Id: Iae3ecbc4260b2669a86a7935e7d13c7565a951f6
Signed-off-by: default avatarRobert Lyon <robertl@catalyst.net.nz>
parent fcfce450
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -138,6 +138,7 @@ $string['name'] = 'Name';
$string['component'] = 'Component';
$string['customservicegroup'] = '(Custom)';
$string['functions'] = 'Functions';
$string['functionlist'] = 'Function list';
$string['enableservice'] = 'Enable or disable the service';
$string['restricteduserswarning'] = 'Warning: There are existing token users for this service, who may be unable to access it if you enable "%s".';
$string['tokenuserswarning'] = 'Warning: There are existing token users for this service, who may be unable to access it if you disable "%s".';
+19 −0
Original line number Diff line number Diff line
{if !$dialog}
{include file='header.tpl'}
{/if}

{foreach from=$functionlist item=sectionlist key=section}
<div class="wssection">
    <h3>{$section}</h3>
    <ul>
    {foreach from=$sectionlist item=method}
    <li>
        <a class="x" href="{$WWWROOT}webservice/wsdoc.php?functionname={$method->name}">{$method->methodname}</a>
    </li>
    {/foreach}
    </ul>
</div>
{/foreach}
{if !$dialog}
{include file='footer.tpl'}
{/if}
 No newline at end of file
+30 −17
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@
 */

define('INTERNAL', 1);
define('PUBLIC', 1);
define('MENUITEM', 'configextensions/pluginadminwebservices');
define('SECTION_PAGE', 'webservice');
require(dirname(dirname(__FILE__)) . '/init.php');
@@ -36,12 +37,23 @@ if ($functionid) {
}
else if ($functionname) {
    $dbfunction = get_record('external_functions', 'name', $functionname);
}
    if (empty($dbfunction)) {
        $SESSION->add_error_msg(get_string('invalidfunction', 'auth.webservice'));
    redirect('/webservice/admin/index.php');
    }

}
if (empty($dbfunction)) {
    define('TITLE', get_string('function', 'auth.webservice') . ': ' . get_string('functionlist', 'auth.webservice'));
    $dbfunctions = get_records_array('external_functions', null, null, 'name');
    foreach ($dbfunctions as $k => $v) {
        $dbfunctionlist[$v->classname][] = $v;
    }
    $smarty = smarty();
    safe_require('auth', 'webservice');
    PluginAuthWebservice::menu_items($smarty, 'webservice');
    $smarty->assign('functionlist', $dbfunctionlist);
    $smarty->display('auth:webservice:wsdoclist.tpl');
}
else {
    define('TITLE', get_string('function', 'auth.webservice') . ': ' . $dbfunction->name);

    $fdesc = webservice_function_info($dbfunction->name);
@@ -58,6 +70,7 @@ $smarty->assign('soapactive', webservice_protocol_is_enabled('soap'));
    $smarty->assign('PAGEHEADING', get_string('wsdoc', 'auth.webservice'));
    $smarty->assign('dialog', $dialog);
    $smarty->display('auth:webservice:wsdoc.tpl');
}
die;

/**