Skip to content

Commit

Permalink
Implement a check / notification for an invalid or missing access file
Browse files Browse the repository at this point in the history
  • Loading branch information
matrikular committed Oct 28, 2016
1 parent 121704d commit 96122fd
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions libraries/cms/helper/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,27 @@ public static function getActions($component = '', $section = '', $id = 0)
return $result;
}

$user = JFactory::getUser();
$result = new JObject;

$path = JPATH_ADMINISTRATOR . '/components/' . $component . '/access.xml';
$assetName = $component;

if ($section && $id)
{
$assetName = $component . '.' . $section . '.' . (int) $id;
$assetName .= '.' . $section . '.' . (int) $id;
}
else

$result = new JObject;

$user = JFactory::getUser();

$path = JPATH_ADMINISTRATOR . '/components/' . $component . '/access.xml';

$actions = JAccess::getActionsFromFile($path, '/access/section[@name="component"]/');

if ($actions === false)
{
$assetName = $component;
}
JLog::add(JText::sprintf('JLIB_ERROR_COMPONENT_SPECIFIC_ACCESS_XML_FILE_INVALID_FORMAT_OR_MISSING', $path), JLog::ERROR, 'jerror');

$actions = JAccess::getActionsFromFile($path, "/access/section[@name='component']/");
return $result;
}

foreach ($actions as $action)
{
Expand Down

0 comments on commit 96122fd

Please sign in to comment.