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

Course competencies page unnecessary requires capability to view competency framework

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Setup

      1. Login as admin.
      2. Access to "Site administration > Competencies > Competencies settings" and enable competencies.
      3. Access to "Site administration > Users > Permissions > Define roles" and edit the "Authenticated user" role to remove the "View competency frameworks (moodle/competency:competencyview)" capability (unchecking the "Allow" checkbox).
      4. Create a user (user1).
      5. Create a course (Course1).
      6. Enrol user1 in Course1.

      Testing scenario

      1. Login as user1.
      2. Navigate to Course1.
      3. Hit the "Competencies" link in the side menu.
      4. CHECK that the user can access to the Competencies of the course and also that the "Sorry, but you do not currently have permissions to do that (View competency frameworks)." is not displayed.
      Show
      Setup Login as admin. Access to "Site administration > Competencies > Competencies settings" and enable competencies. Access to "Site administration > Users > Permissions > Define roles" and edit the "Authenticated user" role to remove the "View competency frameworks (moodle/competency:competencyview)" capability (unchecking the "Allow" checkbox). Create a user (user1). Create a course (Course1). Enrol user1 in Course1. Testing scenario Login as user1. Navigate to Course1. Hit the "Competencies" link in the side menu. CHECK that the user can access to the Competencies of the course and also that the "Sorry, but you do not currently have permissions to do that (View competency frameworks)." is not displayed.
    • Affected Branches:
      MOODLE_31_STABLE, MOODLE_34_STABLE, MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_35_STABLE, MOODLE_36_STABLE
    • Pull from Repository:
    • Pull 3.5 Branch:
      MDL-55135-35-competencies-manage-in-coursecontext
    • Pull 3.6 Branch:
      MDL-55135-36-competencies-manage-in-coursecontext
    • Pull Master Branch:
      MDL-55135-master-competencies-manage-in-coursecontext

      Description

      If a user is given capability to view course competencies (moodle/competency:coursecompetencyview) but does not have capability to view competency frameworks (moodle/competency:competencyview), page /admin/tool/lp/coursecompetencies.php throws an exception:

      Sorry, but you do not currently have permissions to do that (View competency frameworks)
      More information about this error
       
      ×Debug info: 
      Error code: nopermissions
      ×Stack trace:
      line 4987 of /competency/classes/api.php: required_capability_exception thrown
      line 58 of /admin/tool/lp/classes/course_competency_statistics.php: call to core_competency\api::get_least_proficient_competencies_for_course()
      line 85 of /admin/tool/lp/classes/output/course_competencies_page.php: call to tool_lp\course_competency_statistics->__construct()
      line 43 of /admin/tool/lp/coursecompetencies.php: call to tool_lp\output\course_competencies_page->__construct()
      

      According to Fred, the capabilities check is not correct in core_competency\api::get_least_proficient_competencies_for_course() and it should be checking for coursecompetencyview and not competencyview

      Another thing I noticed during work on MDL-55032:
      if course has guest access and guests are given capability to view course competencies, the non-working link is displayed to the guest on this page

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/Mar/19

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours, 30 minutes
                  2h 30m