Skip to content

Commit

Permalink
added extra check so viewable will only work with the actions provide…
Browse files Browse the repository at this point in the history
…d. should stop it doing things in index and add from the frontend.
  • Loading branch information
dogmatic69 committed Dec 28, 2009
1 parent 62668d7 commit d541a66
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/app_controller.php
Expand Up @@ -24,6 +24,13 @@ class AppController extends Controller
'DebugKit.Toolbar', 'Core.Cron', 'Core.Config'
);

/**
* actions where viewable will work.
*/
var $viewableActions = array(
'view'
);

function beforeFilter()
{
parent::beforeFilter();
Expand All @@ -37,9 +44,9 @@ function beforeFilter()

$this->set( 'commentModel', 'Comment' );

if ( isset( $this->params['prefix'] ) && $this->params['prefix'] == 'admin' )
if ( isset( $this->params['prefix'] ) && $this->params['prefix'] == 'admin' && !in_array( $this->params['action'], $this->viewableActions ) )
{
$this->{$this->modelClass}->Behaviors->disable( 'Viewable' );
$this->{$this->modelClass}->Behaviors->detach( 'Viewable' );
}
}

Expand Down

0 comments on commit d541a66

Please sign in to comment.