<?php
// Add the Zend Framework dir to our include_path
ini_set( "include_path", ini_get( "include_path" ).":/dir/to/zend/library" );
// We need the MyACL class
// it includes the Db adapter itself, so no need to do that here
require_once './acl.class.php';
// Connect to database
$db = Zend_Db::factory( 'mysqli', array(
'host' => 'localhost',
'username' => 'r00t',
'password' => 'w00t',
'dbname' => 't00t'
)
);
// Cre8 ACL reading from the database the adapter is connected to
$acl = new MyACL( $db );
// Now let's ask some questions, shall we?
var_dump( $acl->isAllowed( 'Editors', 'TextWritingProggie', null ) );
var_dump( $acl->isAllowed( 'Publishers', 'svn', 'commit' ) );
|