Commit 34226901 authored by Aaron Wells's avatar Aaron Wells Committed by Gerrit Code Review

Merge changes Ic5b8fa93,Id3327939,Ic4292676,Iad1d39a1,I398479c3,Ib5dea8c9

* changes:
  Change webservice config to not have nested Pieforms (Bug #1397128)
  Fix data in service group on creation
  Restricting the institution get members (Bug 1393530)
  Handling webservices validate_password better (Bug 1393530)
  Tidying up the initial code to mahara standards (Bug #1393530)
  Adding the webservices plugin (Bug 1393530)
parents 2649e660 e8f546e7
......@@ -231,7 +231,7 @@ class AuthInternal extends Auth {
* @param string $salt The salt we have.
* @returns int 0 means not validated, 1 means validated, 2 means validated but needs updating
*/
private function validate_password($theysent, $wehave, $salt) {
protected function validate_password($theysent, $wehave, $salt) {
$this->must_be_ready();
if ($salt == '*') {
......
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="lib/db" VERSION="20060926" COMMENT="XMLDB file for Mahara files plugin tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
<TABLES>
<TABLE NAME="external_services" COMMENT="built in and custom external services">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="200" NOTNULL="true" SEQUENCE="false" PREVIOUS="id" NEXT="enabled"/>
<FIELD NAME="enabled" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="name" NEXT="restrictedusers"/>
<FIELD NAME="restrictedusers" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="enabled" NEXT="tokenusers"/>
<FIELD NAME="tokenusers" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="restrictedusers" NEXT="component"/>
<FIELD NAME="component" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" PREVIOUS="restrictedusers" NEXT="timecreated"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="component" NEXT="timemodified"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="timecreated"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="nameuk" UNIQUE="true" FIELDS="name"/>
</INDEXES>
</TABLE>
<TABLE NAME="external_functions" COMMENT="list of all external functions">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="200" NOTNULL="true" SEQUENCE="false" PREVIOUS="id" NEXT="classname"/>
<FIELD NAME="classname" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" PREVIOUS="name" NEXT="methodname"/>
<FIELD NAME="methodname" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" PREVIOUS="classname" NEXT="classpath"/>
<FIELD NAME="classpath" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" PREVIOUS="methodname" NEXT="component"/>
<FIELD NAME="component" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" PREVIOUS="classpath"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="nameuk" UNIQUE="true" FIELDS="name" COMMENT="the external function names must be globally unique"/>
</INDEXES>
</TABLE>
<TABLE NAME="external_services_functions" COMMENT="lists functions available in each service group">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="externalserviceid"/>
<FIELD NAME="externalserviceid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="id" NEXT="functionname"/>
<FIELD NAME="functionname" TYPE="char" LENGTH="200" NOTNULL="true" SEQUENCE="false" PREVIOUS="externalserviceid"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="externalserviceidfk"/>
<KEY NAME="externalserviceidfk" TYPE="foreign" FIELDS="externalserviceid" REFTABLE="external_services" REFFIELDS="id" PREVIOUS="primary"/>
</KEYS>
</TABLE>
<TABLE NAME="external_tokens" COMMENT="Security tokens for accessing of external services">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="token"/>
<FIELD NAME="token" TYPE="char" LENGTH="128" NOTNULL="true" SEQUENCE="false" COMMENT="security token, aka private access key" PREVIOUS="id" NEXT="tokentype"/>
<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" PREVIOUS="token" NEXT="userid"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" COMMENT="owner of the token" PREVIOUS="tokentype" NEXT="institution"/>
<FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="true" PREVIOUS="userid" NEXT="externalserviceid" />
<FIELD NAME="externalserviceid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="institution" NEXT="sid"/>
<FIELD NAME="sid" TYPE="char" LENGTH="128" NOTNULL="false" SEQUENCE="false" COMMENT="link to browser or emulated session" PREVIOUS="externalserviceid" NEXT="creatorid"/>
<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)" PREVIOUS="sid" NEXT="iprestriction"/>
<FIELD NAME="iprestriction" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="ip restriction" PREVIOUS="creatorid" NEXT="validuntil"/>
<FIELD NAME="validuntil" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" COMMENT="timestampt - valid until data" PREVIOUS="iprestriction" NEXT="timecreated"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="created timestamp" PREVIOUS="validuntil" NEXT="lastaccess"/>
<FIELD NAME="lastaccess" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" COMMENT="last access timestamp" PREVIOUS="timecreated" NEXT="publickey"/>
<FIELD NAME="publickey" TYPE="text" NOTNULL="true" DEFAULT="" SEQUENCE="false" COMMENT="created timestamp" PREVIOUS="privatekey" NEXT="publickeyexpires"/>
<FIELD NAME="publickeyexpires" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="created timestamp" PREVIOUS="publickey" NEXT="wssigenc"/>
<FIELD NAME="wssigenc" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="publickeyexpires"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="useridfk"/>
<KEY NAME="useridfk" TYPE="foreign" FIELDS="userid" REFTABLE="usr" REFFIELDS="id" PREVIOUS="primary" NEXT="institutionfk"/>
<KEY NAME="institutionfk" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name" PREVIOUS="useridfk" NEXT="externalserviceidfk"/>
<KEY NAME="externalserviceidfk" TYPE="foreign" FIELDS="externalserviceid" REFTABLE="external_services" REFFIELDS="id" PREVIOUS="institutionfk" NEXT="creatoridfk"/>
<KEY NAME="creatoridfk" TYPE="foreign" FIELDS="creatorid" REFTABLE="usr" REFFIELDS="id" PREVIOUS="externalserviceidfk"/>
</KEYS>
<INDEXES>
<INDEX NAME="tokenuk" UNIQUE="true" FIELDS="token"/>
</INDEXES>
</TABLE>
<TABLE NAME="external_services_users" COMMENT="users allowed to use services with restricted users flag">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="externalserviceid"/>
<FIELD NAME="externalserviceid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="id" NEXT="userid"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" PREVIOUS="externalserviceid" NEXT="institution"/>
<FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="true" PREVIOUS="userid" NEXT="iprestriction" />
<FIELD NAME="iprestriction" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="ip restriction" PREVIOUS="institution" NEXT="validuntil"/>
<FIELD NAME="validuntil" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" COMMENT="timestampt - valid until data" PREVIOUS="iprestriction" NEXT="timecreated"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" COMMENT="created timestamp" PREVIOUS="validuntil" NEXT="lastaccess"/>
<FIELD NAME="lastaccess" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" COMMENT="last access timestamp" PREVIOUS="timecreated" NEXT="publickey"/>
<FIELD NAME="publickey" TYPE="text" NOTNULL="true" DEFAULT="" SEQUENCE="false" COMMENT="created timestamp" PREVIOUS="privatekey" NEXT="publickeyexpires"/>
<FIELD NAME="publickeyexpires" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="created timestamp" PREVIOUS="publickey" NEXT="wssigenc"/>
<FIELD NAME="wssigenc" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="publickeyexpires"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="externalserviceid"/>
<KEY NAME="externalserviceidfk" TYPE="foreign" FIELDS="externalserviceid" REFTABLE="external_services" REFFIELDS="id" PREVIOUS="primary" NEXT="useridfk"/>
<KEY NAME="useridfk" TYPE="foreign" FIELDS="userid" REFTABLE="usr" REFFIELDS="id" PREVIOUS="externalserviceiduk" NEXT="institutionfk"/>
<KEY NAME="institutionfk" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name" PREVIOUS="useridfk"/>
</KEYS>
</TABLE>
<TABLE NAME="oauth_server_registry" COMMENT="Table holding consumer key/secret combos an user issued to consumers">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" COMMENT="osr id" NEXT="userid"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" COMMENT="usr ref" PREVIOUS="id" NEXT="consumer_key"/>
<FIELD NAME="externalserviceid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="userid" NEXT="institution"/>
<FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="true" PREVIOUS="externalserviceid" NEXT="consumer_key" />
<FIELD NAME="consumer_key" TYPE="char" LENGTH="128" NOTNULL="true" DEFAULT="" COMMENT="consumer key" PREVIOUS="institution" NEXT="consumer_secret" />
<FIELD NAME="consumer_secret" TYPE="char" LENGTH="128" NOTNULL="true" SEQUENCE="false" COMMENT="consumer secret" PREVIOUS="consumer_key" NEXT="enabled"/>
<FIELD NAME="enabled" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" COMMENT="enabled" PREVIOUS="enabled" NEXT="status"/>
<FIELD NAME="status" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="status" PREVIOUS="enabled" NEXT="requester_name"/>
<FIELD NAME="requester_name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="requester name" PREVIOUS="status" NEXT="requester_email"/>
<FIELD NAME="requester_email" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="requester email" PREVIOUS="requester_name" NEXT="callback_uri"/>
<FIELD NAME="callback_uri" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="callback URI" PREVIOUS="requester_email" NEXT="application_uri"/>
<FIELD NAME="application_uri" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="application URI" PREVIOUS="callback_uri" NEXT="application_title"/>
<FIELD NAME="application_title" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="application title" PREVIOUS="application_uri" NEXT="application_descr"/>
<FIELD NAME="application_descr" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="application description" PREVIOUS="application_title" NEXT="application_notes"/>
<FIELD NAME="application_notes" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="application notes" PREVIOUS="application_descr" NEXT="application_type"/>
<FIELD NAME="application_type" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="application type" PREVIOUS="application_notes" NEXT="issue_date"/>
<FIELD NAME="issue_date" TYPE="datetime" NOTNULL="true" SEQUENCE="false" COMMENT="creation timestamp" PREVIOUS="application_type" NEXT="timestamp"/>
<FIELD NAME="timestamp" TYPE="datetime" NOTNULL="true" SEQUENCE="false" COMMENT="creation timestamp" PREVIOUS="issue_date"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="consumerkeyuk"/>
<KEY NAME="consumerkeyuk" TYPE="unique" FIELDS="consumer_key" PREVIOUS="primary" NEXT="useridfk"/>
<KEY NAME="useridfk" TYPE="foreign" FIELDS="userid" REFTABLE="usr" REFFIELDS="id" PREVIOUS="consumerkeyuk" NEXT="externalserviceidfk"/>
<KEY NAME="externalserviceidfk" TYPE="foreign" FIELDS="externalserviceid" REFTABLE="external_services" REFFIELDS="id" PREVIOUS="useriduk" NEXT="institutionfk"/>
<KEY NAME="institutionfk" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name" PREVIOUS="externalserviceidfk"/>
</KEYS>
</TABLE>
<TABLE NAME="oauth_server_nonce" COMMENT="Nonce used by a certain consumer, every used nonce should be unique, this prevents replaying attacks">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" COMMENT="osn id" NEXT="consumer_key"/>
<FIELD NAME="consumer_key" TYPE="char" LENGTH="128" NOTNULL="true" DEFAULT="" COMMENT="consumer key" PREVIOUS="id" NEXT="token" />
<FIELD NAME="token" TYPE="char" LENGTH="64" NOTNULL="true" SEQUENCE="false" COMMENT="token" PREVIOUS="consumer_key" NEXT="nonce"/>
<FIELD NAME="nonce" TYPE="char" LENGTH="80" NOTNULL="true" SEQUENCE="false" COMMENT="nonce" PREVIOUS="token" NEXT="timestamp"/>
<FIELD NAME="timestamp" TYPE="datetime" NOTNULL="true" SEQUENCE="false" COMMENT="creation timestamp" PREVIOUS="nonce"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="keysuk"/>
<KEY NAME="keysuk" TYPE="unique" FIELDS="consumer_key,token,timestamp,nonce" PREVIOUS="primary"/>
</KEYS>