Prevent a crash when not authorized to see an object of a derived class.

SVN:trunk[2502]
This commit is contained in:
Denis Flaven
2012-12-04 15:21:59 +00:00
parent 24435401a5
commit 3b0e1d9a3b

View File

@@ -699,7 +699,7 @@ try
case 'details': // Details of an object
$sClass = utils::ReadParam('class', '');
$id = utils::ReadParam('id', '');
if ( empty($sClass) || empty($id))
if ( empty($sClass) || empty($id))
{
throw new ApplicationException(Dict::Format('UI:Error:2ParametersMissing', 'class', 'id'));
}
@@ -719,7 +719,21 @@ try
}
else
{
DisplayDetails($oP, $sClass, $oObj, $id);
try
{
$oObj->Reload();
}
catch(Exception $e)
{
// Probably not allowed to see this instance of a derived class
$oObj = null;
$oP->set_title(Dict::S('UI:ErrorPageTitle'));
$oP->P(Dict::S('UI:ObjectDoesNotExist'));
}
if (!is_null($oObj))
{
DisplayDetails($oP, $sClass, $oObj, $id);
}
}
break;