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

Exceptions due to inconsistent profile field visibility checking in reports

XMLWordPrintable

    • MOODLE_400_STABLE, MOODLE_401_STABLE
    • MOODLE_400_STABLE, MOODLE_401_STABLE
    • MDL-76873-401
    • Hide

      400

      1. Covered by automated testing

      401/master

      Setup

      1. Log in as admin
      2. Navigate to Users > Accounts > User profile fields in site administration
      3. Create a new Text input profile field
        • Shortname: notvisible
        • Name: Not visible field
        • Who is this field visible to: Not visible
        • Character limit: 200
      4. Create another Text input profile field
        • Shortname: visible
        • Name: Visible field
        • Who is this field visible to: Visible to user, teachers and admins
        • Character limit: 200
      5. Navigate to Users > Permissions > User policies
      6. Add the following to Show user identity configuration:
        • Not visible field *
        • Visible field *
      7. Navigate to Users > Permissions > Define roles in site administration
      8. Edit the Manager role
      9. Remove moodle/user:viewalldetails capability and save changes
      10. Create new user account
      11. Assign them to Manager system role
      12. Log out

      Manual test

      1. Log in as test user
      2. Navigate to Reports from user menu
      3. Create new report from Users source
      4. In report editor, switch to Audience tab
      5. Add Assigned system role audience type
        • Select a role: Manager
        • Save changes
      6. Switch to Access tab
      7. Confirm tab loads without exceptions
      8. Confirm Invisible field column is not present in report
      9. Confirm Visible field column is present in report
      10. Log out
      11. Log in again as admin
      12. Navigate to Reports in user menu
      13. Press on previously create report
      14. In report editor, switch to Access tab
      15. Confirm both Not visible field and Visible field columns are present in report
      Show
      400 Covered by automated testing 401/master Setup Log in as admin Navigate to Users > Accounts > User profile fields in site administration Create a new Text input profile field Shortname: notvisible Name: Not visible field Who is this field visible to: Not visible Character limit: 200 Create another Text input profile field Shortname: visible Name: Visible field Who is this field visible to: Visible to user, teachers and admins Character limit: 200 Navigate to Users > Permissions > User policies Add the following to Show user identity configuration: Not visible field * Visible field * Navigate to Users > Permissions > Define roles in site administration Edit the Manager role Remove moodle/user:viewalldetails capability and save changes Create new user account Assign them to Manager system role Log out Manual test Log in as test user Navigate to Reports from user menu Create new report from Users source In report editor, switch to Audience tab Add Assigned system role audience type Select a role: Manager Save changes Switch to Access tab Confirm tab loads without exceptions Confirm Invisible field column is not present in report Confirm Visible field column is present in report Log out Log in again as admin Navigate to Reports in user menu Press on previously create report In report editor, switch to Access tab Confirm both Not visible field and Visible field columns are present in report
    • WP Sprint 2023-I1.2 (David), WP Sprint 2023-I1.1 (David)

      This was originally reported by a Workplace partner (see WP-4030, thanks dag), but should be fixed in LMS as the bug originates there

      codingerror
      Coding error detected, it must be fixed by a programmer: Invalid column name
      File: ...ses/local/entities/base.php
      Line: 252
      Stack trace:
       
      profilefield_visibleuta
      Error code: codingerror
      * line 252 of /reportbuilder/classes/local/entities/base.php: coding_exception thrown
      * line 122 of /reportbuilder/classes/local/entities/user.php: call to core_reportbuilder\local\entities\base->get_column()
      * line 89 of /reportbuilder/classes/local/systemreports/report_access_list.php: call to core_reportbuilder\local\entities\user->get_identity_column()
      * line 61 of /reportbuilder/classes/local/systemreports/report_access_list.php: call to core_reportbuilder\local\systemreports\report_access_list->add_columns()
      * line 102 of /reportbuilder/classes/local/report/base.php: call to core_reportbuilder\local\systemreports\report_access_list->initialise()
      * line 70 of /reportbuilder/classes/system_report.php: call to core_reportbuilder\local\report\base->__construct()
      * line 64 of /reportbuilder/classes/manager.php: call to core_reportbuilder\system_report->__construct()
      * line 56 of /reportbuilder/classes/system_report_factory.php: call to core_reportbuilder\manager::get_report_from_persistent()
      * line 46 of /reportbuilder/classes/output/dynamictabs/access.php: call to core_reportbuilder\system_report_factory::create()
      * line 92 of /lib/classes/external/dynamic_tabs_get_content.php: call to core_reportbuilder\output\dynamictabs\access->export_for_template()
      * line 261 of /lib/externallib.php: call to core\external\dynamic_tabs_get_content::execute()
      * line 81 of /lib/ajax/service.php: call to external_api::call_external_function()
      

      The problem occurs because Report builder inconsistently determines the visibility of a user profile field, and differs from the actual implementation within the profile field API

      Note that the \core_user\fields class also ought to avoid re-implementing the same/similar logic (which Report builder calls) but that is currently a bit tricky because it's not at all easy or convenient to do so (we'll fix that too)

        1. 401.gif
          401.gif
          636 kB
        2. error.png
          error.png
          57 kB
        3. master.gif
          master.gif
          581 kB

            pholden Paul Holden
            pholden Paul Holden
            David Carrillo David Carrillo
            Ilya Tregubov Ilya Tregubov
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 39 minutes
                3h 39m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.