Skip to content

Commit

Permalink
MDL-23502 fixed php docs in enrol/cohort + readding config capability…
Browse files Browse the repository at this point in the history
… for more fine grained access control
  • Loading branch information
skodak committed Jul 31, 2010
1 parent fe44193 commit 465f508
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 29 deletions.
7 changes: 4 additions & 3 deletions enrol/cohort/addinstance.php
Expand Up @@ -18,9 +18,10 @@
/**
* Adds new instance of enrol_cohort to specified course.
*
* @package enrol_cohort
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package enrol
* @subpackage cohort
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require('../../config.php');
Expand Down
7 changes: 4 additions & 3 deletions enrol/cohort/addinstance_form.php
Expand Up @@ -18,9 +18,10 @@
/**
* Adds instance form
*
* @package enrol_cohort
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package enrol
* @subpackage cohort
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die;
Expand Down
25 changes: 22 additions & 3 deletions enrol/cohort/db/access.php
Expand Up @@ -18,10 +18,29 @@
/**
* Capabilities for cohort access plugin.
*
* @package enrol_cohort
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package enrol
* @subpackage cohort
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die;

$capabilities = array(

'enrol/cohort:config' => array(

'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW,
)
),

);





9 changes: 6 additions & 3 deletions enrol/cohort/db/events.php
Expand Up @@ -18,11 +18,14 @@
/**
* Cohort enrolment plugin event handler definition.
*
* @package enrol_cohort
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package enrol
* @subpackage cohort
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die;

/* List of handlers */
$handlers = array (
'cohort_member_added' => array (
Expand Down
8 changes: 5 additions & 3 deletions enrol/cohort/lang/en/enrol_cohort.php
Expand Up @@ -18,10 +18,12 @@
/**
* Strings for component 'enrol_cohort', language 'en', branch 'MOODLE_20_STABLE'
*
* @package enrol_cohort
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package enrol
* @subpackage cohort
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

$string['cohort:config'] = 'Configure cohort instances';
$string['pluginname'] = 'Cohort sync';
$string['pluginname_desc'] = 'Cohort enrolment plugin synchronises cohort members with course participants.';
9 changes: 5 additions & 4 deletions enrol/cohort/lib.php
Expand Up @@ -18,9 +18,10 @@
/**
* Cohort enrolment plugin.
*
* @package enrol_cohort
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package enrol
* @subpackage cohort
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die;
Expand Down Expand Up @@ -66,7 +67,7 @@ public function get_newinstance_link($courseid) {
global $DB;

$coursecontext = get_context_instance(CONTEXT_COURSE, $courseid);
if (!has_capability('moodle/course:enrolconfig', $coursecontext)) {
if (!has_capability('moodle/course:enrolconfig', $coursecontext) or !has_capability('enrol/cohort:config', $coursecontext)) {
return NULL;
}

Expand Down
7 changes: 4 additions & 3 deletions enrol/cohort/locallib.php
Expand Up @@ -18,9 +18,10 @@
/**
* Local stuff for cohort enrolment plugin.
*
* @package enrol_cohort
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package enrol
* @subpackage cohort
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die;
Expand Down
7 changes: 4 additions & 3 deletions enrol/cohort/settings.php
Expand Up @@ -18,9 +18,10 @@
/**
* Cohort enrolment plugin settings and presets.
*
* @package enrol_cohort
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package enrol
* @subpackage cohort
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die;
Expand Down
11 changes: 7 additions & 4 deletions enrol/cohort/version.php
Expand Up @@ -18,10 +18,13 @@
/**
* Cohort enrolment plugin version specification.
*
* @package enrol_cohort
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package enrol
* @subpackage cohort
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

$plugin->version = 2010071800;
defined('MOODLE_INTERNAL') || die;

$plugin->version = 2010073100;
$plugin->cron = 60;

0 comments on commit 465f508

Please sign in to comment.