mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-45041 Web Service: add_user_device doesn't store entries for different users using the same push key
This commit is contained in:
parent
40f0ad21a3
commit
a1bacaf13d
@ -2959,7 +2959,6 @@
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
||||
<KEY NAME="pushid-userid" TYPE="unique" FIELDS="pushid, userid"/>
|
||||
<KEY NAME="pushid-platform" TYPE="unique" FIELDS="pushid, platform"/>
|
||||
<KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
|
||||
</KEYS>
|
||||
</TABLE>
|
||||
|
@ -3709,5 +3709,15 @@ function xmldb_main_upgrade($oldversion) {
|
||||
upgrade_main_savepoint(true, 2014070101.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2014072400.01) {
|
||||
$table = new xmldb_table('user_devices');
|
||||
$oldindex = new xmldb_index('pushid-platform', XMLDB_KEY_UNIQUE, array('pushid', 'platform'));
|
||||
if ($dbman->index_exists($table, $oldindex)) {
|
||||
$key = new xmldb_key('pushid-platform', XMLDB_KEY_UNIQUE, array('pushid', 'platform'));
|
||||
$dbman->drop_key($table, $key);
|
||||
}
|
||||
upgrade_main_savepoint(true, 2014072400.01);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1119,16 +1119,6 @@ class core_user_external extends external_api {
|
||||
return $warnings;
|
||||
}
|
||||
|
||||
// The same key can't exists for the same platform.
|
||||
if ($DB->get_record('user_devices', array('pushid' => $params['pushid'], 'platform' => $params['platform']))) {
|
||||
$warnings['warning'][] = array(
|
||||
'item' => $params['pushid'],
|
||||
'warningcode' => 'existingkeyforplatform',
|
||||
'message' => 'This key is already stored for other device using the same platform'
|
||||
);
|
||||
return $warnings;
|
||||
}
|
||||
|
||||
$userdevice = new stdclass;
|
||||
$userdevice->userid = $USER->id;
|
||||
$userdevice->appid = $params['appid'];
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2014072400.00; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
$version = 2014072400.01; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
// RR = release increments - 00 in DEV branches.
|
||||
// .XX = incremental changes.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user