Commit 9345d3e5 authored by Aaron Wells's avatar Aaron Wells

Bug 1620879: Add page for non-admin users to manager app tokens

behatnotneeded: Test to come later

Change-Id: I2663d376f6bc50d7195d6d26d65206a47385e21c
parent 15334434
......@@ -58,7 +58,7 @@
<FIELD NAME="token" TYPE="char" LENGTH="128" NOTNULL="true" SEQUENCE="false" COMMENT="security token, aka private access key"/>
<FIELD NAME="tokentype" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="type of token: 0=permanent, no session; 1=linked to current browser session via sid; 2=permanent, with emulated session"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" COMMENT="owner of the token"/>
<FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="true"/>
<FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="false"/>
<FIELD NAME="externalserviceid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false"/>
<FIELD NAME="sid" TYPE="char" LENGTH="128" NOTNULL="false" SEQUENCE="false" COMMENT="link to browser or emulated session"/>
<FIELD NAME="creatorid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="1" SEQUENCE="false" COMMENT="user id of the token creator (useful to know when the administrator created a token and so display the token to a specific administrator)"/>
......@@ -175,7 +175,7 @@
<FIELD NAME="timelogged" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" COMMENT="usr ref"/>
<FIELD NAME="externalserviceid" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false"/>
<FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="true"/>
<FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="false"/>
<FIELD NAME="protocol" TYPE="char" LENGTH="10" NOTNULL="true"/>
<FIELD NAME="auth" TYPE="char" LENGTH="10" NOTNULL="true"/>
<FIELD NAME="functionname" TYPE="char" LENGTH="200" NOTNULL="false" SEQUENCE="false"/>
......
......@@ -564,6 +564,20 @@ function xmldb_auth_webservice_upgrade($oldversion=0) {
add_field($table, $field);
}
if ($oldversion < 2016101100) {
log_debug('Make external_tokens.institution nullable');
$table = new XMLDBTable('external_tokens');
$field = new XMLDBField('institution');
$field->setAttributes(XMLDB_TYPE_CHAR, 255, null, null);
change_field_notnull($table, $field, false);
log_debug('Allow null institution in external_services_logs');
$table = new XMLDBTable('external_services_logs');
$field = new XMLDBField('institution');
$field->setAttributes(XMLDB_TYPE_CHAR, 255);
change_field_notnull($table, $field, false);
}
// sweep for webservice updates everytime
$status = external_reload_webservices();
......
......@@ -12,7 +12,7 @@
defined('INTERNAL') || die();
$config = new stdClass();
$config->version = 2016090700;
$config->release = '2.0.0';
$config->version = 2016101100;
$config->release = '2.0.1';
$config->requires_config = 0;
$config->requires_parent = 0;
This diff is collapsed.
......@@ -24,4 +24,17 @@ $string['noticenotenabled'] = 'The Mahara mobile apps API is <b>not</b> currentl
$string['notreadylabel'] = 'Not ready';
$string['readylabel'] = 'Ready';
$string['restprotocolenabled'] = 'REST protocol enabled';
$string['webserviceproviderenabled'] = 'Incoming web service requests allowed';
\ No newline at end of file
$string['webserviceproviderenabled'] = 'Incoming web service requests allowed';
// User management of webservice access tokens
$string['mytokensmenutitle'] = 'Apps';
$string['mytokenspagetitle'] = 'Applications';
$string['mytokenspagedesc'] = 'These applications can access your Mahara account.';
$string['nopersonaltokens'] = 'You have not granted access to any applications.';
$string['clientinfo'] = 'App';
$string['token'] = 'Access Token';
$string['tokencreated'] = 'Created';
$string['tokenmanuallycreated'] = 'Manually created';
$string['clientnotspecified'] = '(Unknown)';
$string['generateusertoken'] = 'Generate an app access token';
$string['appaccessrevoked'] = 'Access revoked';
\ No newline at end of file
......@@ -143,5 +143,21 @@ class PluginModuleMobileapi extends PluginModule {
return true;
}
public static function right_nav_menu_items() {
if (PluginModuleMobileapi::is_service_ready()) {
return array(
'settings/webservice' => array(
'path' => 'settings/webservice',
'url' => 'module/mobileapi/apps.php',
'title' => get_string('mytokensmenutitle', 'module.mobileapi'),
'weight' => 50,
'iconclass' => 'flag'
),
);
}
else {
return array();
}
}
}
......@@ -476,6 +476,8 @@ function webservice_provider_protocols_submit(Pieform $form, $values) {
$enabled = $values['enabled'] ? 0 : 1;
$proto = $values['protocol'];
set_config('webservice_provider_'.$proto.'_enabled', $enabled);
// Show/hide the account settings webservice tokens page
clear_menu_cache();
if (param_boolean('ajax')) {
exit;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment