PHP code example of fmcorz / acl-manager

1. Go to this page and download the library: Download fmcorz/acl-manager library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fmcorz / acl-manager example snippets


var $components = array('Auth', 'Acl', 'Session');

function beforeFilter() {
    //Configure AuthComponent
    $this->Auth->authorize = array(
        'Controller',
        'Actions' => array('actionPath' => 'controllers')
    );
    $this->Auth->authenticate = array(
        'Form' => array(
            'fields' => array(
                'username' => 'login',
                'password' => 'password'
            )
        )
    );
    $this->Auth->loginAction = array(
        'controller' => 'users',
        'action' => 'login',
        'admin' => false,
        'plugin' => false
    );
    $this->Auth->logoutRedirect = array(
        'controller' => 'users',
        'action' => 'login',
        'admin' => false,
        'plugin' => false
    );
    $this->Auth->loginRedirect = array(
        'controller' => 'products',
        'action' => 'index',
        'admin' => false,
        'plugin' => false
    );
}

function isAuthorized($user) {
    // return false;
    return $this->Auth->loggedIn();
}