Ejemplo n.º 1
0
 public function test_init()
 {
     // check instance type
     $this->assertInstanceOf('Acl_Config', $this->acl_config);
     // check singleton
     $this->assertSame(Acl_Config::instance(), $this->acl_config);
 }
Ejemplo n.º 2
0
 /**
  * convert the permissions array stored in the database (unserialized) into
  * a config array with resource > level depth
  * @return Array $arr
  */
 public static function acl_array($permissions)
 {
     $config_acl = Acl_Config::instance()->acl();
     $arr = array();
     foreach ($config_acl as $resource => $levels) {
         $arr[$resource] = array();
         foreach ($levels as $level) {
             $key = self::repr_key($resource, $level);
             $arr[$resource][$level] = array_key_exists($key, $permissions);
         }
     }
     return $arr;
 }