Monday, December 15, 2014

Acl using PhpAcl problem

Hello Folks :)

Please help me, I have a problem with CakePHP ACL using class PhpAcl.

This is my Auth component setup in AppController

<?php
class AppController extends Controller {

    public $components = array(
        'Acl',
        'Auth' => array(
            'authorize' => array('Actions' => array('actionPath' => 'controllers/')),
            'unauthorizedRedirect' => array(
                'plugin' => null,
                'controller' => 'dashboard',
                'action' => 'index'
            ),
            'autoRedirect' => false
        ),
        'Session'
    );

this is my setup in acl.php

<?php
$config['map'] = array(
    'User' => 'User/email',
    'Role' => 'User/role', // --> field 'role' in my users table
);

/**
 * role configuration
 */
$config['roles'] = array(
    'Role/admin' => null,
    'Role/entry' => null
);

/**
 * rule configuration
 */
$config['rules'] = array(
    'allow' => array(
        '*' => 'Role/admin',
        'controllers/crm_customers/*' => 'Role/entry',
        'controllers/dashboard/index' => 'Role/entry'
    ),
    'deny' => array()
);

The problem is, Role/entry can never access crm_customers controller and its methods ,
BUT Role/admin no problem. Role/admin can access all controllers and its methods.

I also try to set only spesific method name on a controller:
$config['rules'] = array(
    'allow' => array(
        '*' => 'Role/admin',
        'controllers/crm_customers/index' => 'Role/entry',
        'controllers/crm_customers/add' => 'Role/entry',
        'controllers/crm_customers/edit' => 'Role/entry',
        'controllers/dashboard/index' => 'Role/entry'
    ),
    'deny' => array()
);

but still can never access what have been defined :(

Please help me,


Thank You :)

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: