Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-52811

Capability to 'Force language' in Course settings

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Testing editing the 'force language' setting directly:

      • Ensure the site has more than one language pack
      • Run notifications to allow new 'moodle/course:setforcedlanguage' capability to be created
      • Check the editing teacher + manager roles have the capability
      • Login as a user with the capability
      • Go to course settings page and force a language
      • Remove the 'moodle/course:setforcedlanguage' capability from the editing teacher + manager roles
      • Login as an editing teacher
      • Check you can successfully edit the course settings but cannot force a language.

      Testing uploading a course:

      • Not sure how to test a user without 'moodle/course:setforcedlanguage' using tool_uploadcourse, as only admins have access to tool_uploadcourse (AFAIK) and they automatically pass any has_capability checks ...

      Restoring a course:

      • As a user with 'moodle/course:setforcedlanguage'
        • Backup a course with 'force language' set
        • Restore this course as a new course
        • Check the new course has 'force language' set to the same value
        • Restore the course over an existing course, allowing settings to be updated
        • Check the updated course has 'force language' set to the same value
      • As a user without 'moodle/course:setforcedlanguage' set
        • Backup a course with 'force language' set
        • Restore this course as a new course
        • Check the new course does not have 'force language' set
        • Restore the course over an existing course, allowing settings to be updated
        • Check the updated course does not have 'force language' changed from the previous value

      Creating / updating a course via webservices:

      • Set up a webservice user with capability 'moodle/course:setforcedlanguage'
      • Call the 'create_courses' webservice, with 'lang' set
      • Check that the course is created with 'force language' set to the value in the webservice call
      • Call the 'update_courses' webservice, with 'lang' set to a different value to the current course 'force language'
      • Check that the course has been updated so that 'force language' matches the 'lang' specified
      • Update the webservice user to remove the capability 'moodle/course:setforcedlanguage'
      • Call the 'create_courses' webservice, with 'lang' set
      • Check that the course is created with 'force language' not set
      • Call the 'update_courses' webservice, with 'lang' set set to a different value to the current course 'force language'
      • Check that a 'require_capability' exception is thrown
      Show
      Testing editing the 'force language' setting directly: Ensure the site has more than one language pack Run notifications to allow new 'moodle/course:setforcedlanguage' capability to be created Check the editing teacher + manager roles have the capability Login as a user with the capability Go to course settings page and force a language Remove the 'moodle/course:setforcedlanguage' capability from the editing teacher + manager roles Login as an editing teacher Check you can successfully edit the course settings but cannot force a language. Testing uploading a course: Not sure how to test a user without 'moodle/course:setforcedlanguage' using tool_uploadcourse, as only admins have access to tool_uploadcourse (AFAIK) and they automatically pass any has_capability checks ... Restoring a course: As a user with 'moodle/course:setforcedlanguage' Backup a course with 'force language' set Restore this course as a new course Check the new course has 'force language' set to the same value Restore the course over an existing course, allowing settings to be updated Check the updated course has 'force language' set to the same value As a user without 'moodle/course:setforcedlanguage' set Backup a course with 'force language' set Restore this course as a new course Check the new course does not have 'force language' set Restore the course over an existing course, allowing settings to be updated Check the updated course does not have 'force language' changed from the previous value Creating / updating a course via webservices: Set up a webservice user with capability 'moodle/course:setforcedlanguage' Call the 'create_courses' webservice, with 'lang' set Check that the course is created with 'force language' set to the value in the webservice call Call the 'update_courses' webservice, with 'lang' set to a different value to the current course 'force language' Check that the course has been updated so that 'force language' matches the 'lang' specified Update the webservice user to remove the capability 'moodle/course:setforcedlanguage' Call the 'create_courses' webservice, with 'lang' set Check that the course is created with 'force language' not set Call the 'update_courses' webservice, with 'lang' set set to a different value to the current course 'force language' Check that a 'require_capability' exception is thrown
    • Affected Branches:
      MOODLE_29_STABLE, MOODLE_31_STABLE, MOODLE_33_STABLE, MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_35_STABLE
    • Pull Master Branch:
      MDL-52811_prevent_forcelang

      Description

      Following MDL-31733 which has been closed without resolution, a university has raised the issue again, as the feature still does not exist in Moodle 2.9.

      The need is to allow administrators to prevent some course creators from forcing a language on the course level.

      My suggested solution is adding a capability moodle/course:setforcedlanguage and checking for it before adding the force language element to the course create/edit form.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  17/May/18