mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #7342 from open-sausages/pulls/4.0/disable-me-a-plus
Fix permission check for admin role
This commit is contained in:
commit
40678d5897
@ -238,27 +238,29 @@ class PermissionCheckboxSetField extends FormField
|
||||
}
|
||||
|
||||
$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 ($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\">"
|
||||
. "<input id=\"$itemID\"$disabled name=\"$this->name[$code]\" type=\"checkbox\""
|
||||
. " value=\"$code\"$checked class=\"checkbox\" />"
|
||||
. "<label {$title}for=\"$itemID\">"
|
||||
. "<span class=\"font-icon-$icon\"></span>"
|
||||
. "$value$inheritMessage</label>"
|
||||
. "{$value}{$inheritMessage}</label>"
|
||||
. "</li>\n";
|
||||
} else {
|
||||
$options .= "<li class=\"$extraClass\">"
|
||||
. "<input id=\"$itemID\"$disabled name=\"$this->name[$code]\" type=\"checkbox\""
|
||||
. " value=\"$code\"$checked class=\"checkbox\" />"
|
||||
. "<label {$title}for=\"$itemID\">$value$inheritMessage</label>"
|
||||
. "<label {$title}for=\"$itemID\">{$value}{$inheritMessage}</label>"
|
||||
. "</li>\n";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user