Skip to content

Commit

Permalink
[fix] Allow to get permitions for section != 'component'. Fixes #4198
Browse files Browse the repository at this point in the history
This will allow to set ACL different groups based on category permissions, for example:
access.xml
	<section name="component">
		[...]
	</section>
	<section name="category">
		<action name="roles.list" title="roles list" description="" />
		<action name="roles.manage" title="roles manage" description="" />
	</section>

view.html.php (view of a generic component)
[...]
$this->canDo = JHelperContent::getActions('com_componentname', 'category', $item->catid);
if (!$this->canDo->get('roles.manage')) {
            JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
            $app = JFactory::getApplication();
            $app->redirect('index.php');
}
[...]

Update content.php

Update content.php
  • Loading branch information
berlanda authored and piotr-cz committed Oct 6, 2014
1 parent e2e7ff5 commit 03c2456
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libraries/cms/helper/content.php
Expand Up @@ -116,7 +116,12 @@ public static function getActions($component = '', $section = '', $id = 0)
$assetName = $component;
}

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

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

foreach ($actions as $action)
{
Expand Down

0 comments on commit 03c2456

Please sign in to comment.