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:
Loz Calver 2013-06-03 12:31:40 +01:00
parent d5510f54b3
commit dcec30f4e3

View File

@ -381,6 +381,10 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler {
if($this->record->ID && !$canEdit) {
// Restrict editing of existing records
$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) {
// Restrict creation of new records
$form->makeReadonly();