Welcome Guest, Not a member yet? Register   Sign In
Which is best for ACL?
#6

[eluser]Rick Jolly[/eluser]
There isn't much to integrating the Zend Framework components. You might find other bits of it useful as well. You can integrate other "packaged" classes like PEAR in the same way.

1) download the Zend Framework
2) put it somewhere within your CI application naming it "Zend". I put it in a folder called "Zend" within my libraries folder.
3) set your include path to the folder in which you dropped "Zend". I did this in config.php since that is always loaded:
Code:
ini_set('include_path',ini_get('include_path'). PATH_SEPARATOR . APPPATH . '/libraries/');

4) Require/include the classes you need and use it. Here is working example similar to that in the zend acl documentation:
Code:
require_once(APPPATH . '/libraries/Zend/Acl.php');
require_once(APPPATH . '/libraries/Zend/Acl/Role.php');
require_once(APPPATH . '/libraries/Zend/Acl/Resource.php');

class SomeController extends Controller
{
    function index()
    {
    $acl = new Zend_Acl();
        
    $acl->addRole(new Zend_Acl_Role('guest'));
    $acl->addRole(new Zend_Acl_Role('member'));
    $acl->addRole(new Zend_Acl_Role('admin'));
        
    $parents = array('guest', 'member', 'admin');
        
    $acl->addRole(new Zend_Acl_Role('someUser'), $parents);
        
    $acl->add(new Zend_Acl_Resource('someResource'));
    $acl->deny('guest', 'someResource');
    $acl->allow('member', 'someResource');
        
    echo ($acl->isAllowed('guest', 'someResource') ? 'allowed' : 'denied');
    }
}


Messages In This Thread
Which is best for ACL? - by El Forum - 09-07-2007, 01:45 PM
Which is best for ACL? - by El Forum - 09-07-2007, 03:16 PM
Which is best for ACL? - by El Forum - 09-07-2007, 03:28 PM
Which is best for ACL? - by El Forum - 09-07-2007, 04:23 PM
Which is best for ACL? - by El Forum - 09-07-2007, 04:49 PM
Which is best for ACL? - by El Forum - 09-07-2007, 08:11 PM
Which is best for ACL? - by El Forum - 09-08-2007, 05:56 AM
Which is best for ACL? - by El Forum - 09-08-2007, 06:39 AM
Which is best for ACL? - by El Forum - 09-08-2007, 07:36 AM
Which is best for ACL? - by El Forum - 09-08-2007, 11:27 AM
Which is best for ACL? - by El Forum - 09-08-2007, 01:25 PM
Which is best for ACL? - by El Forum - 09-08-2007, 02:22 PM
Which is best for ACL? - by El Forum - 09-08-2007, 02:42 PM
Which is best for ACL? - by El Forum - 09-08-2007, 02:51 PM
Which is best for ACL? - by El Forum - 09-08-2007, 03:42 PM
Which is best for ACL? - by El Forum - 09-08-2007, 04:04 PM
Which is best for ACL? - by El Forum - 09-08-2007, 04:29 PM
Which is best for ACL? - by El Forum - 09-08-2007, 09:10 PM
Which is best for ACL? - by El Forum - 09-08-2007, 10:33 PM
Which is best for ACL? - by El Forum - 09-09-2007, 05:11 AM
Which is best for ACL? - by El Forum - 09-09-2007, 03:51 PM
Which is best for ACL? - by El Forum - 09-09-2007, 04:41 PM
Which is best for ACL? - by El Forum - 11-13-2007, 02:01 PM
Which is best for ACL? - by El Forum - 11-13-2007, 02:34 PM
Which is best for ACL? - by El Forum - 11-13-2007, 03:15 PM
Which is best for ACL? - by El Forum - 12-01-2007, 03:50 PM
Which is best for ACL? - by El Forum - 12-01-2007, 04:54 PM
Which is best for ACL? - by El Forum - 12-01-2007, 05:39 PM



Theme © iAndrew 2016 - Forum software by © MyBB