From 25380eb45406b417482a03b047a5f337b3c61cbb Mon Sep 17 00:00:00 2001 From: Christopher Joe Date: Wed, 6 Sep 2017 10:21:01 +1200 Subject: [PATCH] Fix permission check for admin role --- src/Security/PermissionCheckboxSetField.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Security/PermissionCheckboxSetField.php b/src/Security/PermissionCheckboxSetField.php index fb7595d91..3ffd11e93 100644 --- a/src/Security/PermissionCheckboxSetField.php +++ b/src/Security/PermissionCheckboxSetField.php @@ -238,27 +238,29 @@ class PermissionCheckboxSetField extends FormField } $inheritMessage = '' . $inheritMessage . ''; - $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 .= "
  • " . "name[$code]\" type=\"checkbox\"" . " value=\"$code\"$checked class=\"checkbox\" />" . "" + . "{$value}{$inheritMessage}" . "
  • \n"; } else { $options .= "
  • " . "name[$code]\" type=\"checkbox\"" . " value=\"$code\"$checked class=\"checkbox\" />" - . "" + . "" . "
  • \n"; } }