The example below creates the component
controller, sets the controller's ACO section, and executes the task:
$task = JRequest->getVar('task', 'view', 'GET', 'WORD');
$controller = new myExtensionController();
$controller->setAccessControl('com_myExtension');
$controller->execute($task);
When we run execute(), if the controller knows which ACO section to look at, it
will check the permissions of the current user's group. The example above checks for
permissions to ACO com_myExtension > $task.
We don't have to use the task as the section value; instead we can use the optional
second parameter in the setAccessControl() method. This example checks for
permissions to the ACO com_myExtension > manage irrespective of the task:
$task = JRequest->getVar('task', 'view', 'GET', 'WORD');
$controller = new myExtensionController();
$controller->setAccessControl('com_myExtension', 'manage');
$controller->execute($task);
Chapter 11
[ 327 ]
When dealing with more complex permissions we can use AXOs to extend ACOs.
Pages:
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451