Plan to improve ability to delegate administrator tasks to course category level
In a large organisation it is likely that course categories will repesent (in some sense) departments. It would be useful to be able to, effectively, have administrators assigned at the category context and to expect them to have rights to create/delete/edit subcategories and create/delete/edit courses. Some parts of this work, but a lack of underlying original functionality make this inconsistent and incomplete. Roles was mostly a wrapper around existing functionality, so the concept of being able to administer all the courses within a particular role didn't exist but now it becomes possible (and desirable) to assign the administrator role in the Category context.
The main problem area is in the course and category editing screen. This is split across two scripts - course/index.php and course/category.php. The former displays the entire tree and allows new categories to be added and existing ones to be moved, deleted and edited. The latter shows the contents of categories (and subcategories) but allows no editing. It does, however, allow new courses to be added. In an ideal world this would have been a single script providing editing ability within any category level but this would now require a substantial rewrite.
This plan is to make a few small changes to provide a better level of functionality without major changes, rewrites, or refactoring.
Creating a new role with a single capability allowed - moodle/category:update - and assigning the user to this at the site level gives them access the category and course editing screen (or it should). They will *also* be assigned to the administrator (or equivalent) role in the appropriate category context.
This gives them access to the course/index.php screen enabling them to manipulate categories. The roles system (mostly) controls the rights appropriately to the category editing functions.
Some of these were clearly bugs anyway and have been fixed, but they are noted for completeness.
Courses item in Administration not tied to capability
This has been fixed
Giving somebody the capability moodle/category:update did not give the option in the Administration menu. This has been fixed.
No capability for moving categories
Creating and deleting categories are both covered by capabilities and this is correctly reflected in the course/index.php code. However, the ability to move categories is only controlled by the moodle/category:update capability - the same one that gives you access to the page at all. There is no finer grain control available.
Proposal: Add a new capability moodle/category:move along with apropriate code in course/index.php to enforce it.
No ability to add subcategories directly
You can only add a new category at the top level even though you can assign the create permission at the category context.
Proposal: Factor out the code for this out of course/index.php into course/lib.php (functions exist for display already) and add aditionaly to course/category.php with appropriate permissions checking.
Caveat" This isn't ideal as the course/category.php script does not allow further manipulation of the category; you would have to return to the course/index.php page. However, it's much better than nothing and is an order of magnitude easier to do than a complete rewrite of the two scripts to combine them (which would be the ideal solution)
I don't think there's anything too complex or critical in here and would like to get this into 1.8.3.
The following tracker reports are related:
- [http://tracker.moodle.org/browse/MDL-10049 MDL-10049]
- [http://tracker.moodle.org/browse/MDL-10496 MDL-10496]
- [http://tracker.moodle.org/browse/MDL-10093 MDL-10093]
- [http://tracker.moodle.org/browse/MDL-10031 MDL-10031]
- [http://tracker.moodle.org/browse/MDL-10029 MDL-10029]
- [http://tracker.moodle.org/browse/MDL-11543 MDL-11543]