Skip to content

Commit

Permalink
Check for admin permission of com_fields access correct
Browse files Browse the repository at this point in the history
  • Loading branch information
laoneo committed Dec 13, 2016
1 parent f7c40e1 commit 8a7f5b0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
21 changes: 10 additions & 11 deletions administrator/components/com_fields/fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,23 @@
*/
defined('_JEXEC') or die;

JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');

$app = JFactory::getApplication();
$context = $app->getUserStateFromRequest('com_fields.groups.context', 'context', '', 'CMD');
$component = '';
$context = $app->getUserStateFromRequest(
'com_fields.groups.context',
'context',
$app->getUserStateFromRequest('com_fields.fields.context', 'context', 'com_content.article', 'CMD'),
'CMD'
);

if (!$context)
{
$parts = explode('.', $app->getUserStateFromRequest('com_fields.fields.context', 'context', '', 'CMD'), 2);
$component = $parts[0];
}
$parts = FieldsHelper::extract($context);

if (!JFactory::getUser()->authorise('core.manage', $component))
if (!$parts || !JFactory::getUser()->authorise('core.manage', $parts[0]))
{
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}

JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');
JLoader::register('FieldsHelperInternal', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/internal.php');

$controller = JControllerLegacy::getInstance('Fields');
$controller->execute($app->input->get('task'));
$controller->redirect();
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ protected function getSortFields()
'a.title' => JText::_('JGLOBAL_TITLE'),
'a.access' => JText::_('JGRID_HEADING_ACCESS'),
'language' => JText::_('JGRID_HEADING_LANGUAGE'),
'a.context' => JText::_('JGRID_HEADING_context'),
'a.context' => JText::_('JGRID_HEADING_CONTEXT'),
'a.id' => JText::_('JGRID_HEADING_ID'),
);
}
Expand Down

0 comments on commit 8a7f5b0

Please sign in to comment.