mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
MDL-64764 core_admin: allow to submit empty list of allowed roles.
Co-authored-by: Paul Holden <paulh@moodle.com>
This commit is contained in:
parent
6aacd8d6d1
commit
95dfd8e0de
1 changed files with 7 additions and 5 deletions
|
@ -157,19 +157,19 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
|
||||||
// Allowed roles.
|
// Allowed roles.
|
||||||
$allow = optional_param_array('allowassign', null, PARAM_INT);
|
$allow = optional_param_array('allowassign', null, PARAM_INT);
|
||||||
if (!is_null($allow)) {
|
if (!is_null($allow)) {
|
||||||
$this->allowassign = $allow;
|
$this->allowassign = array_filter($allow);
|
||||||
}
|
}
|
||||||
$allow = optional_param_array('allowoverride', null, PARAM_INT);
|
$allow = optional_param_array('allowoverride', null, PARAM_INT);
|
||||||
if (!is_null($allow)) {
|
if (!is_null($allow)) {
|
||||||
$this->allowoverride = $allow;
|
$this->allowoverride = array_filter($allow);
|
||||||
}
|
}
|
||||||
$allow = optional_param_array('allowswitch', null, PARAM_INT);
|
$allow = optional_param_array('allowswitch', null, PARAM_INT);
|
||||||
if (!is_null($allow)) {
|
if (!is_null($allow)) {
|
||||||
$this->allowswitch = $allow;
|
$this->allowswitch = array_filter($allow);
|
||||||
}
|
}
|
||||||
$allow = optional_param_array('allowview', null, PARAM_INT);
|
$allow = optional_param_array('allowview', null, PARAM_INT);
|
||||||
if (!is_null($allow)) {
|
if (!is_null($allow)) {
|
||||||
$this->allowview = $allow;
|
$this->allowview = array_filter($allow);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now read the permissions for each capability.
|
// Now read the permissions for each capability.
|
||||||
|
@ -618,7 +618,9 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
|
||||||
if ($this->roleid == 0) {
|
if ($this->roleid == 0) {
|
||||||
$options[-1] = get_string('thisnewrole', 'core_role');
|
$options[-1] = get_string('thisnewrole', 'core_role');
|
||||||
}
|
}
|
||||||
return html_writer::select($options, 'allow'.$type.'[]', $selected, false, array('multiple' => 'multiple',
|
return
|
||||||
|
html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'allow'.$type.'[]', 'value' => "")) .
|
||||||
|
html_writer::select($options, 'allow'.$type.'[]', $selected, false, array('multiple' => 'multiple',
|
||||||
'size' => 10, 'class' => 'form-control'));
|
'size' => 10, 'class' => 'form-control'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue