Moodle
  1. Moodle
  2. MDL-11894

Restricting activity module to course/category of courses

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 1.8.2
    • Fix Version/s: None
    • Component/s: Administration
    • Labels:
      None
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_18_STABLE
    • Rank:
      1904

      Description

      Security-> Module security
      Unable to restrict activity module for a course or category of courses. Difficult to create category of course.

        Issue Links

          Activity

          Hide
          Mark van Hoek added a comment -

          I see this issue with Moodle 1.9.4+ (Build: 20090218): courses created using IMS Enterprise file do not get db.mdl_course.restrictmodules=1 applied (it is 0) even with Security->Module Security->Restrict modules for=All Courses; Restrict modules by default=checked

          Thus, when you go to Edit Course Settings for IMS-created courses, Restrict Activity Modules is set to No.

          Courses created via the Moodle interface are restricted correctly.

          Show
          Mark van Hoek added a comment - I see this issue with Moodle 1.9.4+ (Build: 20090218): courses created using IMS Enterprise file do not get db.mdl_course.restrictmodules=1 applied (it is 0) even with Security->Module Security->Restrict modules for=All Courses; Restrict modules by default=checked Thus, when you go to Edit Course Settings for IMS-created courses, Restrict Activity Modules is set to No. Courses created via the Moodle interface are restricted correctly.
          Hide
          Eduardo Domínguez added a comment -

          Still happening in 1.9.7
          This was not important to us before, we've been using IMS Enterprise for years (webct and moodle) but now we'd like to install some new activities and to give access to them on a few courses. We have near 2500 courses and this is a hitch to continue testing.
          Does somebody know a workarround?
          Thanks

          Show
          Eduardo Domínguez added a comment - Still happening in 1.9.7 This was not important to us before, we've been using IMS Enterprise for years (webct and moodle) but now we'd like to install some new activities and to give access to them on a few courses. We have near 2500 courses and this is a hitch to continue testing. Does somebody know a workarround? Thanks
          Hide
          Eduardo Domínguez added a comment -

          I added the following lines in function process_group_tag():

                if (($CFG->restrictmodulesfor == 'all') and ($CFG->restrictbydefault)) {
                    $course->restrictmodules = 1;
                } else {
                    $course->restrictmodules = 0;
                }
          

          just before line number 496:

          // Insert default names for teachers/students, from the current language
          

          This works for me. I'm not exactly a formal programmer (I know I look too many times like a shoddy programmer) so I don't know how to build a patch file to attach here. I copied and adapted this piece of code from the function create_course()... and suddenly a question (may be a stupid one) comes to my head: Why create_course() is not used in process_group_tag()? process_group_tag() looks like reinventing the wheel...

          Show
          Eduardo Domínguez added a comment - I added the following lines in function process_group_tag(): if (($CFG->restrictmodulesfor == 'all') and ($CFG->restrictbydefault)) { $course->restrictmodules = 1; } else { $course->restrictmodules = 0; } just before line number 496: // Insert default names for teachers/students, from the current language This works for me. I'm not exactly a formal programmer (I know I look too many times like a shoddy programmer) so I don't know how to build a patch file to attach here. I copied and adapted this piece of code from the function create_course()... and suddenly a question (may be a stupid one) comes to my head: Why create_course() is not used in process_group_tag()? process_group_tag() looks like reinventing the wheel...
          Hide
          Michael de Raadt added a comment -

          Thanks for reporting this issue.

          We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported.

          If you believe that this issue is still relevant to current versions (2.3 and beyond), please comment on the issue. Issues left inactive for a further month will be closed.

          Michael d;

          4d6f6f646c6521

          Show
          Michael de Raadt added a comment - Thanks for reporting this issue. We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported. If you believe that this issue is still relevant to current versions (2.3 and beyond), please comment on the issue. Issues left inactive for a further month will be closed. Michael d; 4d6f6f646c6521
          Hide
          Tim Hunt added a comment -

          This was fixed in Moodle 2.3 which included MDL-19125. This added capabilities like mod/forum:addinstance that can be used to do this.

          Show
          Tim Hunt added a comment - This was fixed in Moodle 2.3 which included MDL-19125 . This added capabilities like mod/forum:addinstance that can be used to do this.

            People

            • Votes:
              3 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: