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

Insight notifications should only be sent to users with the capability moodle/analytics:listowninsights

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Log in as admin
      2. Set up 1 user making sure that insights notifications are turned ON in the notification preferences.
      3. Enrol the user in a course
      4. Create 1 quiz activity in the course with time close tomorrow
      5. Go to site admin > analytics > analytics settings and untick onlycli setting
      6. Go to site admin > analytics > analytics models
      7. If the Upcoming activities due model is disabled click on Actions > Enable for Upcoming activities due model
      8. Click on Actions > Execute scheduled analysis for the upcoming activities due model and click on continue once the analysis finishes
      9. You SHOULD see a dropdown menu in the Insights column of the Upcoming activities due model (click on Actions > Clear predictions and Actions > Execute scheduled analysis if not, there may have been a recent analysis)
      10. You SHOULD see the user listed there
      11. Log in as the user you enroled in a course, you SHOULD have a new notification about upcoming activities due
      12. Go to the user profile, you SHOULD see an "Insights" link under Reports
      13. Log in back as admin
      14. Go to site admin > users > permissions > define roles, and edit authenticated user
      15. Untick moodle/analytics:listowninsights capability and save changes
      16. Go to site admin > users > permissions > capability overview to verify that moodle/analytics:listowninsights is not allowed for the authenticated user
      17. Go to site admin > analytics > analytics models
      18. Click on Actions > Clear predictions for the upcoming activities due model
      19. Click on Actions > Execute scheduled analysis for the upcoming activities due model and click on continue once the analysis finishes
      20. You SHOULD see the user listed there
      21. Log in as the user you enroled in a course, you SHOULD NOT have any new notification about upcoming activities due
      22. Go to your profile, you SHOULD NOT see an "Insights" link under Reports
      Show
      Log in as admin Set up 1 user making sure that insights notifications are turned ON in the notification preferences. Enrol the user in a course Create 1 quiz activity in the course with time close tomorrow Go to site admin > analytics > analytics settings and untick onlycli setting Go to site admin > analytics > analytics models If the Upcoming activities due model is disabled click on Actions > Enable for Upcoming activities due model Click on Actions > Execute scheduled analysis for the upcoming activities due model and click on continue once the analysis finishes You SHOULD see a dropdown menu in the Insights column of the Upcoming activities due model (click on Actions > Clear predictions and Actions > Execute scheduled analysis if not, there may have been a recent analysis) You SHOULD see the user listed there Log in as the user you enroled in a course, you SHOULD have a new notification about upcoming activities due Go to the user profile, you SHOULD see an "Insights" link under Reports Log in back as admin Go to site admin > users > permissions > define roles, and edit authenticated user Untick moodle/analytics:listowninsights capability and save changes Go to site admin > users > permissions > capability overview to verify that moodle/analytics:listowninsights is not allowed for the authenticated user Go to site admin > analytics > analytics models Click on Actions > Clear predictions for the upcoming activities due model Click on Actions > Execute scheduled analysis for the upcoming activities due model and click on continue once the analysis finishes You SHOULD see the user listed there Log in as the user you enroled in a course, you SHOULD NOT have any new notification about upcoming activities due Go to your profile, you SHOULD NOT see an "Insights" link under Reports
    • Affected Branches:
      MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE

      Description

      As has been experienced at learn.moodle.net, the site seems to send insight notifications to users even if they do not have the moodle/analytics:listowninsights capability assigned.

      The method get_insights_users() should check that CONTEXT_USER users have moodle/analytics:listowninsights capability.

      get_insights_users works also at CONTEXT_USER level since 3.7. This function is the one controlling who will get an insight notification. Users should not receive a notification about an insight if they don't have the capability to see it (moodle/analytics:listowninsights). We check that the user has the capability in check_can_list_insights (the function that controls the access to the insight) but we should not even generate a notification if the user has no permission to see it.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Sep/19

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours, 33 minutes
                4h 33m