mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Fix: Enable delete button for users with canDelete() but no canEdit() permissions
$form->makeReadonly(); iterates over all fields/actions, disabling the 'delete' button even when the user has permission
This commit is contained in:
parent
d5510f54b3
commit
dcec30f4e3
@ -381,6 +381,10 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler {
|
|||||||
if($this->record->ID && !$canEdit) {
|
if($this->record->ID && !$canEdit) {
|
||||||
// Restrict editing of existing records
|
// Restrict editing of existing records
|
||||||
$form->makeReadonly();
|
$form->makeReadonly();
|
||||||
|
// Hack to re-enable delete button if user can delete
|
||||||
|
if ($canDelete) {
|
||||||
|
$form->Actions()->fieldByName('action_doDelete')->setReadonly(false);
|
||||||
|
}
|
||||||
} elseif(!$this->record->ID && !$canCreate) {
|
} elseif(!$this->record->ID && !$canCreate) {
|
||||||
// Restrict creation of new records
|
// Restrict creation of new records
|
||||||
$form->makeReadonly();
|
$form->makeReadonly();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user