Moodle
  1. Moodle
  2. MDL-23840

Assigning roles to course category level seems broken

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Not a bug
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Component/s: Roles / Access
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Rank (Obsolete):
      8199

      Description

      To reproduce...

      1. Change the teacher role so that it can be assigned at the Course Category level

      2. Create a new Category and create a couple of courses within it

      3. Assign a user the role Teacher at the Course Category (they have no other assignments)

      4. Log in as that teacher.

      5. Attempt to enter one of the courses. Error: "You cannot enrol yourself in this course"

        Activity

        Hide
        Mary Cooch added a comment -

        I will try this myself but I thought we weren't supposed to be assigning at course category level now as it says (quote)" the category enrolment plugin is a legacy solution for enrolments at the course category level via role assignments. It is recommended to use cohort synchronisation instead" - Mind you ; if the link is still there, it should of course work.

        Show
        Mary Cooch added a comment - I will try this myself but I thought we weren't supposed to be assigning at course category level now as it says (quote)" the category enrolment plugin is a legacy solution for enrolments at the course category level via role assignments. It is recommended to use cohort synchronisation instead" - Mind you ; if the link is still there, it should of course work.
        Hide
        Howard Miller added a comment -

        Hi Mary,

        Unfortunately there's no documentation for Cohorts so I have no idea how to use it.

        Show
        Howard Miller added a comment - Hi Mary, Unfortunately there's no documentation for Cohorts so I have no idea how to use it.
        Hide
        Howard Miller added a comment -

        Ok,

        Having had a play - what I think Cohorts does is to allow me to add a group of pre-assigned users at a single click. I can't find any reference to Cohort Sync apart from it being a enrollment plugin.

        The advantage of assigning a role to a Course Category is that you can assign people to (say) a Department and they will have that role regardless of what courses are added or taken away beneath. Notwithstanding that I don't know what the Sync function does, Cohorts look backwards to this.

        Show
        Howard Miller added a comment - Ok, Having had a play - what I think Cohorts does is to allow me to add a group of pre-assigned users at a single click. I can't find any reference to Cohort Sync apart from it being a enrollment plugin. The advantage of assigning a role to a Course Category is that you can assign people to (say) a Department and they will have that role regardless of what courses are added or taken away beneath. Notwithstanding that I don't know what the Sync function does, Cohorts look backwards to this.
        Hide
        Howard Miller added a comment -

        Got it. I'm now in tears. This is roles obsession to the power of four. What used to be simple and intuitive is now complicated to nightmare proportions.

        Nobody ever believed me when I said that large Moodle sites can be organised using Course Categories and assignments at Category level and this (if it is the way it is supposed to work) has just broken that.

        Just for the record:

        1. Enable cohort sync

        2. Create a cohort for the Course Category you want

        3. Add users to you r Cohort

        (Now the bad bit)

        4. In EVERY course in the Course Category now and in the future add Cohort Sync as an enrollment method to the course

        Show
        Howard Miller added a comment - Got it. I'm now in tears. This is roles obsession to the power of four. What used to be simple and intuitive is now complicated to nightmare proportions. Nobody ever believed me when I said that large Moodle sites can be organised using Course Categories and assignments at Category level and this (if it is the way it is supposed to work) has just broken that. Just for the record: 1. Enable cohort sync 2. Create a cohort for the Course Category you want 3. Add users to you r Cohort (Now the bad bit) 4. In EVERY course in the Course Category now and in the future add Cohort Sync as an enrollment method to the course
        Hide
        Petr Skoda added a comment -

        Please calm down.

        You can still assign roles in categories and use category enrolment plugin instead of cohorts. This enrol plugin is disabled by default. The new enrol subsystem is very flexible, if you really want you may tweak the category enrol plugin to make it work exactly like before (that is make it automatically create new instance in each course).

        Cohorts are more flexible than the category enrolments especially when integrated with external systems.

        Enrolments in 1.9.x were hardcoded to work one way only, now you can replace all plugins (except manual) and you can make it do anything you want. I had just a few weeks to write very basic plugins that work in a similar way like before.

        If you do not like how enrolments work please please write new and better enrol plugins or improve current plugins.

        Petr Skoda

        Show
        Petr Skoda added a comment - Please calm down. You can still assign roles in categories and use category enrolment plugin instead of cohorts. This enrol plugin is disabled by default. The new enrol subsystem is very flexible, if you really want you may tweak the category enrol plugin to make it work exactly like before (that is make it automatically create new instance in each course). Cohorts are more flexible than the category enrolments especially when integrated with external systems. Enrolments in 1.9.x were hardcoded to work one way only, now you can replace all plugins (except manual) and you can make it do anything you want. I had just a few weeks to write very basic plugins that work in a similar way like before. If you do not like how enrolments work please please write new and better enrol plugins or improve current plugins. Petr Skoda
        Hide
        Howard Miller added a comment -

        Petr,

        Perfectly calm thanks Let's forget about the Cohort thing which seems to have been us going off at a tangent.

        Going back to my original report. I can assign teachers at the category level (like in 1.9), but it doesn't work - are you saying that this feature is by design? That is (I assume) as far as roles are concerned a Course Category no longer "contains" the courses within it?

        I'll go an have a look at the category enrolment plugin. I didn't know it existed.

        Show
        Howard Miller added a comment - Petr, Perfectly calm thanks Let's forget about the Cohort thing which seems to have been us going off at a tangent. Going back to my original report. I can assign teachers at the category level (like in 1.9), but it doesn't work - are you saying that this feature is by design? That is (I assume) as far as roles are concerned a Course Category no longer "contains" the courses within it? I'll go an have a look at the category enrolment plugin. I didn't know it existed.
        Hide
        Howard Miller added a comment -

        Ok. I found the Category Enrolment plugin and switched it on. There's no docs for it, so I am guessing... how do I use it to assign users at the Course Category level?

        Show
        Howard Miller added a comment - Ok. I found the Category Enrolment plugin and switched it on. There's no docs for it, so I am guessing... how do I use it to assign users at the Course Category level?
        Hide
        Petr Skoda added a comment -

        How to use it? If you are upgrading existing site with category enrolments you do not have to do anything. In new installs you have to enable the plugin and configure roles that should be synchronised by setting enrol/category:synchronised to CAP_ALLOW in role definition.

        Show
        Petr Skoda added a comment - How to use it? If you are upgrading existing site with category enrolments you do not have to do anything. In new installs you have to enable the plugin and configure roles that should be synchronised by setting enrol/category:synchronised to CAP_ALLOW in role definition.
        Hide
        Howard Miller added a comment -

        Obviously I'll give it a try!! I'm struggling to understand the hatred for Course Categories. This has proved a really useful feature on large sites. I'm pretty much convinced that this is a BIG error in judgement

        Show
        Howard Miller added a comment - Obviously I'll give it a try!! I'm struggling to understand the hatred for Course Categories. This has proved a really useful feature on large sites. I'm pretty much convinced that this is a BIG error in judgement
        Hide
        Howard Miller added a comment -

        Ok... it worked. But, let's get this straight. In order to do the seemingly simple thing of assigning a role to a Course Category:

        1. Enable the Category Sync enrolment plugin

        2. Modify the required role to allow assignment at Course Category level

        3. Modify the required role to all the enrol/category:synchronised role

        4. Assign the user to the role.

        Hmmm.... ok.

        Show
        Howard Miller added a comment - Ok... it worked. But, let's get this straight. In order to do the seemingly simple thing of assigning a role to a Course Category: 1. Enable the Category Sync enrolment plugin 2. Modify the required role to allow assignment at Course Category level 3. Modify the required role to all the enrol/category:synchronised role 4. Assign the user to the role. Hmmm.... ok.
        Hide
        Petr Skoda added a comment -

        I hope you noticed the performance problems in stats processing, problems with gradebook cleanup after my wrong formula calculations created millions of bogus grades, slow role assignmnets and unassignments, extremely expensive my_courses() processing especially when looking for intersections for multiple users and many other enrolment related issues that were not possible to be fixed in 1.9.x - this is the reason why I hated the role based enrolments since the early 1.7dev. SQL is not designed to handle relations in tree structure, if you try to emulate it you run into performance problems really quickly - we used ugly hacks and enrolment/role workarounds all over the place, they are mostly gone now or at least can be replaced later.

        Show
        Petr Skoda added a comment - I hope you noticed the performance problems in stats processing, problems with gradebook cleanup after my wrong formula calculations created millions of bogus grades, slow role assignmnets and unassignments, extremely expensive my_courses() processing especially when looking for intersections for multiple users and many other enrolment related issues that were not possible to be fixed in 1.9.x - this is the reason why I hated the role based enrolments since the early 1.7dev. SQL is not designed to handle relations in tree structure, if you try to emulate it you run into performance problems really quickly - we used ugly hacks and enrolment/role workarounds all over the place, they are mostly gone now or at least can be replaced later.
        Hide
        Howard Miller added a comment -

        Ok. I didn't realise that the operation of roles has changed so substantially. I need to do some more reading.

        If you come from 1.9 it appears an order of magnitude more complex. The forums will be busy anyway

        Show
        Howard Miller added a comment - Ok. I didn't realise that the operation of roles has changed so substantially. I need to do some more reading. If you come from 1.9 it appears an order of magnitude more complex. The forums will be busy anyway
        Hide
        Petr Skoda added a comment -

        Yes, it will be a big task to explain and document this properly for both teachers and developers. It is great to have people like you that are always willing to help.

        Thank you for all your feedback!

        Show
        Petr Skoda added a comment - Yes, it will be a big task to explain and document this properly for both teachers and developers. It is great to have people like you that are always willing to help. Thank you for all your feedback!
        Hide
        Don Hazelwood added a comment -

        Is it possible to have a hidden role at the category level?

        Any insight?

        Show
        Don Hazelwood added a comment - Is it possible to have a hidden role at the category level? Any insight?
        Hide
        Derek Chirnside added a comment -

        @Don, you may get more joy in the forums.
        I've just updated the docs for this issue here: http://docs.moodle.org/23/en/Cohort_sync#Enrolling_a_cohort_in_a_category If I've mis-spoke, just fix the wiki.

        -Derek

        Show
        Derek Chirnside added a comment - @Don, you may get more joy in the forums. I've just updated the docs for this issue here: http://docs.moodle.org/23/en/Cohort_sync#Enrolling_a_cohort_in_a_category If I've mis-spoke, just fix the wiki. -Derek

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: