Skip to content

Commit

Permalink
Prevent backslash in class name
Browse files Browse the repository at this point in the history
since the default code is using get_called_class, you can end up with \ in the class name which is an escape character for css selectors
this update convert for example

even valCMS_ACCESS_SilverStripe\VersionedAdmin\ArchiveAdmin
to
even valCMS_ACCESS_SilverStripe-VersionedAdmin-ArchiveAdmin

ArchiveAdmin class should probably implement     private static $required_permission_codes = 'CMS_ACCESS_ArchiveAdmin '; also
  • Loading branch information
lekoala authored and dhensby committed Jan 30, 2023
1 parent 62f71a3 commit 1664137
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Security/PermissionCheckboxSetField.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public function Field($properties = [])

$odd = ($odd + 1) % 2;
$extraClass = $odd ? 'odd' : 'even';
$extraClass .= ' val' . str_replace(' ', '', $code ?? '');
$extraClass .= ' val' . str_replace([' ', '\\'], ['', '-'], $code ?? '');
$itemID = $this->ID() . '_' . preg_replace('/[^a-zA-Z0-9]+/', '', $code ?? '');
$disabled = $inheritMessage = '';
$checked = (isset($uninheritedCodes[$code]) || isset($inheritedCodes[$code]))
Expand Down

0 comments on commit 1664137

Please sign in to comment.