mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Merge branch 'wip-MDL-31072-master' of github.com:marinaglancy/moodle
This commit is contained in:
commit
7ed8dc999f
@ -1044,10 +1044,9 @@ class potential_assignees_below_course extends role_assign_user_selector_base {
|
||||
$sql = " FROM {user} u
|
||||
WHERE u.id IN ($enrolsql) $wherecondition
|
||||
AND u.id NOT IN (
|
||||
SELECT u.id
|
||||
FROM {role_assignments} r, {user} u
|
||||
SELECT r.userid
|
||||
FROM {role_assignments} r
|
||||
WHERE r.contextid = :contextid
|
||||
AND u.id = r.userid
|
||||
AND r.roleid = :roleid)";
|
||||
$order = ' ORDER BY lastname ASC, firstname ASC';
|
||||
|
||||
@ -1096,10 +1095,9 @@ class potential_assignees_course_and_above extends role_assign_user_selector_bas
|
||||
$sql = " FROM {user}
|
||||
WHERE $wherecondition
|
||||
AND id NOT IN (
|
||||
SELECT u.id
|
||||
FROM {role_assignments} r, {user} u
|
||||
SELECT r.userid
|
||||
FROM {role_assignments} r
|
||||
WHERE r.contextid = :contextid
|
||||
AND u.id = r.userid
|
||||
AND r.roleid = :roleid)";
|
||||
$order = ' ORDER BY lastname ASC, firstname ASC';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="lib/db" VERSION="20111214" COMMENT="XMLDB file for core Moodle tables"
|
||||
<XMLDB PATH="lib/db" VERSION="20120110" COMMENT="XMLDB file for core Moodle tables"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
@ -1131,7 +1131,9 @@
|
||||
<KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id" PREVIOUS="contextid"/>
|
||||
</KEYS>
|
||||
<INDEXES>
|
||||
<INDEX NAME="sortorder" UNIQUE="false" FIELDS="sortorder"/>
|
||||
<INDEX NAME="sortorder" UNIQUE="false" FIELDS="sortorder" NEXT="rolecontext"/>
|
||||
<INDEX NAME="rolecontext" UNIQUE="false" FIELDS="roleid, contextid" COMMENT="Index on roleid and contextid" PREVIOUS="sortorder" NEXT="usercontextrole"/>
|
||||
<INDEX NAME="usercontextrole" UNIQUE="false" FIELDS="userid, contextid, roleid" COMMENT="Index on userid, contextid and roleid" PREVIOUS="rolecontext"/>
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
<TABLE NAME="role_capabilities" COMMENT="permission has to be signed, overriding a capability for a particular role in a particular context" PREVIOUS="role_assignments" NEXT="role_names">
|
||||
|
@ -112,6 +112,29 @@ function xmldb_main_upgrade($oldversion) {
|
||||
upgrade_main_savepoint(true, 2011120500.03);
|
||||
}
|
||||
|
||||
if ($oldversion < 2012020200.03) {
|
||||
|
||||
// Define index rolecontext (not unique) to be added to role_assignments
|
||||
$table = new xmldb_table('role_assignments');
|
||||
$index = new xmldb_index('rolecontext', XMLDB_INDEX_NOTUNIQUE, array('roleid', 'contextid'));
|
||||
|
||||
// Conditionally launch add index rolecontext
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Define index usercontextrole (not unique) to be added to role_assignments
|
||||
$index = new xmldb_index('usercontextrole', XMLDB_INDEX_NOTUNIQUE, array('userid', 'contextid', 'roleid'));
|
||||
|
||||
// Conditionally launch add index usercontextrole
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Main savepoint reached
|
||||
upgrade_main_savepoint(true, 2012020200.03);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -369,13 +369,13 @@ abstract class user_selector_base {
|
||||
// See if we got anything.
|
||||
if ($this->multiselect) {
|
||||
$userids = optional_param_array($this->name, array(), PARAM_INTEGER);
|
||||
} else {
|
||||
$userid = optional_param($this->name, 0, PARAM_INTEGER);
|
||||
if (empty($userid)) {
|
||||
return array();
|
||||
}
|
||||
} else if ($userid = optional_param($this->name, 0, PARAM_INTEGER)) {
|
||||
$userids = array($userid);
|
||||
}
|
||||
// If there are no users there is nobody to load
|
||||
if (empty($userids)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
// If we did, use the find_users method to validate the ids.
|
||||
$this->validatinguserids = $userids;
|
||||
|
Loading…
x
Reference in New Issue
Block a user