My login action is in controller AuthController in action LoginAction().

If I use Zend_Auth_Storage_Session() to store username logged persons and I
would like to create that only logged users can go to action addBookAction()
and removeBookAction() in controller LibraryController - should I add to
these actions:
    $storage = new Zend_Auth_Storage_Session();
    $data = $storage->read(); 
    if($data == null) $this->_redirect('auth/login');
So they look:

        public function addBookAction()
        {
                $storage = new Zend_Auth_Storage_Session();
                $data = $storage->read(); 
                if($data == null) $this->_redirect('auth/login');

                .........
        }

        public function removeBookAction()
        {
                $storage = new Zend_Auth_Storage_Session();
                $data = $storage->read(); 
                if($data == null) $this->_redirect('auth/login');

                .........
        }


Is it the best method ? Or maybe is better method ? Or maybe this method is
the best ?
-- 
View this message in context: 
http://www.nabble.com/2-actions-my-controller-must-be-access-for-only-loged-users-tp25530293p25530293.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to