Manage metacourse capability is needed

Manage metacourse capability is needed

by Julien Bonjean -
Number of replies: 7
Hello,

I created a "global course" (course 1) and two meta-courses (courses 1a and 1b) following scenario 2.
Auto-enrollment is working very well, when a student enrolls in course 1, he is automatically enrolled in courses 1a and 1b.
But sometimes, I need to manually enroll one student to only one of the meta-courses but I encounter the following error :

Can not assign this role to user "Student Test" because Manage metacourse capability is needed.

I am admin so it's like if system was checking student rights instead of mines. Can somebody help me ?

Thank you.

Julien
Average of ratings: -
In reply to Julien Bonjean

Re: Manage metacourse capability is needed

by P P -
Hi Julein
It seems that you do not have the permission to handle the metacourses.
You need to enable the manage metacourse in the override roles section. I also did a quick search and found this thread that supports that idea.

http://moodle.org/mod/forum/discuss.php?d=61620

Hope that helps.

Pooya
In reply to P P

Re: Manage metacourse capability is needed

by Julien Bonjean -
Hi,

Thank you for your answer but admin has the permission to manage metacourses, I used override roles feature to set "Manage metacourse" right.
I already read the thread you pointed me but it didn't help me. The solution is given in the last post, to set "Manage metacourse" to student role, appears to me like a weird workaround, correct me if I'm wrong.

Julien
In reply to Julien Bonjean

Re: Manage metacourse capability is needed

by P P -
Hi,
That's right. It is really strange that the system asks for the permission for the "student" role. May be the task you want to accomplish is seen like this from the system's perspective:
a metacourse is supposed to inherit the enrollment, and manual enrolment means that the person (in your case the student) wants to enrol him/herself in (even it is done by the system administrator). And as such it requires the permission to manipulate the course. Right?

It sounds weired. I could not find any other solutions yet. Keep me posted if you found something.

Pooya

P.S. It would be wise to check the "roles forum" too.
In reply to P P

Re: Manage metacourse capability is needed

by Julien Bonjean -
Hi,
ok, I will probably do a patch if I don't find a clean way to handle this. Thanks.

Julien
In reply to Julien Bonjean

Re: Manage metacourse capability is needed

by Ann Adamcik -
You can either let the metacourse synchronize the enrollments for a particular role, or you can manually assign users to that role - not both.

Go to Site Administration -> Users -> Permissions -> User policies to determine which roles are synchronized. If you want to be able to manually enroll certain users, select their role(s) on this page. For instance, we synchronize the student role, but manually assign teachers. If you need to synchronize some students and manually assign others, you'll probably have to create a second student role that is not synchronized.

Unfortunately, the message you get when you try to manually assign a user to a metacourse is rather misleading.

See http://docs.moodle.org/en/Metacourses.
In reply to Ann Adamcik

Re: Manage metacourse capability is needed

by Julien Bonjean -
Hello,

Problem is that users registers automatically through Paypal enrollment.

Wouldn't it be easier to consider parent and child courses. The characteristic of the parent course is that when a user register to the parent course, the student is automatically registered to the child course.

We would then be able to have the behaviour of the scenarios described in the metacourse doc page : http://docs.moodle.org/en/Metacourses

This allows us to have user registering for the child course.

Any comments before coding ?

Thank you.

Julien
In reply to Julien Bonjean

Re: Manage metacourse capability is needed

by Loïc Faure-Lacroix -
Here are the modification I did to enable normal users to have access to the metacourse. Can someone tell me why metacourse role were restrained to people that can manage metacourse?

diff --git a/admin/roles/assign.php b/admin/roles/assign.php
index 16fafb6..7a0ec1a 100755
--- a/admin/roles/assign.php
+++ b/admin/roles/assign.php
@@ -170,7 +170,7 @@
}
$allow = true;
if ($inmeta) {
- if (has_capability('moodle/course:managemetacourse', $context, $adduser)) {
+ if (has_capability('moodle/course:request', $context, $adduser)) {
//ok
} else {
$managerroles = get_roles_with_capability('moodle/course:managemetacourse', CAP_ALLOW, $context);
diff --git a/lib/moodlelib.php b/lib/moodlelib.php
index 6a7fcbc..13d4587 100644
--- a/lib/moodlelib.php
+++ b/lib/moodlelib.php
@@ -2430,7 +2430,7 @@ function sync_metacourse($course) {
$context = get_context_instance(CONTEXT_COURSE, $course->id); // SITEID can not be a metacourse

// We do not ever want to unassign the list of metacourse manager, so get a list of them.
- if ($users = get_users_by_capability($context, 'moodle/course:managemetacourse')) {
+ if ($users = get_users_by_capability($context, 'moodle/course:request')) {
$managers = array_keys($users);
} else {
$managers = array();