Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Won't Fix
-
Affects Version/s: 1.9.4
-
Fix Version/s: None
-
Component/s: Gradebook
-
Labels:None
-
Affected Branches:MOODLE_19_STABLE
Description
Teachers, for example, by default, can create new grade scales for their classes but cannot designate the scale as standard. The checkbox is disabled. This is good.
The problem is that a teacher can then edit the scale and mark the scale as a standard scale. The checkbox is not disabled. This is bad for us and I doubt that it is the intended functionality.
The defect appears to be in the definition_after_data() function in grade/edit/scale/edit_form.php. The scale editing part of that function contains the following:
} else if (empty($scale->courseid) and !has_capability('moodle/course:managescales', get_context_instance(CONTEXT_SYSTEM))) {
$mform->hardFreeze('standard');
The has_capability condition should stand on its own and not be ANDed with the condition that the scale is already a standard scale. If the user does not have the capability to manage scales at the system level, the user should not be able to create a system scale.
The solution would be to remove the first part of the AND so that the condition looks like this:
} else if ( !has_capability('moodle/course:managescales', get_context_instance(CONTEXT_SYSTEM))) {
$mform->hardFreeze('standard');
That would also make it consistent with the logic for creating a scale in this respect.
This issue also appears in Moodle 1.92+.