Kylegoslin / moodle-block_cmanager

Course Request Manager Block for Moodle - Current version for Moodle 3.5
7 stars 20 forks source link

switch minimum role admins to coursecreators (managers) #108

Closed alekiy closed 9 years ago

alekiy commented 10 years ago

In the current version a user has to be admin to approve course requests, configure the templates and to see old course requests.

It would be better to make more use of the existing module privilges (rights) like block/cmanager:viewconfig or block/cmanager:approverecord without the need of the admin role.

See cmanager_admin.php

require_once('validate_admin.php'); /* not needed when checking and making use of the capabilities*/
require_once('../../course/lib.php');
require_once('lib/displayLists.php');

/** Navigation Bar **/
$PAGE->navbar->ignore_active();
$PAGE->navbar->add(get_string('cmanagerDisplay', 'block_cmanager'), new moodle_url('/blocks/cmanager/cmanager_admin.php'));

$PAGE->set_url('/blocks/cmanager/cmanager_admin.php');
$PAGE->set_context(context_system::instance());
$PAGE->set_heading(get_string('pluginname', 'block_cmanager'));
$PAGE->set_title(get_string('pluginname', 'block_cmanager'));
echo $OUTPUT->header();

$_SESSION['CRMisAdmin'] = true;

$context = context_system::instance();
if (has_capability('block/cmanager:viewconfig',$context)) {
} else {
  print_error(get_string('cannotviewconfig', 'block_cmanager'));
}

If ok, I will refactor the code and provide a detailed documentation for the priviliges with my bad german english. ;)

danielmcsweeney commented 9 years ago

Thanks alekiy Version 4.3 now makes use of permissions. Appreciate the input