mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-28 20:29:15 +02:00
Fix permission check for admin role
This commit is contained in:
parent
8425533487
commit
25380eb454
@ -238,27 +238,29 @@ class PermissionCheckboxSetField extends FormField
|
|||||||
}
|
}
|
||||||
|
|
||||||
$inheritMessage = '<small>' . $inheritMessage . '</small>';
|
$inheritMessage = '<small>' . $inheritMessage . '</small>';
|
||||||
$icon = ($checked) ? 'check-mark-circle' : 'cancel-circled';
|
|
||||||
|
|
||||||
// Inherited codes are shown as a gray x
|
|
||||||
if (Permission::check('ADMIN') && $code != 'ADMIN') {
|
|
||||||
$icon = 'disable-circled';
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the field is readonly, add a span that will replace the disabled checkbox input
|
// If the field is readonly, add a span that will replace the disabled checkbox input
|
||||||
if ($this->readonly) {
|
if ($this->readonly) {
|
||||||
|
$icon = ($checked) ? 'check-mark-circle' : 'cancel-circled';
|
||||||
|
$record = $this->form->getRecord();
|
||||||
|
// Inherited codes are shown as a gray x
|
||||||
|
if ($record && $record instanceof Member &&
|
||||||
|
Permission::checkMember($record, 'ADMIN') && $code != 'ADMIN') {
|
||||||
|
$icon = 'plus-circled';
|
||||||
|
}
|
||||||
|
|
||||||
$options .= "<li class=\"$extraClass\">"
|
$options .= "<li class=\"$extraClass\">"
|
||||||
. "<input id=\"$itemID\"$disabled name=\"$this->name[$code]\" type=\"checkbox\""
|
. "<input id=\"$itemID\"$disabled name=\"$this->name[$code]\" type=\"checkbox\""
|
||||||
. " value=\"$code\"$checked class=\"checkbox\" />"
|
. " value=\"$code\"$checked class=\"checkbox\" />"
|
||||||
. "<label {$title}for=\"$itemID\">"
|
. "<label {$title}for=\"$itemID\">"
|
||||||
. "<span class=\"font-icon-$icon\"></span>"
|
. "<span class=\"font-icon-$icon\"></span>"
|
||||||
. "$value$inheritMessage</label>"
|
. "{$value}{$inheritMessage}</label>"
|
||||||
. "</li>\n";
|
. "</li>\n";
|
||||||
} else {
|
} else {
|
||||||
$options .= "<li class=\"$extraClass\">"
|
$options .= "<li class=\"$extraClass\">"
|
||||||
. "<input id=\"$itemID\"$disabled name=\"$this->name[$code]\" type=\"checkbox\""
|
. "<input id=\"$itemID\"$disabled name=\"$this->name[$code]\" type=\"checkbox\""
|
||||||
. " value=\"$code\"$checked class=\"checkbox\" />"
|
. " value=\"$code\"$checked class=\"checkbox\" />"
|
||||||
. "<label {$title}for=\"$itemID\">$value$inheritMessage</label>"
|
. "<label {$title}for=\"$itemID\">{$value}{$inheritMessage}</label>"
|
||||||
. "</li>\n";
|
. "</li>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user