Skip to content

Commit

Permalink
Dropped support for wildcard in AuthComponent::allow()
Browse files Browse the repository at this point in the history
Conflicts:

	lib/Cake/Controller/Component/AuthComponent.php
  • Loading branch information
Daniel Pakuschewski authored and markstory committed Nov 16, 2011
1 parent 50b2535 commit 841c0c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
10 changes: 3 additions & 7 deletions lib/Cake/Controller/Component/AuthComponent.php
Expand Up @@ -424,20 +424,16 @@ public function constructAuthorize() {
* You can use allow with either an array, or var args.
*
* `$this->Auth->allow(array('edit', 'add'));` or
* `$this->Auth->allow('edit', 'add');`
* `$this->Auth->allow();` to allow all actions.
*
* allow() also supports '*' as a wildcard to mean all actions.
*
* `$this->Auth->allow('*');`
* `$this->Auth->allow('edit', 'add');` or
* `$this->Auth->allow();` to allow all actions
*
* @param mixed $action,... Controller action name or array of actions
* @return void
* @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#making-actions-public
*/
public function allow($action = null) {
$args = func_get_args();
if (empty($args) || $args == array('*')) {
if (empty($args)) {
$this->allowedActions = $this->_methods;
} else {
if (isset($args[0]) && is_array($args[0])) {
Expand Down
6 changes: 3 additions & 3 deletions lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
Expand Up @@ -628,7 +628,7 @@ public function testAllowDenyAll() {
$this->Controller->request['action'] = 'camelCase';
$this->assertFalse($this->Controller->Auth->startup($this->Controller));

$this->Controller->Auth->allow('*');
$this->Controller->Auth->allow();
$this->Controller->Auth->deny(array('add', 'camelCase'));

$this->Controller->request['action'] = 'delete';
Expand Down Expand Up @@ -663,7 +663,7 @@ public function testAllowDenyAll() {
*/
public function testDenyWithCamelCaseMethods() {
$this->Controller->Auth->initialize($this->Controller);
$this->Controller->Auth->allow('*');
$this->Controller->Auth->allow();
$this->Controller->Auth->deny('add', 'camelCase');

$url = '/auth_test/camelCase';
Expand All @@ -685,7 +685,7 @@ public function testAllowedActionsWithCamelCaseMethods() {
$this->Controller->Auth->initialize($this->Controller);
$this->Controller->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login');
$this->Controller->Auth->userModel = 'AuthUser';
$this->Controller->Auth->allow('*');
$this->Controller->Auth->allow();
$result = $this->Controller->Auth->startup($this->Controller);
$this->assertTrue($result, 'startup() should return true, as action is allowed. %s');

Expand Down

0 comments on commit 841c0c2

Please sign in to comment.