Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to get permitions for section != 'component' #4198

Closed
wants to merge 3 commits into from

Conversation

berlanda
Copy link
Contributor

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');
}
[...]

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');
}
[...]
@@ -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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a space here:

if (empty($section))

@zero-24
Copy link
Contributor

zero-24 commented Aug 31, 2014

@test successful good catch.

@berlanda
Copy link
Contributor Author

I did the changes you suggested.
I just did not understand where I would have to remove the spaces.

@zero-24
Copy link
Contributor

zero-24 commented Aug 31, 2014

@berlanda

I just did not understand where I would have to remove the spaces.

on line 123: https://github.com/joomla/joomla-cms/pull/4198/files#diff-70a9f5171aac5ecc71b5c63f03bdfee1R123 do you add two tabs that should be removed :D

@berlanda
Copy link
Contributor Author

Done. Thank you.

@zero-24
Copy link
Contributor

zero-24 commented Aug 31, 2014

thanks @berlanda so we need on more test here 👍

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

@phproberto phproberto closed this in 49058f3 Sep 6, 2014
Bakual pushed a commit to Bakual/joomla-cms that referenced this pull request Sep 24, 2014
Reverting PR joomla#4198 since it broke "Save to Copy" and "Save & New" buttons in com_content.
piotr-cz pushed a commit to piotr-cz/joomla-cms that referenced this pull request Oct 6, 2014
…a#4198

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
piotr-cz pushed a commit to piotr-cz/joomla-cms that referenced this pull request Oct 6, 2014
Reverting PR joomla#4198 since it broke "Save to Copy" and "Save & New" buttons in com_content.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants