mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
Merge branch 'MDL-45849-selfenrol' of https://github.com/Peterburnett/moodle
This commit is contained in:
commit
af331f08d4
@ -73,4 +73,13 @@ $capabilities = array(
|
||||
)
|
||||
),
|
||||
|
||||
/* Ability to enrol self in courses. */
|
||||
'enrol/self:enrolself' => array(
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_COURSE,
|
||||
'archetypes' => array(
|
||||
'user' => CAP_ALLOW,
|
||||
)
|
||||
),
|
||||
|
||||
);
|
||||
|
@ -98,6 +98,7 @@ $string['requirepassword'] = 'Require enrolment key';
|
||||
$string['requirepassword_desc'] = 'Require enrolment key in new courses and prevent removing of enrolment key from existing courses.';
|
||||
$string['role'] = 'Default assigned role';
|
||||
$string['self:config'] = 'Configure self enrol instances';
|
||||
$string['self:enrolself'] = 'Self enrol in course';
|
||||
$string['self:holdkey'] = 'Appear as the self enrolment key holder';
|
||||
$string['self:manage'] = 'Manage enrolled users';
|
||||
$string['self:unenrol'] = 'Unenrol users from course';
|
||||
|
@ -248,6 +248,11 @@ class enrol_self_plugin extends enrol_plugin {
|
||||
return get_string('canntenrol', 'enrol_self');
|
||||
}
|
||||
|
||||
// Check if user has the capability to enrol in this context.
|
||||
if (!has_capability('enrol/self:enrolself', context_course::instance($instance->courseid))) {
|
||||
return get_string('canntenrol', 'enrol_self');
|
||||
}
|
||||
|
||||
if ($instance->enrolstartdate != 0 and $instance->enrolstartdate > time()) {
|
||||
return get_string('canntenrolearly', 'enrol_self', userdate($instance->enrolstartdate));
|
||||
}
|
||||
|
@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->version = 2020061501; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2020060900; // Requires this Moodle version
|
||||
$plugin->component = 'enrol_self'; // Full name of the plugin (used for diagnostics)
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2020071500.00; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
$version = 2020071500.01; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
// RR = release increments - 00 in DEV branches.
|
||||
// .XX = incremental changes.
|
||||
$release = '4.0dev (Build: 20200711)'; // Human-friendly version name
|
||||
|
Loading…
x
Reference in New Issue
Block a user