2007-07-09 20:07:38 +00:00
|
|
|
<?php
|
|
|
|
/* SVN FILE: $Id$ */
|
|
|
|
/**
|
2007-07-09 20:45:29 +00:00
|
|
|
* Short description for file.
|
2007-07-09 20:07:38 +00:00
|
|
|
*
|
|
|
|
* Long description for file
|
|
|
|
*
|
|
|
|
* PHP versions 4 and 5
|
|
|
|
*
|
|
|
|
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
2008-01-01 22:18:17 +00:00
|
|
|
* Copyright 2005-2008, Cake Software Foundation, Inc.
|
2007-07-09 20:07:38 +00:00
|
|
|
* 1785 E. Sahara Avenue, Suite 490-204
|
|
|
|
* Las Vegas, Nevada 89104
|
|
|
|
*
|
|
|
|
* Licensed under The Open Group Test Suite License
|
|
|
|
* Redistributions of files must retain the above copyright notice.
|
|
|
|
*
|
|
|
|
* @filesource
|
2008-01-01 22:18:17 +00:00
|
|
|
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc.
|
2007-07-09 20:07:38 +00:00
|
|
|
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
|
|
|
* @package cake.tests
|
|
|
|
* @subpackage cake.tests.cases.libs.controller.components
|
|
|
|
* @since CakePHP(tm) v 1.2.0.5435
|
|
|
|
* @version $Revision$
|
|
|
|
* @modifiedby $LastChangedBy$
|
|
|
|
* @lastmodified $Date$
|
|
|
|
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
|
|
|
*/
|
Fixes #2902, DB_ACL::allow allowing all when $actions is not an array.
Fixes #2988, AclComponent check() does not inherit permissions.
Fixes #3022, Inconsistent table alias quoting crashes Acl node lookup with PostgreSQL.
Fixes #3129, Console ACL Shell ACO View Broken
Fixes #3176, Problems with ACL support on Microsoft SQL Server.
Closes #3311 as invalid, DboSourceTest::testArrayConditionsParsing tests added
Fixes #3312, DB_ACL::check() fail returning right permission
Fixes #3344, Model->field adds incorrect condition under certain circumstances.
Fixes #3400, Cookie Component: When reading a non-existing key it throws a notice.
Fixes #3407, Since [5768] CookieComponent throws warning when used in beforeFilter().
Closes #3401, Added form test to ensure $Form->fields array is what the security component requires.
Updated AclComponentTest
Merged changes in app/ to cake/console/libs/templates/skel
Fixed generated link to Run More Test after running Group > All tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5776 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-10-17 12:51:17 +00:00
|
|
|
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
|
|
|
|
define('CAKEPHP_UNIT_TEST_EXECUTION', 1);
|
|
|
|
}
|
2007-07-09 20:07:38 +00:00
|
|
|
uses('controller' . DS . 'components' . DS .'acl');
|
2007-08-21 14:29:39 +00:00
|
|
|
|
|
|
|
uses('controller'.DS.'components'.DS.'acl', 'model'.DS.'db_acl');
|
Fixes #2902, DB_ACL::allow allowing all when $actions is not an array.
Fixes #2988, AclComponent check() does not inherit permissions.
Fixes #3022, Inconsistent table alias quoting crashes Acl node lookup with PostgreSQL.
Fixes #3129, Console ACL Shell ACO View Broken
Fixes #3176, Problems with ACL support on Microsoft SQL Server.
Closes #3311 as invalid, DboSourceTest::testArrayConditionsParsing tests added
Fixes #3312, DB_ACL::check() fail returning right permission
Fixes #3344, Model->field adds incorrect condition under certain circumstances.
Fixes #3400, Cookie Component: When reading a non-existing key it throws a notice.
Fixes #3407, Since [5768] CookieComponent throws warning when used in beforeFilter().
Closes #3401, Added form test to ensure $Form->fields array is what the security component requires.
Updated AclComponentTest
Merged changes in app/ to cake/console/libs/templates/skel
Fixed generated link to Run More Test after running Group > All tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5776 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-10-17 12:51:17 +00:00
|
|
|
|
2007-11-09 05:13:12 +00:00
|
|
|
class AclNodeTestBase extends AclNode {
|
|
|
|
var $useDbConfig = 'test_suite';
|
|
|
|
var $cacheSources = false;
|
Fixes #2902, DB_ACL::allow allowing all when $actions is not an array.
Fixes #2988, AclComponent check() does not inherit permissions.
Fixes #3022, Inconsistent table alias quoting crashes Acl node lookup with PostgreSQL.
Fixes #3129, Console ACL Shell ACO View Broken
Fixes #3176, Problems with ACL support on Microsoft SQL Server.
Closes #3311 as invalid, DboSourceTest::testArrayConditionsParsing tests added
Fixes #3312, DB_ACL::check() fail returning right permission
Fixes #3344, Model->field adds incorrect condition under certain circumstances.
Fixes #3400, Cookie Component: When reading a non-existing key it throws a notice.
Fixes #3407, Since [5768] CookieComponent throws warning when used in beforeFilter().
Closes #3401, Added form test to ensure $Form->fields array is what the security component requires.
Updated AclComponentTest
Merged changes in app/ to cake/console/libs/templates/skel
Fixed generated link to Run More Test after running Group > All tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5776 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-10-17 12:51:17 +00:00
|
|
|
}
|
2007-11-09 05:13:12 +00:00
|
|
|
class AroTest extends AclNodeTestBase {
|
|
|
|
var $name = 'AroTest';
|
|
|
|
var $useTable = 'aros';
|
|
|
|
var $hasAndBelongsToMany = array('AcoTest' => array('with' => 'PermissionTest'));
|
Fixes #2902, DB_ACL::allow allowing all when $actions is not an array.
Fixes #2988, AclComponent check() does not inherit permissions.
Fixes #3022, Inconsistent table alias quoting crashes Acl node lookup with PostgreSQL.
Fixes #3129, Console ACL Shell ACO View Broken
Fixes #3176, Problems with ACL support on Microsoft SQL Server.
Closes #3311 as invalid, DboSourceTest::testArrayConditionsParsing tests added
Fixes #3312, DB_ACL::check() fail returning right permission
Fixes #3344, Model->field adds incorrect condition under certain circumstances.
Fixes #3400, Cookie Component: When reading a non-existing key it throws a notice.
Fixes #3407, Since [5768] CookieComponent throws warning when used in beforeFilter().
Closes #3401, Added form test to ensure $Form->fields array is what the security component requires.
Updated AclComponentTest
Merged changes in app/ to cake/console/libs/templates/skel
Fixed generated link to Run More Test after running Group > All tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5776 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-10-17 12:51:17 +00:00
|
|
|
}
|
2007-11-09 05:13:12 +00:00
|
|
|
class AcoTest extends AclNodeTestBase {
|
|
|
|
var $name = 'AcoTest';
|
|
|
|
var $useTable = 'acos';
|
|
|
|
var $hasAndBelongsToMany = array('AroTest' => array('with' => 'PermissionTest'));
|
Fixes #2902, DB_ACL::allow allowing all when $actions is not an array.
Fixes #2988, AclComponent check() does not inherit permissions.
Fixes #3022, Inconsistent table alias quoting crashes Acl node lookup with PostgreSQL.
Fixes #3129, Console ACL Shell ACO View Broken
Fixes #3176, Problems with ACL support on Microsoft SQL Server.
Closes #3311 as invalid, DboSourceTest::testArrayConditionsParsing tests added
Fixes #3312, DB_ACL::check() fail returning right permission
Fixes #3344, Model->field adds incorrect condition under certain circumstances.
Fixes #3400, Cookie Component: When reading a non-existing key it throws a notice.
Fixes #3407, Since [5768] CookieComponent throws warning when used in beforeFilter().
Closes #3401, Added form test to ensure $Form->fields array is what the security component requires.
Updated AclComponentTest
Merged changes in app/ to cake/console/libs/templates/skel
Fixed generated link to Run More Test after running Group > All tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5776 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-10-17 12:51:17 +00:00
|
|
|
}
|
2007-11-09 05:13:12 +00:00
|
|
|
class PermissionTest extends CakeTestModel {
|
|
|
|
var $name = 'PermissionTest';
|
|
|
|
var $useTable = 'aros_acos';
|
|
|
|
var $cacheQueries = false;
|
|
|
|
var $belongsTo = array('AroTest' => array('foreignKey' => 'aro_id'), 'AcoTest' => array('foreignKey' => 'aco_id'));
|
|
|
|
var $actsAs = null;
|
Fixes #2902, DB_ACL::allow allowing all when $actions is not an array.
Fixes #2988, AclComponent check() does not inherit permissions.
Fixes #3022, Inconsistent table alias quoting crashes Acl node lookup with PostgreSQL.
Fixes #3129, Console ACL Shell ACO View Broken
Fixes #3176, Problems with ACL support on Microsoft SQL Server.
Closes #3311 as invalid, DboSourceTest::testArrayConditionsParsing tests added
Fixes #3312, DB_ACL::check() fail returning right permission
Fixes #3344, Model->field adds incorrect condition under certain circumstances.
Fixes #3400, Cookie Component: When reading a non-existing key it throws a notice.
Fixes #3407, Since [5768] CookieComponent throws warning when used in beforeFilter().
Closes #3401, Added form test to ensure $Form->fields array is what the security component requires.
Updated AclComponentTest
Merged changes in app/ to cake/console/libs/templates/skel
Fixed generated link to Run More Test after running Group > All tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5776 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-10-17 12:51:17 +00:00
|
|
|
}
|
2007-11-09 05:13:12 +00:00
|
|
|
class AcoActionTest extends CakeTestModel {
|
|
|
|
var $name = 'AcoActionTest';
|
|
|
|
var $useTable = 'aco_actions';
|
|
|
|
var $belongsTo = array('AcoTest' => array('foreignKey' => 'aco_id'));
|
Fixes #2902, DB_ACL::allow allowing all when $actions is not an array.
Fixes #2988, AclComponent check() does not inherit permissions.
Fixes #3022, Inconsistent table alias quoting crashes Acl node lookup with PostgreSQL.
Fixes #3129, Console ACL Shell ACO View Broken
Fixes #3176, Problems with ACL support on Microsoft SQL Server.
Closes #3311 as invalid, DboSourceTest::testArrayConditionsParsing tests added
Fixes #3312, DB_ACL::check() fail returning right permission
Fixes #3344, Model->field adds incorrect condition under certain circumstances.
Fixes #3400, Cookie Component: When reading a non-existing key it throws a notice.
Fixes #3407, Since [5768] CookieComponent throws warning when used in beforeFilter().
Closes #3401, Added form test to ensure $Form->fields array is what the security component requires.
Updated AclComponentTest
Merged changes in app/ to cake/console/libs/templates/skel
Fixed generated link to Run More Test after running Group > All tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5776 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-10-17 12:51:17 +00:00
|
|
|
}
|
2007-11-09 05:13:12 +00:00
|
|
|
class DB_ACL_TEST extends DB_ACL {
|
Fixes #2902, DB_ACL::allow allowing all when $actions is not an array.
Fixes #2988, AclComponent check() does not inherit permissions.
Fixes #3022, Inconsistent table alias quoting crashes Acl node lookup with PostgreSQL.
Fixes #3129, Console ACL Shell ACO View Broken
Fixes #3176, Problems with ACL support on Microsoft SQL Server.
Closes #3311 as invalid, DboSourceTest::testArrayConditionsParsing tests added
Fixes #3312, DB_ACL::check() fail returning right permission
Fixes #3344, Model->field adds incorrect condition under certain circumstances.
Fixes #3400, Cookie Component: When reading a non-existing key it throws a notice.
Fixes #3407, Since [5768] CookieComponent throws warning when used in beforeFilter().
Closes #3401, Added form test to ensure $Form->fields array is what the security component requires.
Updated AclComponentTest
Merged changes in app/ to cake/console/libs/templates/skel
Fixed generated link to Run More Test after running Group > All tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5776 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-10-17 12:51:17 +00:00
|
|
|
|
2007-11-09 05:13:12 +00:00
|
|
|
function __construct() {
|
|
|
|
$this->Aro =& new AroTest();
|
|
|
|
$this->Aro->Permission =& new PermissionTest();
|
|
|
|
$this->Aco =& new AcoTest();
|
|
|
|
$this->Aro->Permission =& new PermissionTest();
|
Fixes #2902, DB_ACL::allow allowing all when $actions is not an array.
Fixes #2988, AclComponent check() does not inherit permissions.
Fixes #3022, Inconsistent table alias quoting crashes Acl node lookup with PostgreSQL.
Fixes #3129, Console ACL Shell ACO View Broken
Fixes #3176, Problems with ACL support on Microsoft SQL Server.
Closes #3311 as invalid, DboSourceTest::testArrayConditionsParsing tests added
Fixes #3312, DB_ACL::check() fail returning right permission
Fixes #3344, Model->field adds incorrect condition under certain circumstances.
Fixes #3400, Cookie Component: When reading a non-existing key it throws a notice.
Fixes #3407, Since [5768] CookieComponent throws warning when used in beforeFilter().
Closes #3401, Added form test to ensure $Form->fields array is what the security component requires.
Updated AclComponentTest
Merged changes in app/ to cake/console/libs/templates/skel
Fixed generated link to Run More Test after running Group > All tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5776 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-10-17 12:51:17 +00:00
|
|
|
}
|
|
|
|
}
|
2007-07-09 20:07:38 +00:00
|
|
|
/**
|
|
|
|
* Short description for class.
|
|
|
|
*
|
|
|
|
* @package cake.tests
|
|
|
|
* @subpackage cake.tests.cases.libs.controller.components
|
|
|
|
*/
|
|
|
|
class AclComponentTest extends CakeTestCase {
|
2007-08-21 14:29:39 +00:00
|
|
|
|
|
|
|
var $fixtures = array('core.aro', 'core.aco', 'core.aros_aco', 'core.aco_action');
|
2007-10-29 00:17:37 +00:00
|
|
|
|
|
|
|
function start() {
|
|
|
|
}
|
|
|
|
|
2007-10-14 01:09:21 +00:00
|
|
|
function startTest() {
|
2007-08-21 14:29:39 +00:00
|
|
|
$this->Acl =& new AclComponent();
|
|
|
|
}
|
|
|
|
|
2007-10-29 00:17:37 +00:00
|
|
|
function before() {
|
|
|
|
if (!isset($this->_initialized)) {
|
|
|
|
Configure::write('Acl.classname', 'DB_ACL_TEST');
|
|
|
|
Configure::write('Acl.database', 'test_suite');
|
|
|
|
if (isset($this->fixtures) && (!is_array($this->fixtures) || empty($this->fixtures))) {
|
|
|
|
unset($this->fixtures);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set up DB connection
|
|
|
|
if (isset($this->fixtures)) {
|
|
|
|
$this->_initDb();
|
|
|
|
$this->_loadFixtures();
|
|
|
|
}
|
|
|
|
parent::start();
|
|
|
|
|
|
|
|
// Create records
|
|
|
|
if (isset($this->_fixtures) && isset($this->db)) {
|
|
|
|
foreach ($this->_fixtures as $fixture) {
|
2008-01-12 20:50:34 +00:00
|
|
|
$fixture->insert($this->db);
|
2007-10-29 00:17:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->startTest();
|
|
|
|
$this->_initialized = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function after() {
|
|
|
|
}
|
|
|
|
|
Fixes #2902, DB_ACL::allow allowing all when $actions is not an array.
Fixes #2988, AclComponent check() does not inherit permissions.
Fixes #3022, Inconsistent table alias quoting crashes Acl node lookup with PostgreSQL.
Fixes #3129, Console ACL Shell ACO View Broken
Fixes #3176, Problems with ACL support on Microsoft SQL Server.
Closes #3311 as invalid, DboSourceTest::testArrayConditionsParsing tests added
Fixes #3312, DB_ACL::check() fail returning right permission
Fixes #3344, Model->field adds incorrect condition under certain circumstances.
Fixes #3400, Cookie Component: When reading a non-existing key it throws a notice.
Fixes #3407, Since [5768] CookieComponent throws warning when used in beforeFilter().
Closes #3401, Added form test to ensure $Form->fields array is what the security component requires.
Updated AclComponentTest
Merged changes in app/ to cake/console/libs/templates/skel
Fixed generated link to Run More Test after running Group > All tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5776 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-10-17 12:51:17 +00:00
|
|
|
function testAclCreate() {
|
2007-10-29 00:17:37 +00:00
|
|
|
$this->Acl->Aro->create(array('alias' => 'Global'));
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->assertTrue($this->Acl->Aro->save());
|
Fixes #2902, DB_ACL::allow allowing all when $actions is not an array.
Fixes #2988, AclComponent check() does not inherit permissions.
Fixes #3022, Inconsistent table alias quoting crashes Acl node lookup with PostgreSQL.
Fixes #3129, Console ACL Shell ACO View Broken
Fixes #3176, Problems with ACL support on Microsoft SQL Server.
Closes #3311 as invalid, DboSourceTest::testArrayConditionsParsing tests added
Fixes #3312, DB_ACL::check() fail returning right permission
Fixes #3344, Model->field adds incorrect condition under certain circumstances.
Fixes #3400, Cookie Component: When reading a non-existing key it throws a notice.
Fixes #3407, Since [5768] CookieComponent throws warning when used in beforeFilter().
Closes #3401, Added form test to ensure $Form->fields array is what the security component requires.
Updated AclComponentTest
Merged changes in app/ to cake/console/libs/templates/skel
Fixed generated link to Run More Test after running Group > All tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5776 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-10-17 12:51:17 +00:00
|
|
|
|
|
|
|
$parent = $this->Acl->Aro->id;
|
2007-08-21 14:29:39 +00:00
|
|
|
|
2008-03-01 03:12:12 +00:00
|
|
|
$this->Acl->Aro->create(array('parent_id' => $parent, 'alias' => 'Account'));
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->assertTrue($this->Acl->Aro->save());
|
2007-08-21 14:29:39 +00:00
|
|
|
|
2008-03-01 03:12:12 +00:00
|
|
|
$this->Acl->Aro->create(array('parent_id' => $parent, 'alias' => 'Manager'));
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->assertTrue($this->Acl->Aro->save());
|
2007-08-21 14:29:39 +00:00
|
|
|
|
Fixes #2902, DB_ACL::allow allowing all when $actions is not an array.
Fixes #2988, AclComponent check() does not inherit permissions.
Fixes #3022, Inconsistent table alias quoting crashes Acl node lookup with PostgreSQL.
Fixes #3129, Console ACL Shell ACO View Broken
Fixes #3176, Problems with ACL support on Microsoft SQL Server.
Closes #3311 as invalid, DboSourceTest::testArrayConditionsParsing tests added
Fixes #3312, DB_ACL::check() fail returning right permission
Fixes #3344, Model->field adds incorrect condition under certain circumstances.
Fixes #3400, Cookie Component: When reading a non-existing key it throws a notice.
Fixes #3407, Since [5768] CookieComponent throws warning when used in beforeFilter().
Closes #3401, Added form test to ensure $Form->fields array is what the security component requires.
Updated AclComponentTest
Merged changes in app/ to cake/console/libs/templates/skel
Fixed generated link to Run More Test after running Group > All tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5776 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-10-17 12:51:17 +00:00
|
|
|
$parent = $this->Acl->Aro->id;
|
|
|
|
|
2008-03-01 03:12:12 +00:00
|
|
|
$this->Acl->Aro->create(array('parent_id' => $parent, 'alias' => 'Secretary'));
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->assertTrue($this->Acl->Aro->save());
|
2007-08-21 14:29:39 +00:00
|
|
|
|
2007-10-29 00:17:37 +00:00
|
|
|
$this->Acl->Aco->create(array('alias' => 'Reports'));
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->assertTrue($this->Acl->Aco->save());
|
Fixes #2902, DB_ACL::allow allowing all when $actions is not an array.
Fixes #2988, AclComponent check() does not inherit permissions.
Fixes #3022, Inconsistent table alias quoting crashes Acl node lookup with PostgreSQL.
Fixes #3129, Console ACL Shell ACO View Broken
Fixes #3176, Problems with ACL support on Microsoft SQL Server.
Closes #3311 as invalid, DboSourceTest::testArrayConditionsParsing tests added
Fixes #3312, DB_ACL::check() fail returning right permission
Fixes #3344, Model->field adds incorrect condition under certain circumstances.
Fixes #3400, Cookie Component: When reading a non-existing key it throws a notice.
Fixes #3407, Since [5768] CookieComponent throws warning when used in beforeFilter().
Closes #3401, Added form test to ensure $Form->fields array is what the security component requires.
Updated AclComponentTest
Merged changes in app/ to cake/console/libs/templates/skel
Fixed generated link to Run More Test after running Group > All tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5776 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-10-17 12:51:17 +00:00
|
|
|
|
|
|
|
$report = $this->Acl->Aco->id;
|
|
|
|
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->Acl->Aco->create(array('parent_id' => $report, 'alias' => 'Accounts'));
|
|
|
|
$this->assertTrue($this->Acl->Aco->save());
|
Fixes #2902, DB_ACL::allow allowing all when $actions is not an array.
Fixes #2988, AclComponent check() does not inherit permissions.
Fixes #3022, Inconsistent table alias quoting crashes Acl node lookup with PostgreSQL.
Fixes #3129, Console ACL Shell ACO View Broken
Fixes #3176, Problems with ACL support on Microsoft SQL Server.
Closes #3311 as invalid, DboSourceTest::testArrayConditionsParsing tests added
Fixes #3312, DB_ACL::check() fail returning right permission
Fixes #3344, Model->field adds incorrect condition under certain circumstances.
Fixes #3400, Cookie Component: When reading a non-existing key it throws a notice.
Fixes #3407, Since [5768] CookieComponent throws warning when used in beforeFilter().
Closes #3401, Added form test to ensure $Form->fields array is what the security component requires.
Updated AclComponentTest
Merged changes in app/ to cake/console/libs/templates/skel
Fixed generated link to Run More Test after running Group > All tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5776 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-10-17 12:51:17 +00:00
|
|
|
|
|
|
|
$account = $this->Acl->Aco->id;
|
|
|
|
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->Acl->Aco->create(array('parent_id' => $account, 'alias' => 'Contacts'));
|
|
|
|
$this->assertTrue($this->Acl->Aco->save());
|
Fixes #2902, DB_ACL::allow allowing all when $actions is not an array.
Fixes #2988, AclComponent check() does not inherit permissions.
Fixes #3022, Inconsistent table alias quoting crashes Acl node lookup with PostgreSQL.
Fixes #3129, Console ACL Shell ACO View Broken
Fixes #3176, Problems with ACL support on Microsoft SQL Server.
Closes #3311 as invalid, DboSourceTest::testArrayConditionsParsing tests added
Fixes #3312, DB_ACL::check() fail returning right permission
Fixes #3344, Model->field adds incorrect condition under certain circumstances.
Fixes #3400, Cookie Component: When reading a non-existing key it throws a notice.
Fixes #3407, Since [5768] CookieComponent throws warning when used in beforeFilter().
Closes #3401, Added form test to ensure $Form->fields array is what the security component requires.
Updated AclComponentTest
Merged changes in app/ to cake/console/libs/templates/skel
Fixed generated link to Run More Test after running Group > All tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5776 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-10-17 12:51:17 +00:00
|
|
|
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->Acl->Aco->create(array('parent_id' => $report, 'alias' => 'Messages'));
|
|
|
|
$this->assertTrue($this->Acl->Aco->save());
|
Fixes #2902, DB_ACL::allow allowing all when $actions is not an array.
Fixes #2988, AclComponent check() does not inherit permissions.
Fixes #3022, Inconsistent table alias quoting crashes Acl node lookup with PostgreSQL.
Fixes #3129, Console ACL Shell ACO View Broken
Fixes #3176, Problems with ACL support on Microsoft SQL Server.
Closes #3311 as invalid, DboSourceTest::testArrayConditionsParsing tests added
Fixes #3312, DB_ACL::check() fail returning right permission
Fixes #3344, Model->field adds incorrect condition under certain circumstances.
Fixes #3400, Cookie Component: When reading a non-existing key it throws a notice.
Fixes #3407, Since [5768] CookieComponent throws warning when used in beforeFilter().
Closes #3401, Added form test to ensure $Form->fields array is what the security component requires.
Updated AclComponentTest
Merged changes in app/ to cake/console/libs/templates/skel
Fixed generated link to Run More Test after running Group > All tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5776 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-10-17 12:51:17 +00:00
|
|
|
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->Acl->Aco->create(array('parent_id' => $account, 'alias' => 'MonthView'));
|
|
|
|
$this->assertTrue($this->Acl->Aco->save());
|
2007-08-21 14:29:39 +00:00
|
|
|
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->Acl->Aco->create(array('parent_id' => $account, 'alias' => 'Links'));
|
|
|
|
$this->assertTrue($this->Acl->Aco->save());
|
2007-08-21 14:29:39 +00:00
|
|
|
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->Acl->Aco->create(array('parent_id' => $account, 'alias' => 'Numbers'));
|
|
|
|
$this->assertTrue($this->Acl->Aco->save());
|
2007-08-21 14:29:39 +00:00
|
|
|
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->Acl->Aco->create(array('parent_id' => $report, 'alias' => 'QuickStats'));
|
|
|
|
$this->assertTrue($this->Acl->Aco->save());
|
Fixes #2902, DB_ACL::allow allowing all when $actions is not an array.
Fixes #2988, AclComponent check() does not inherit permissions.
Fixes #3022, Inconsistent table alias quoting crashes Acl node lookup with PostgreSQL.
Fixes #3129, Console ACL Shell ACO View Broken
Fixes #3176, Problems with ACL support on Microsoft SQL Server.
Closes #3311 as invalid, DboSourceTest::testArrayConditionsParsing tests added
Fixes #3312, DB_ACL::check() fail returning right permission
Fixes #3344, Model->field adds incorrect condition under certain circumstances.
Fixes #3400, Cookie Component: When reading a non-existing key it throws a notice.
Fixes #3407, Since [5768] CookieComponent throws warning when used in beforeFilter().
Closes #3401, Added form test to ensure $Form->fields array is what the security component requires.
Updated AclComponentTest
Merged changes in app/ to cake/console/libs/templates/skel
Fixed generated link to Run More Test after running Group > All tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5776 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-10-17 12:51:17 +00:00
|
|
|
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->Acl->Aco->create(array('parent_id' => $report, 'alias' => 'Bills'));
|
|
|
|
$this->assertTrue($this->Acl->Aco->save());
|
2007-08-21 14:29:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function testDbAclAllow() {
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->assertTrue($this->Acl->allow('Manager', 'Reports', array('read', 'delete', 'update')));
|
2007-08-21 14:29:39 +00:00
|
|
|
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->assertFalse($this->Acl->check('Manager', 'Reports', 'create'));
|
|
|
|
$this->assertFalse($this->Acl->check('Secretary', 'Links', 'create'));
|
2008-02-11 02:27:16 +00:00
|
|
|
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->assertTrue($this->Acl->allow('Secretary', 'Links', array('create')));
|
2008-02-11 02:27:16 +00:00
|
|
|
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->assertFalse($this->Acl->check('Manager', 'Reports', 'create'));
|
|
|
|
$this->assertTrue($this->Acl->check('Secretary', 'Links', 'create'));
|
2008-04-11 04:59:52 +00:00
|
|
|
|
|
|
|
$this->expectError('DB_ACL::allow() - Invalid node');
|
|
|
|
$this->assertFalse($this->Acl->allow('Manager', 'Links/DoesNotExist', 'create'));
|
2007-08-21 14:29:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function testDbAclCheck() {
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->assertTrue($this->Acl->check('Secretary', 'Links', 'read'));
|
|
|
|
$this->assertTrue($this->Acl->check('Secretary', 'Links', 'delete'));
|
|
|
|
$this->assertTrue($this->Acl->check('Secretary', 'Links', 'update'));
|
|
|
|
$this->assertTrue($this->Acl->check('Secretary', 'Links', 'create'));
|
|
|
|
$this->assertTrue($this->Acl->check('Secretary', 'Links', '*'));
|
|
|
|
$this->assertTrue($this->Acl->check('Secretary', 'Links', 'create'));
|
|
|
|
$this->assertTrue($this->Acl->check('Manager', 'Links', 'read'));
|
|
|
|
$this->assertTrue($this->Acl->check('Manager', 'Links', 'delete'));
|
|
|
|
$this->assertFalse($this->Acl->check('Manager', 'Links', 'create'));
|
|
|
|
$this->assertFalse($this->Acl->check('Account', 'Links', 'read'));
|
|
|
|
|
|
|
|
$this->assertTrue($this->Acl->allow('Global', 'Reports', 'read'));
|
|
|
|
|
|
|
|
$this->assertFalse($this->Acl->check('Account', 'Reports', 'create'));
|
|
|
|
$this->assertTrue($this->Acl->check('Account', 'Reports', 'read'));
|
|
|
|
$this->assertFalse($this->Acl->check('Account', 'Reports', 'update'));
|
|
|
|
$this->assertFalse($this->Acl->check('Account', 'Reports', 'delete'));
|
|
|
|
|
|
|
|
$this->assertFalse($this->Acl->check('Account', 'Links', 'create'));
|
|
|
|
$this->assertFalse($this->Acl->check('Account', 'Links', 'update'));
|
|
|
|
$this->assertFalse($this->Acl->check('Account', 'Links', 'delete'));
|
|
|
|
|
|
|
|
$this->assertTrue($this->Acl->allow('Global', 'Reports'));
|
|
|
|
|
|
|
|
$this->assertTrue($this->Acl->check('Account', 'Links', 'read'));
|
2007-08-21 14:29:39 +00:00
|
|
|
}
|
|
|
|
|
Fixes #2902, DB_ACL::allow allowing all when $actions is not an array.
Fixes #2988, AclComponent check() does not inherit permissions.
Fixes #3022, Inconsistent table alias quoting crashes Acl node lookup with PostgreSQL.
Fixes #3129, Console ACL Shell ACO View Broken
Fixes #3176, Problems with ACL support on Microsoft SQL Server.
Closes #3311 as invalid, DboSourceTest::testArrayConditionsParsing tests added
Fixes #3312, DB_ACL::check() fail returning right permission
Fixes #3344, Model->field adds incorrect condition under certain circumstances.
Fixes #3400, Cookie Component: When reading a non-existing key it throws a notice.
Fixes #3407, Since [5768] CookieComponent throws warning when used in beforeFilter().
Closes #3401, Added form test to ensure $Form->fields array is what the security component requires.
Updated AclComponentTest
Merged changes in app/ to cake/console/libs/templates/skel
Fixed generated link to Run More Test after running Group > All tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5776 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-10-17 12:51:17 +00:00
|
|
|
function testDbAclDeny() {
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->assertTrue($this->Acl->check('Secretary', 'Links', 'delete'));
|
2007-08-21 14:29:39 +00:00
|
|
|
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->Acl->allow('Secretary', 'Links', 'read');
|
2008-02-27 03:57:33 +00:00
|
|
|
$result = $this->Acl->Aro->Permission->find('all', array('conditions' => array('AroTest.alias' => 'Secretary')));
|
2008-04-10 13:19:10 +00:00
|
|
|
$expected = array('id' => '2', 'aro_id' => '4', 'aco_id' => '15', '_create' => '1', '_read' => '1', '_update' => '0', '_delete' => '0');
|
2008-02-27 03:57:33 +00:00
|
|
|
$this->assertEqual($result[0]['PermissionTest'], $expected);
|
|
|
|
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->Acl->deny('Secretary', 'Links', 'delete');
|
2008-02-27 03:57:33 +00:00
|
|
|
$result = $this->Acl->Aro->Permission->find('all', array('conditions' => array('AroTest.alias' => 'Secretary')));
|
2008-04-10 13:19:10 +00:00
|
|
|
$expected['_delete'] = '-1';
|
2008-02-27 03:57:33 +00:00
|
|
|
$this->assertEqual($result[0]['PermissionTest'], $expected);
|
|
|
|
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->assertFalse($this->Acl->check('Secretary', 'Links', 'delete'));
|
|
|
|
$this->assertTrue($this->Acl->check('Secretary', 'Links', 'read'));
|
|
|
|
$this->assertTrue($this->Acl->check('Secretary', 'Links', 'create'));
|
|
|
|
$this->assertTrue($this->Acl->check('Secretary', 'Links', 'update'));
|
2008-01-09 00:39:00 +00:00
|
|
|
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->Acl->deny('Secretary', 'Links', '*');
|
2008-01-09 00:39:00 +00:00
|
|
|
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->assertFalse($this->Acl->check('Secretary', 'Links', 'delete'));
|
|
|
|
$this->assertFalse($this->Acl->check('Secretary', 'Links', 'read'));
|
|
|
|
$this->assertFalse($this->Acl->check('Secretary', 'Links', 'create'));
|
|
|
|
$this->assertFalse($this->Acl->check('Secretary', 'Links', 'update'));
|
|
|
|
$this->assertFalse($this->Acl->check('Secretary', 'Links'));
|
2008-01-09 00:39:00 +00:00
|
|
|
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->Acl->Aro->create(array('alias' => 'Tele'));
|
|
|
|
$this->assertTrue($this->Acl->Aro->save());
|
2008-01-09 00:39:00 +00:00
|
|
|
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->Acl->Aco->create(array('alias' => 'Tobies'));
|
|
|
|
$this->assertTrue($this->Acl->Aco->save());
|
2008-01-09 00:39:00 +00:00
|
|
|
|
2008-04-10 13:19:10 +00:00
|
|
|
$this->Acl->allow('Tele', 'Tobies', array('read', 'update', 'delete'));
|
|
|
|
$this->Acl->deny('Tele', 'Tobies', array('delete'));
|
|
|
|
$result = $this->Acl->Aro->Permission->find('all', array('conditions' => array('AroTest.alias' => 'Tele')));
|
|
|
|
$expected = array('id' => '4', 'aro_id' => '5', 'aco_id' => '19', '_create' => '0', '_read' => '1', '_update' => '1', '_delete' => '-1');
|
|
|
|
$this->assertEqual($result[0]['PermissionTest'], $expected);
|
Fixes #2902, DB_ACL::allow allowing all when $actions is not an array.
Fixes #2988, AclComponent check() does not inherit permissions.
Fixes #3022, Inconsistent table alias quoting crashes Acl node lookup with PostgreSQL.
Fixes #3129, Console ACL Shell ACO View Broken
Fixes #3176, Problems with ACL support on Microsoft SQL Server.
Closes #3311 as invalid, DboSourceTest::testArrayConditionsParsing tests added
Fixes #3312, DB_ACL::check() fail returning right permission
Fixes #3344, Model->field adds incorrect condition under certain circumstances.
Fixes #3400, Cookie Component: When reading a non-existing key it throws a notice.
Fixes #3407, Since [5768] CookieComponent throws warning when used in beforeFilter().
Closes #3401, Added form test to ensure $Form->fields array is what the security component requires.
Updated AclComponentTest
Merged changes in app/ to cake/console/libs/templates/skel
Fixed generated link to Run More Test after running Group > All tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5776 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-10-17 12:51:17 +00:00
|
|
|
}
|
2007-08-21 14:29:39 +00:00
|
|
|
|
2008-02-11 02:27:16 +00:00
|
|
|
function testAclNodeLookup() {
|
|
|
|
$result = $this->Acl->Aro->node('Global/Manager/Secretary');
|
|
|
|
$expected = array(
|
|
|
|
array('AroTest' => array('id' => '4', 'parent_id' => '3', 'model' => null, 'foreign_key' => null, 'alias' => 'Secretary')),
|
|
|
|
array('AroTest' => array('id' => '3', 'parent_id' => '1', 'model' => null, 'foreign_key' => null, 'alias' => 'Manager')),
|
|
|
|
array('AroTest' => array('id' => '1', 'parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'Global'))
|
|
|
|
);
|
|
|
|
$this->assertEqual($result, $expected);
|
2008-04-10 13:19:10 +00:00
|
|
|
//die('Working');
|
2008-02-11 02:27:16 +00:00
|
|
|
}
|
|
|
|
|
Fixes #2902, DB_ACL::allow allowing all when $actions is not an array.
Fixes #2988, AclComponent check() does not inherit permissions.
Fixes #3022, Inconsistent table alias quoting crashes Acl node lookup with PostgreSQL.
Fixes #3129, Console ACL Shell ACO View Broken
Fixes #3176, Problems with ACL support on Microsoft SQL Server.
Closes #3311 as invalid, DboSourceTest::testArrayConditionsParsing tests added
Fixes #3312, DB_ACL::check() fail returning right permission
Fixes #3344, Model->field adds incorrect condition under certain circumstances.
Fixes #3400, Cookie Component: When reading a non-existing key it throws a notice.
Fixes #3407, Since [5768] CookieComponent throws warning when used in beforeFilter().
Closes #3401, Added form test to ensure $Form->fields array is what the security component requires.
Updated AclComponentTest
Merged changes in app/ to cake/console/libs/templates/skel
Fixed generated link to Run More Test after running Group > All tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5776 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-10-17 12:51:17 +00:00
|
|
|
function tearDown() {
|
2007-07-09 20:07:38 +00:00
|
|
|
}
|
|
|
|
}
|
2007-10-29 00:17:37 +00:00
|
|
|
|
Closes #2119 Only define clone() in PHP4 when it hasn't been already defined.
Closes #2213, Support multiple plugin paths.
Closes #2234, filepaths to behavior classes should be cached in class.paths.php also
Closes #2345, ability to group components into subfolders
Closes #2645, Improvement to basic.php for class loading.
Fixes #3526, Cache::write, when using just the config name, it fails.
Fixes #3559, loading plugin model as assoc don't work.
Closes #3567 Controller Folders (Note this does not need routing to work, but controller names can not conflict with others in the same application so naming must still be unique)
Fixes #3579, email.php component: Parse error with php 4.
Adding new class and file importer.
Updated most of the core to use the importer.
Added ClassRegsitry::init() that will create and instance of an object and store it in the registry.
Deprecated most of the load functions in basics.php
Plugin model loading now forces using the dot notation, to use models within a plugin, all the model associations must be in the PluginName.Model syntax, if this is not used, the plugin will look for the models in the main app/models directory first, if not found then it will search the plugin directories recursively until it finds a model.
var $belongsTo = array('SomeModel'); will look for some_model.php in the app/models
var $belongsTo = array('MyPlugin.SomeModel'); will look for some_model.php in my_plugin/models
var $belongsTo = array('MyPlugin.MyPlugin', 'SomeModel'); will used my_plugin/models/my_plugin.php and app/models/some_model.php
The controllers of the plugin will still look for the default models inside the plugin if var $uses is not set:
var $uses = array('SomeModel'); will look for some_model.php in the app/models
var $uses = array('MyPlugin.SomeModel'); will look for some_model.php in my_plugin/models
var $uses = array('MyPlugin.MyPlugin', 'SomeModel'); will used my_plugin/models/my_plugin.php and app/models/some_model.php
All of the above will work between plugins and main app
These changes also allow placing model and controllers is sub directories
Removed old class.paths.php file generation
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6001 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-11-16 09:35:19 +00:00
|
|
|
?>
|