Details
-
Type:
Sub-task
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 1.9, 1.9.1, 1.9.2, 1.9.3
-
Fix Version/s: None
-
Component/s: Administration, Usability
-
Labels:None
-
Affected Branches:MOODLE_19_STABLE
Description
The updated tool has plugin structure, very similar to gradebook reports structure - it was the base to start from. All actions are stored in /admin/user/actions/ folder; each action has its own folder with index.php, other scripts if necessary, and lang folder to store strings.
Updated user_bulk.php and user_bulk_forms.php now generate a list of actions from the list of folders in /action/, and the names of plug-ins are fetched from their corresponding string files.
When the user selects the action, the script redirects browser to /actions/[action_folder]/index.php - it's the main action page. The list of users to manipulate is still taken from $SESSION->bulk_users variable, and each action uses it as necessary. Any action-specific language strings can be stored in /lang/ subfolder of the action.
Implementing new actions are much easier:
1. Create new folder /actions/[actionname]/
2. Put index.php there to run the action
3. Put version.php with datestamps
4. Create /lang/en_utf8/ (and other language directories if necessary) subfolders
5. Put bulkuseractions_[actionname].php string file to language subfolders. The string file must include "pluginname" string to identify the action in action list.
The "standard" actions were reorganized to comply to this structure - in fact, they were just put to their corresponding folders and slightly edited.
Attached archive contains a patch which converts bulk user actions tool to plug-in architecture. It deletes standard actions and re-creates them in their corresponding folders.
Attachments
Issue Links
| This issue will help resolve: | ||||
| CONTRIB-1656 | Bulk user action: News |
|
|
|
New functionality was added to bulk user actions architecture: now all actions are required to contain settings.php file with capability, needed to use that action. This is added merely for convenience, as this capability is checked for each action to determine whether to show this action in the action list. Actual capabilities needed to run the action are checked in the action itself. of course.
settings.php file has the following format:
<?php
$requirecapability = 'moodle/user:update';
?>
where 'moodle/user:update' should be changed to a needed capability.
If settings.php file is missing, the action is not included in the list.
To install this update, simply unpack the contents of BUA_update.zip to your /admin/user directory. The archive already contains settings.php files for all standard actions, as well as bulk enrolment and unenrolment.
Another new functionality may be to add db/access.php files to actions, which require new capabilities to be added into the system. But this will work only if we include code to check and update capabilities:
// /admin/index.php:486
upgrade_plugins('admin/user/actions', $CFG->admin.'/user/actions', "$CFG->wwwroot/$CFG->admin/index.php");
and new plugin type to /lib/access.php, function load_capability_def.
The question is - is there any need to add it? Or maybe standard capabilities are enough for bulk user actions to limit their display in the list - and their usage? Any suggestions are welcome.