i've created plugin called 'issuetracker', located in app/plugin/issuetracker
. i've created controller called tickets
, accessible @ www.example.com/issue_tracker/tickets/
. but, logged in users rank 'admin'.
that wasn't hoping for, added in plugin/issuetracker/controller/ticketscontroller.php
following:
public function beforefilter() { parent::beforefilter(); $this->auth->allow('index'); }
i hoped piece of code (which i'm using in several other controllers in app/controller/
inherit appcontroller.php
file. ticketscontroller.php
file extends issuetrackerappcontroller
(like this):
class ticketscontroller extends issuetrackerappcontroller { //functions goes in here }
and in plugin/controller
folder i've created file issuetrackerappcontroller
extends appcontroller
.
in appcontroller.php
file i've allready defined 'index'
, 'view'
public actions. but, reason, doesn't work in plugin.
is there i'm overseeing? when access www.example.com/issue_tracker/tickets
not logged in user (guest), tells me need login. if i'm logged in user, not admin, auth
component won't allow me in , presents login form.
there should way auth
working in plugin, right?
edit
below appcontroller.php
snippet i've configured auth:
public $components = array( 'auth' => array( 'loginaction' => array('controller' => 'users', 'action' => 'login', 'plugin' => false), 'loginredirect' => array('plugin' => false, 'controller' => 'ervaringen', 'action' => 'add'), 'logoutredirect' => array('plugin' => false, 'controller' => 'ervaringen', 'action' => 'index'), 'authorize' => array('controller'), 'flash' => array( 'element' => 'error', 'key' => 'auth', 'params' => array( 'heading' => 'waarschuwing!') ), 'autherror' => 'je moet inloggen om deze inhoud te bekijken.', ), 'session', 'debugkit.toolbar' );
mystery solved.
after rescanning code in plugin, noticed 1 of coworkers on project used $variable = $this->requestaction(link/here/with/id/etc);
, leads towards controller function. particular function wasn't allowed in way beforefilter()
, causing 'function denied' bij auth
system.
i've added particular function in $this->auth->allow('function');
in beforefilter()
of plugin , working.
Comments
Post a Comment