PageRenderTime 23ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/cake/tests/cases/libs/controller/components/acl.test.php

http://github.com/Datawalke/Coordino
PHP | 646 lines | 301 code | 71 blank | 274 comment | 6 complexity | 1e40b70a0ed3a2c2fa4f3f5b5d95c068 MD5 | raw file
  1. <?php
  2. /**
  3. * AclComponentTest file
  4. *
  5. * PHP versions 4 and 5
  6. *
  7. * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
  8. * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
  9. *
  10. * Licensed under The Open Group Test Suite License
  11. * Redistributions of files must retain the above copyright notice.
  12. *
  13. * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
  14. * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
  15. * @package cake
  16. * @subpackage cake.tests.cases.libs.controller.components
  17. * @since CakePHP(tm) v 1.2.0.5435
  18. * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
  19. */
  20. if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
  21. define('CAKEPHP_UNIT_TEST_EXECUTION', 1);
  22. }
  23. App::import(array('controller' .DS . 'components' . DS . 'acl', 'model' . DS . 'db_acl'));
  24. /**
  25. * AclNodeTwoTestBase class
  26. *
  27. * @package cake
  28. * @subpackage cake.tests.cases.libs.controller.components
  29. */
  30. class AclNodeTwoTestBase extends AclNode {
  31. /**
  32. * useDbConfig property
  33. *
  34. * @var string 'test_suite'
  35. * @access public
  36. */
  37. var $useDbConfig = 'test_suite';
  38. /**
  39. * cacheSources property
  40. *
  41. * @var bool false
  42. * @access public
  43. */
  44. var $cacheSources = false;
  45. }
  46. /**
  47. * AroTwoTest class
  48. *
  49. * @package cake
  50. * @subpackage cake.tests.cases.libs.controller.components
  51. */
  52. class AroTwoTest extends AclNodeTwoTestBase {
  53. /**
  54. * name property
  55. *
  56. * @var string 'AroTwoTest'
  57. * @access public
  58. */
  59. var $name = 'AroTwoTest';
  60. /**
  61. * useTable property
  62. *
  63. * @var string 'aro_twos'
  64. * @access public
  65. */
  66. var $useTable = 'aro_twos';
  67. /**
  68. * hasAndBelongsToMany property
  69. *
  70. * @var array
  71. * @access public
  72. */
  73. var $hasAndBelongsToMany = array('AcoTwoTest' => array('with' => 'PermissionTwoTest'));
  74. }
  75. /**
  76. * AcoTwoTest class
  77. *
  78. * @package cake
  79. * @subpackage cake.tests.cases.libs.controller.components
  80. */
  81. class AcoTwoTest extends AclNodeTwoTestBase {
  82. /**
  83. * name property
  84. *
  85. * @var string 'AcoTwoTest'
  86. * @access public
  87. */
  88. var $name = 'AcoTwoTest';
  89. /**
  90. * useTable property
  91. *
  92. * @var string 'aco_twos'
  93. * @access public
  94. */
  95. var $useTable = 'aco_twos';
  96. /**
  97. * hasAndBelongsToMany property
  98. *
  99. * @var array
  100. * @access public
  101. */
  102. var $hasAndBelongsToMany = array('AroTwoTest' => array('with' => 'PermissionTwoTest'));
  103. }
  104. /**
  105. * PermissionTwoTest class
  106. *
  107. * @package cake
  108. * @subpackage cake.tests.cases.libs.controller.components
  109. */
  110. class PermissionTwoTest extends CakeTestModel {
  111. /**
  112. * name property
  113. *
  114. * @var string 'PermissionTwoTest'
  115. * @access public
  116. */
  117. var $name = 'PermissionTwoTest';
  118. /**
  119. * useTable property
  120. *
  121. * @var string 'aros_aco_twos'
  122. * @access public
  123. */
  124. var $useTable = 'aros_aco_twos';
  125. /**
  126. * cacheQueries property
  127. *
  128. * @var bool false
  129. * @access public
  130. */
  131. var $cacheQueries = false;
  132. /**
  133. * belongsTo property
  134. *
  135. * @var array
  136. * @access public
  137. */
  138. var $belongsTo = array('AroTwoTest' => array('foreignKey' => 'aro_id'), 'AcoTwoTest' => array('foreignKey' => 'aco_id'));
  139. /**
  140. * actsAs property
  141. *
  142. * @var mixed null
  143. * @access public
  144. */
  145. var $actsAs = null;
  146. }
  147. /**
  148. * DbAclTwoTest class
  149. *
  150. * @package cake
  151. * @subpackage cake.tests.cases.libs.controller.components
  152. */
  153. class DbAclTwoTest extends DbAcl {
  154. /**
  155. * construct method
  156. *
  157. * @access private
  158. * @return void
  159. */
  160. function __construct() {
  161. $this->Aro =& new AroTwoTest();
  162. $this->Aro->Permission =& new PermissionTwoTest();
  163. $this->Aco =& new AcoTwoTest();
  164. $this->Aro->Permission =& new PermissionTwoTest();
  165. }
  166. }
  167. /**
  168. * IniAclTest class
  169. *
  170. * @package cake
  171. * @subpackage cake.tests.cases.libs.controller.components
  172. */
  173. class IniAclTest extends IniAcl {
  174. }
  175. /**
  176. * ACL Component Text case
  177. *
  178. * @package cake
  179. * @subpackage cake.tests.cases.libs.controller.components
  180. */
  181. class AclComponentTest extends CakeTestCase {
  182. /**
  183. * fixtures property
  184. *
  185. * @var array
  186. * @access public
  187. */
  188. var $fixtures = array('core.aro_two', 'core.aco_two', 'core.aros_aco_two');
  189. /**
  190. * startTest method
  191. *
  192. * @access public
  193. * @return void
  194. */
  195. function startTest() {
  196. $this->Acl =& new AclComponent();
  197. }
  198. /**
  199. * before method
  200. *
  201. * @param mixed $method
  202. * @access public
  203. * @return void
  204. */
  205. function before($method) {
  206. Configure::write('Acl.classname', 'DbAclTwoTest');
  207. Configure::write('Acl.database', 'test_suite');
  208. parent::before($method);
  209. }
  210. /**
  211. * tearDown method
  212. *
  213. * @access public
  214. * @return void
  215. */
  216. function tearDown() {
  217. unset($this->Acl);
  218. }
  219. /**
  220. * testAclCreate method
  221. *
  222. * @access public
  223. * @return void
  224. */
  225. function testAclCreate() {
  226. $this->Acl->Aro->create(array('alias' => 'Chotchkey'));
  227. $this->assertTrue($this->Acl->Aro->save());
  228. $parent = $this->Acl->Aro->id;
  229. $this->Acl->Aro->create(array('parent_id' => $parent, 'alias' => 'Joanna'));
  230. $this->assertTrue($this->Acl->Aro->save());
  231. $this->Acl->Aro->create(array('parent_id' => $parent, 'alias' => 'Stapler'));
  232. $this->assertTrue($this->Acl->Aro->save());
  233. $root = $this->Acl->Aco->node('ROOT');
  234. $parent = $root[0]['AcoTwoTest']['id'];
  235. $this->Acl->Aco->create(array('parent_id' => $parent, 'alias' => 'Drinks'));
  236. $this->assertTrue($this->Acl->Aco->save());
  237. $this->Acl->Aco->create(array('parent_id' => $parent, 'alias' => 'PiecesOfFlair'));
  238. $this->assertTrue($this->Acl->Aco->save());
  239. }
  240. /**
  241. * testAclCreateWithParent method
  242. *
  243. * @access public
  244. * @return void
  245. */
  246. function testAclCreateWithParent() {
  247. $parent = $this->Acl->Aro->findByAlias('Peter', null, null, -1);
  248. $this->Acl->Aro->create();
  249. $this->Acl->Aro->save(array(
  250. 'alias' => 'Subordinate',
  251. 'model' => 'User',
  252. 'foreign_key' => 7,
  253. 'parent_id' => $parent['AroTwoTest']['id']
  254. ));
  255. $result = $this->Acl->Aro->findByAlias('Subordinate', null, null, -1);
  256. $this->assertEqual($result['AroTwoTest']['lft'], 16);
  257. $this->assertEqual($result['AroTwoTest']['rght'], 17);
  258. }
  259. /**
  260. * testDbAclAllow method
  261. *
  262. * @access public
  263. * @return void
  264. */
  265. function testDbAclAllow() {
  266. $this->assertFalse($this->Acl->check('Micheal', 'tpsReports', 'read'));
  267. $this->assertTrue($this->Acl->allow('Micheal', 'tpsReports', array('read', 'delete', 'update')));
  268. $this->assertTrue($this->Acl->check('Micheal', 'tpsReports', 'update'));
  269. $this->assertTrue($this->Acl->check('Micheal', 'tpsReports', 'read'));
  270. $this->assertTrue($this->Acl->check('Micheal', 'tpsReports', 'delete'));
  271. $this->assertFalse($this->Acl->check('Micheal', 'tpsReports', 'create'));
  272. $this->assertTrue($this->Acl->allow('Micheal', 'ROOT/tpsReports', 'create'));
  273. $this->assertTrue($this->Acl->check('Micheal', 'tpsReports', 'create'));
  274. $this->assertTrue($this->Acl->check('Micheal', 'tpsReports', 'delete'));
  275. $this->assertTrue($this->Acl->allow('Micheal', 'printers', 'create'));
  276. // Michael no longer has his delete permission for tpsReports!
  277. $this->assertTrue($this->Acl->check('Micheal', 'tpsReports', 'delete'));
  278. $this->assertTrue($this->Acl->check('Micheal', 'printers', 'create'));
  279. $this->assertFalse($this->Acl->check('root/users/Samir', 'ROOT/tpsReports/view'));
  280. $this->assertTrue($this->Acl->allow('root/users/Samir', 'ROOT/tpsReports/view', '*'));
  281. $this->assertTrue($this->Acl->check('Samir', 'view', 'read'));
  282. $this->assertTrue($this->Acl->check('root/users/Samir', 'ROOT/tpsReports/view', 'update'));
  283. $this->assertFalse($this->Acl->check('root/users/Samir', 'ROOT/tpsReports/update','*'));
  284. $this->assertTrue($this->Acl->allow('root/users/Samir', 'ROOT/tpsReports/update', '*'));
  285. $this->assertTrue($this->Acl->check('Samir', 'update', 'read'));
  286. $this->assertTrue($this->Acl->check('root/users/Samir', 'ROOT/tpsReports/update', 'update'));
  287. // Samir should still have his tpsReports/view permissions, but does not
  288. $this->assertTrue($this->Acl->check('root/users/Samir', 'ROOT/tpsReports/view', 'update'));
  289. $this->expectError('DbAcl::allow() - Invalid node');
  290. $this->assertFalse($this->Acl->allow('Lumbergh', 'ROOT/tpsReports/DoesNotExist', 'create'));
  291. $this->expectError('DbAcl::allow() - Invalid node');
  292. $this->assertFalse($this->Acl->allow('Homer', 'tpsReports', 'create'));
  293. }
  294. /**
  295. * testDbAclCheck method
  296. *
  297. * @access public
  298. * @return void
  299. */
  300. function testDbAclCheck() {
  301. $this->assertTrue($this->Acl->check('Samir', 'print', 'read'));
  302. $this->assertTrue($this->Acl->check('Lumbergh', 'current', 'read'));
  303. $this->assertFalse($this->Acl->check('Milton', 'smash', 'read'));
  304. $this->assertFalse($this->Acl->check('Milton', 'current', 'update'));
  305. $this->expectError("DbAcl::check() - Failed ARO/ACO node lookup in permissions check. Node references:\nAro: WRONG\nAco: tpsReports");
  306. $this->assertFalse($this->Acl->check('WRONG', 'tpsReports', 'read'));
  307. $this->expectError("ACO permissions key foobar does not exist in DbAcl::check()");
  308. $this->assertFalse($this->Acl->check('Lumbergh', 'smash', 'foobar'));
  309. $this->expectError("DbAcl::check() - Failed ARO/ACO node lookup in permissions check. Node references:\nAro: users\nAco: NonExistant");
  310. $this->assertFalse($this->Acl->check('users', 'NonExistant', 'read'));
  311. $this->assertFalse($this->Acl->check(null, 'printers', 'create'));
  312. $this->assertFalse($this->Acl->check('managers', null, 'read'));
  313. $this->assertTrue($this->Acl->check('Bobs', 'ROOT/tpsReports/view/current', 'read'));
  314. $this->assertFalse($this->Acl->check('Samir', 'ROOT/tpsReports/update', 'read'));
  315. $this->assertFalse($this->Acl->check('root/users/Milton', 'smash', 'delete'));
  316. }
  317. /**
  318. * testDbAclCascadingDeny function
  319. *
  320. * Setup the acl permissions such that Bobs inherits from admin.
  321. * deny Admin delete access to a specific resource, check the permisssions are inherited.
  322. *
  323. * @access public
  324. * @return void
  325. */
  326. function testDbAclCascadingDeny() {
  327. $this->Acl->inherit('Bobs', 'ROOT', '*');
  328. $this->assertTrue($this->Acl->check('admin', 'tpsReports', 'delete'));
  329. $this->assertTrue($this->Acl->check('Bobs', 'tpsReports', 'delete'));
  330. $this->Acl->deny('admin', 'tpsReports', 'delete');
  331. $this->assertFalse($this->Acl->check('admin', 'tpsReports', 'delete'));
  332. $this->assertFalse($this->Acl->check('Bobs', 'tpsReports', 'delete'));
  333. }
  334. /**
  335. * testDbAclDeny method
  336. *
  337. * @access public
  338. * @return void
  339. */
  340. function testDbAclDeny() {
  341. $this->assertTrue($this->Acl->check('Micheal', 'smash', 'delete'));
  342. $this->Acl->deny('Micheal', 'smash', 'delete');
  343. $this->assertFalse($this->Acl->check('Micheal', 'smash', 'delete'));
  344. $this->assertTrue($this->Acl->check('Micheal', 'smash', 'read'));
  345. $this->assertTrue($this->Acl->check('Micheal', 'smash', 'create'));
  346. $this->assertTrue($this->Acl->check('Micheal', 'smash', 'update'));
  347. $this->assertFalse($this->Acl->check('Micheal', 'smash', '*'));
  348. $this->assertTrue($this->Acl->check('Samir', 'refill', '*'));
  349. $this->Acl->deny('Samir', 'refill', '*');
  350. $this->assertFalse($this->Acl->check('Samir', 'refill', 'create'));
  351. $this->assertFalse($this->Acl->check('Samir', 'refill', 'update'));
  352. $this->assertFalse($this->Acl->check('Samir', 'refill', 'read'));
  353. $this->assertFalse($this->Acl->check('Samir', 'refill', 'delete'));
  354. $result = $this->Acl->Aro->Permission->find('all', array('conditions' => array('AroTwoTest.alias' => 'Samir')));
  355. $expected = '-1';
  356. $this->assertEqual($result[0]['PermissionTwoTest']['_delete'], $expected);
  357. $this->expectError('DbAcl::allow() - Invalid node');
  358. $this->assertFalse($this->Acl->deny('Lumbergh', 'ROOT/tpsReports/DoesNotExist', 'create'));
  359. }
  360. /**
  361. * testAclNodeLookup method
  362. *
  363. * @access public
  364. * @return void
  365. */
  366. function testAclNodeLookup() {
  367. $result = $this->Acl->Aro->node('root/users/Samir');
  368. $expected = array(
  369. array('AroTwoTest' => array('id' => '7', 'parent_id' => '4', 'model' => 'User', 'foreign_key' => 3, 'alias' => 'Samir')),
  370. array('AroTwoTest' => array('id' => '4', 'parent_id' => '1', 'model' => 'Group', 'foreign_key' => 3, 'alias' => 'users')),
  371. array('AroTwoTest' => array('id' => '1', 'parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'root'))
  372. );
  373. $this->assertEqual($result, $expected);
  374. $result = $this->Acl->Aco->node('ROOT/tpsReports/view/current');
  375. $expected = array(
  376. array('AcoTwoTest' => array('id' => '4', 'parent_id' => '3', 'model' => null, 'foreign_key' => null, 'alias' => 'current')),
  377. array('AcoTwoTest' => array('id' => '3', 'parent_id' => '2', 'model' => null, 'foreign_key' => null, 'alias' => 'view')),
  378. array('AcoTwoTest' => array('id' => '2', 'parent_id' => '1', 'model' => null, 'foreign_key' => null, 'alias' => 'tpsReports')),
  379. array('AcoTwoTest' => array('id' => '1', 'parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'ROOT')),
  380. );
  381. $this->assertEqual($result, $expected);
  382. }
  383. /**
  384. * testDbInherit method
  385. *
  386. * @access public
  387. * @return void
  388. */
  389. function testDbInherit() {
  390. //parent doesn't have access inherit should still deny
  391. $this->assertFalse($this->Acl->check('Milton', 'smash', 'delete'));
  392. $this->Acl->inherit('Milton', 'smash', 'delete');
  393. $this->assertFalse($this->Acl->check('Milton', 'smash', 'delete'));
  394. //inherit parent
  395. $this->assertFalse($this->Acl->check('Milton', 'smash', 'read'));
  396. $this->Acl->inherit('Milton', 'smash', 'read');
  397. $this->assertTrue($this->Acl->check('Milton', 'smash', 'read'));
  398. }
  399. /**
  400. * testDbGrant method
  401. *
  402. * @access public
  403. * @return void
  404. */
  405. function testDbGrant() {
  406. $this->assertFalse($this->Acl->check('Samir', 'tpsReports', 'create'));
  407. $this->Acl->grant('Samir', 'tpsReports', 'create');
  408. $this->assertTrue($this->Acl->check('Samir', 'tpsReports', 'create'));
  409. $this->assertFalse($this->Acl->check('Micheal', 'view', 'read'));
  410. $this->Acl->grant('Micheal', 'view', array('read', 'create', 'update'));
  411. $this->assertTrue($this->Acl->check('Micheal', 'view', 'read'));
  412. $this->assertTrue($this->Acl->check('Micheal', 'view', 'create'));
  413. $this->assertTrue($this->Acl->check('Micheal', 'view', 'update'));
  414. $this->assertFalse($this->Acl->check('Micheal', 'view', 'delete'));
  415. $this->expectError('DbAcl::allow() - Invalid node');
  416. $this->assertFalse($this->Acl->grant('Peter', 'ROOT/tpsReports/DoesNotExist', 'create'));
  417. }
  418. /**
  419. * testDbRevoke method
  420. *
  421. * @access public
  422. * @return void
  423. */
  424. function testDbRevoke() {
  425. $this->assertTrue($this->Acl->check('Bobs', 'tpsReports', 'read'));
  426. $this->Acl->revoke('Bobs', 'tpsReports', 'read');
  427. $this->assertFalse($this->Acl->check('Bobs', 'tpsReports', 'read'));
  428. $this->assertTrue($this->Acl->check('users', 'printers', 'read'));
  429. $this->Acl->revoke('users', 'printers', 'read');
  430. $this->assertFalse($this->Acl->check('users', 'printers', 'read'));
  431. $this->assertFalse($this->Acl->check('Samir', 'printers', 'read'));
  432. $this->assertFalse($this->Acl->check('Peter', 'printers', 'read'));
  433. $this->expectError('DbAcl::allow() - Invalid node');
  434. $this->assertFalse($this->Acl->deny('Bobs', 'ROOT/printers/DoesNotExist', 'create'));
  435. }
  436. /**
  437. * testStartup method
  438. *
  439. * @access public
  440. * @return void
  441. */
  442. function testStartup() {
  443. $controller = new Controller();
  444. $this->assertTrue($this->Acl->startup($controller));
  445. }
  446. /**
  447. * testIniReadConfigFile
  448. *
  449. * @access public
  450. * @return void
  451. */
  452. function testIniReadConfigFile() {
  453. Configure::write('Acl.classname', 'IniAclTest');
  454. unset($this->Acl);
  455. $this->Acl = new AclComponent();
  456. $iniFile = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'config'. DS . 'acl.ini.php';
  457. $result = $this->Acl->_Instance->readConfigFile($iniFile);
  458. $expected = array(
  459. 'admin' => array(
  460. 'groups' => 'administrators',
  461. 'allow' => '',
  462. 'deny' => 'ads',
  463. ),
  464. 'paul' => array(
  465. 'groups' => 'users',
  466. 'allow' =>'',
  467. 'deny' => '',
  468. ),
  469. 'jenny' => array(
  470. 'groups' => 'users',
  471. 'allow' => 'ads',
  472. 'deny' => 'images, files',
  473. ),
  474. 'nobody' => array(
  475. 'groups' => 'anonymous',
  476. 'allow' => '',
  477. 'deny' => '',
  478. ),
  479. 'administrators' => array(
  480. 'deny' => '',
  481. 'allow' => 'posts, comments, images, files, stats, ads',
  482. ),
  483. 'users' => array(
  484. 'allow' => 'posts, comments, images, files',
  485. 'deny' => 'stats, ads',
  486. ),
  487. 'anonymous' => array(
  488. 'allow' => '',
  489. 'deny' => 'posts, comments, images, files, stats, ads',
  490. ),
  491. );
  492. $this->assertEqual($result, $expected);
  493. }
  494. /**
  495. * testIniCheck method
  496. *
  497. * @access public
  498. * @return void
  499. */
  500. function testIniCheck() {
  501. Configure::write('Acl.classname', 'IniAclTest');
  502. unset($this->Acl);
  503. $iniFile = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'config'. DS . 'acl.ini.php';
  504. $this->Acl = new AclComponent();
  505. $this->Acl->_Instance->config= $this->Acl->_Instance->readConfigFile($iniFile);
  506. $this->assertFalse($this->Acl->check('admin', 'ads'));
  507. $this->assertTrue($this->Acl->check('admin', 'posts'));
  508. $this->assertTrue($this->Acl->check('jenny', 'posts'));
  509. $this->assertTrue($this->Acl->check('jenny', 'ads'));
  510. $this->assertTrue($this->Acl->check('paul', 'posts'));
  511. $this->assertFalse($this->Acl->check('paul', 'ads'));
  512. $this->assertFalse($this->Acl->check('nobody', 'comments'));
  513. }
  514. /**
  515. * debug function - to help editing/creating test cases for the ACL component
  516. *
  517. * To check the overal ACL status at any time call $this->__debug();
  518. * Generates a list of the current aro and aco structures and a grid dump of the permissions that are defined
  519. * Only designed to work with the db based ACL
  520. *
  521. * @param bool $treesToo
  522. * @access private
  523. * @return void
  524. */
  525. function __debug ($printTreesToo = false) {
  526. $this->Acl->Aro->displayField = 'alias';
  527. $this->Acl->Aco->displayField = 'alias';
  528. $aros = $this->Acl->Aro->find('list', array('order' => 'lft'));
  529. $acos = $this->Acl->Aco->find('list', array('order' => 'lft'));
  530. $rights = array('*', 'create', 'read', 'update', 'delete');
  531. $permissions['Aros v Acos >'] = $acos;
  532. foreach ($aros as $aro) {
  533. $row = array();
  534. foreach ($acos as $aco) {
  535. $perms = '';
  536. foreach ($rights as $right) {
  537. if ($this->Acl->check($aro, $aco, $right)) {
  538. if ($right == '*') {
  539. $perms .= '****';
  540. break;
  541. }
  542. $perms .= $right[0];
  543. } elseif ($right != '*') {
  544. $perms .= ' ';
  545. }
  546. }
  547. $row[] = $perms;
  548. }
  549. $permissions[$aro] = $row;
  550. }
  551. foreach ($permissions as $key => $values) {
  552. array_unshift($values, $key);
  553. $values = array_map(array(&$this, '__pad'), $values);
  554. $permissions[$key] = implode (' ', $values);
  555. }
  556. $permisssions = array_map(array(&$this, '__pad'), $permissions);
  557. array_unshift($permissions, 'Current Permissions :');
  558. if ($printTreesToo) {
  559. debug (array('aros' => $this->Acl->Aro->generateTreeList(), 'acos' => $this->Acl->Aco->generateTreeList()));
  560. }
  561. debug (implode("\r\n", $permissions));
  562. }
  563. /**
  564. * pad function
  565. * Used by debug to format strings used in the data dump
  566. *
  567. * @param string $string
  568. * @param int $len
  569. * @access private
  570. * @return void
  571. */
  572. function __pad($string = '', $len = 14) {
  573. return str_pad($string, $len);
  574. }
  575. }