Let's imagine we have a number of categories in our extension and we want to set
manage permissions on each category. This example grants permissions to ACO
group users > super administrator to ACO com_myExtension > manage AXO
category > some category:
$acl =& JFactory::getACL();
$acl->_mos_add_acl('com_myExtension', 'manage', 'users', 'super
administrator', 'category', 'some category');
Unlike when we were dealing with just an ACO and ARO, we cannot use this in
conjunction with a JController subclass. This is because the JController class is unable
to deal with AXOs. Instead we should use the JUser object to check permissions:
$user =& JFactory->getUser();
if( ! $user-> authorize('com_myExtension', 'manage', 'category',
'some category') )
{
JError::raiseError('403', JText::_('Access Forbidden'));
}
When you define your ACOs you should always use the name of your extension
as the ACO section. How you choose to define your ACO section value and your
AXOs is entirely up to you. There is a great deal of emphasis put on the flexibility
of Joomla!.
Pages:
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452