There is one point where it restricted the list of users. I have
fixed this and also altered the (only) script that calls that function
so that it obtains a cm_info $cm rather than the old sort.
There were previously no Behat tests at all in this module. In order
to be confident that I didn't break it, I have implemented a Behat
test (which should also be useful in general as it does go through
other pages on the way to get to the relevant one).
Makes it possible to add a grouping condition when creating an
activity, using the Behat field type API. You can set the field
using a syntax 'Grouping: NAME' (at present, only groupings are
supported, obviously we could potentially extend this to add
support for other conditions if needed).
Tested in Firefox and Chrome in JS mode, and in non-JS mode.
Currently cm_info::create allows the 'null' parameter, and
returns null (as a null $cm should still be null when treated
as a cm_info object).
Some unit tests relied on the value 'false' being treated
the same as null in this regard. This seems like a generally
safe assumption (given this is a function about changing
weakly typed data into a stronger type) so I modified the
function to accept anything PHP false, returning null.
The availability restrictions that apply to user lists (group, grouping)
now apply in workshop:
* In user lists.
* When randomly allocating users (also now works as expected if you use
group mode and a grouping with the activity).
The previous API included a facility to filter a list of users
to include only those who are allowed to access an activity, i.e.
only people who belong to the required groups etc.
This change adds a new API function to return SQL that obtains
this list of users, so that it can be combined with other
queries.
Updated code to restrict list of users. Also includes changes to
ensure that a cm_info object is available (required for availability
checks).
There is a tweak to upgradelib to reflect the different fields used.
(Note that upgradelib is not used during upgrade, but only when
converting assignments from the old assignment module.)
This only affects the quiz overrides form, as groupmembersonly was
not used elsewhere. The change simply restricts the list of users
shown when selecting somebody for overrides.
Some additional code is needed to (efficiently) load the $cm object
as a cm_info so that the availability API can be used on it.
Previously there was no way in PHP to create the JSON values used for
availability, except by manually hard-coding them (the main code to
do this normally is in JavaScript).
This makes unit tests hard to read, so I have implemented static
functions tree::get_root_json and tree::get_nested_json which allow
for easier-to-read unit tests.
Remove groupmembersonly option from require_login.
NOTE: This code, and another branch (both related to login when
accessing activities on the site course), are not actually
necessary because there is code above which already checks
$cm->uservisible.
NOTE: You can see this change more simply by doing
git diff --ignore-space-change; indent was altered.
Remove groupmembersonly usage in the core_availability API, and change
the update code (used in backup) so that it considers groupmembersonly
when restoring old backups.
* Upgrades existing data so that the groupmembersonly option is
replaced with equivalent data for the new availability API.
* Removes the database field and admin setting used for
groupmembersonly.
* Changes core modinfo library to remove/deprecate groupmembersonly
data and functions.
* Changes other core library files to remove groupmembersonly
references.
Includes deprecation of several functions, listed in lib/upgrade.txt.