...
Info |
---|
title | Is my plugin required to use the ACL? |
---|
|
Your plugin is not required to use the ACL, but it's a good idea. Using the ACL allows users who install your plugin finer grained control over where your plugin can appear and who can use it. |
Enforcing the ACL
Every controller that inherits from AppController (either directly or indirectly) can enforce the ACL rules on the requested resource simply by invoking the requireLogin() method.
Code Block |
---|
language | php |
---|
title | /plugins/my_plugin/controllers/client_main.php |
---|
firstline | 1 |
---|
linenumbers | true |
---|
|
<?php
class ClientMain extends MyPluginController {
public function preAction() {
parent::preAction();
// Login required
$this->requireLogin();
}
public function index() {
// Automatically protected by the ACL
}
}
?> |