Moodle

Admin block does not respect course "Show grades" setting

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.9
  • Fix Version/s: 1.9, 2.0
  • Component/s: Blocks
  • Labels:
    None
  • Database:
    Any
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE, MOODLE_20_STABLE

Description

At the moment, the "Grades" link is only hidden if the user does not have the capability to view any gradereports in the given context. If a user has the capability to view at least one gradereport, and "Show grades" is set to "No" in the course settings, the "Grades" link still appears in the Admin block (which doesn't check).

At the moment, the user and overview grade reports respect $course->showgrades. Access to a grade report is not provided to a user if $course->showgrades is turned off and the user does not have 'moodle/grade:viewall' capability.

I think the Admin block should use the same logic, so that the appearance of the "Grades" link does not confuse those users.

Activity

Hide
Martin Dougiamas added a comment -

Done

Show
Martin Dougiamas added a comment - Done
Hide
Séverin Terrier added a comment -

Verified on 1.9beta4. It can be closed (i havent' the rights to do it yet)

Show
Séverin Terrier added a comment - Verified on 1.9beta4. It can be closed (i havent' the rights to do it yet)
Hide
Nicolas Martignoni added a comment -

Closing it for you, Séverin.

To be able to close, you should ask Michael Blake at support@moodle.com so he can add you as a QA person in the tracker.

Show
Nicolas Martignoni added a comment - Closing it for you, Séverin. To be able to close, you should ask Michael Blake at support@moodle.com so he can add you as a QA person in the tracker.
Hide
Séverin Terrier added a comment -

Thanks Nicolas. I had asked Helen for that

Show
Séverin Terrier added a comment - Thanks Nicolas. I had asked Helen for that
Hide
Jonathan Newman added a comment -

I think the logic needs to be changed slightly to allow the "Grades" link to still be shown if the user has 'moodle/grade:viewall' capability. Also, I think we should use a switch over each of the core grade reports and use the access logic employed by each, and use has_capability('gradereport/'.$plugin.':view', $context) as a default. Writing a patch now and will up load asap.

Show
Jonathan Newman added a comment - I think the logic needs to be changed slightly to allow the "Grades" link to still be shown if the user has 'moodle/grade:viewall' capability. Also, I think we should use a switch over each of the core grade reports and use the access logic employed by each, and use has_capability('gradereport/'.$plugin.':view', $context) as a default. Writing a patch now and will up load asap.
Hide
Jonathan Newman added a comment -

Attaching a patch to always show grades if a user has 'moode/grade:viewall' capability.

Left out the switch for each report, since they could add overhead (eg, the user and overview report call get_complete_user_data for their access checks), and duplicate code from each report.

Show
Jonathan Newman added a comment - Attaching a patch to always show grades if a user has 'moode/grade:viewall' capability. Left out the switch for each report, since they could add overhead (eg, the user and overview report call get_complete_user_data for their access checks), and duplicate code from each report.
Hide
Martin Dougiamas added a comment -

Good idea - done that too.

(BTW, patch was back to front )

Show
Martin Dougiamas added a comment - Good idea - done that too. (BTW, patch was back to front )

People

Dates

  • Created:
    Updated:
    Resolved: