mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
[DOCS] Better debug text for errors generated by GridFieldDetailForm_ItemRequest
This commit is contained in:
parent
ba3deb9b72
commit
24bc80ed35
@ -111,6 +111,8 @@ en:
|
|||||||
NEW: 'Add new record'
|
NEW: 'Add new record'
|
||||||
NEXT: 'Go to next record'
|
NEXT: 'Go to next record'
|
||||||
PREVIOUS: 'Go to previous record'
|
PREVIOUS: 'Go to previous record'
|
||||||
|
EditPermissionsFailure: 'It seems you don''t have the necessary permissions to edit {ObjectTitle}'
|
||||||
|
ViewPermissionsFailure: 'It seems you don''t have the necessary permissions to view {ObjectTitle}'
|
||||||
SilverStripe\Forms\GridField\GridFieldEditButton:
|
SilverStripe\Forms\GridField\GridFieldEditButton:
|
||||||
EDIT: Edit
|
EDIT: Edit
|
||||||
SilverStripe\Forms\GridField\GridFieldFilterHeader:
|
SilverStripe\Forms\GridField\GridFieldFilterHeader:
|
||||||
|
@ -111,7 +111,12 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
|
|||||||
public function view($request)
|
public function view($request)
|
||||||
{
|
{
|
||||||
if (!$this->record->canView()) {
|
if (!$this->record->canView()) {
|
||||||
$this->httpError(403);
|
$this->httpError(403, _t(
|
||||||
|
__CLASS__.'.ViewPermissionsFailure',
|
||||||
|
'It seems you don\'t have the necessary permissions to view {ObjectTitle}',
|
||||||
|
'',
|
||||||
|
['ObjectTitle' => $this->record->singular_name()]
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
$controller = $this->getToplevelController();
|
$controller = $this->getToplevelController();
|
||||||
@ -189,8 +194,12 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
|
|||||||
|
|
||||||
if (!$this->record->canView()) {
|
if (!$this->record->canView()) {
|
||||||
$controller = $this->getToplevelController();
|
$controller = $this->getToplevelController();
|
||||||
// TODO More friendly error
|
return $controller->httpError(403, _t(
|
||||||
return $controller->httpError(403);
|
__CLASS__.'.ViewPermissionsFailure',
|
||||||
|
'It seems you don\'t have the necessary permissions to view {ObjectTitle}',
|
||||||
|
'',
|
||||||
|
['ObjectTitle' => $this->record->singular_name()]
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields = $this->component->getFields();
|
$fields = $this->component->getFields();
|
||||||
@ -490,7 +499,13 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
|
|||||||
|
|
||||||
// Check permission
|
// Check permission
|
||||||
if (!$this->record->canEdit()) {
|
if (!$this->record->canEdit()) {
|
||||||
return $this->httpError(403);
|
$this->httpError(403, _t(
|
||||||
|
__CLASS__.'.EditPermissionsFailure',
|
||||||
|
'It seems you don\'t have the necessary permissions to edit {ObjectTitle}',
|
||||||
|
'',
|
||||||
|
['ObjectTitle' => $this->record->singular_name()]
|
||||||
|
));
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save from form data
|
// Save from form data
|
||||||
|
Loading…
Reference in New Issue
Block a user