All:

I am having some weird issues using Auth and after some investigation
with little results I've decided to post some questions since I am
sure I must be missing something; but I have not been able to find out
what it is.

The issue I have is the following:

For some reason after generating 3 ajax requests and also doing this
after having successfully logged in, my session information seems to
loose the user information I had received and stored automagically in
Auth->user(). This sporadically changes, meaning that in some cases I
can see it for one controller. Then I don't see it after login back in
and re-running the 3 ajax requests for the different controllers.
Again I will see the session info (user) for a different controller
this time

Essentially what I am doing is that after I login I load up some
JavaScripts Objects that I will use for my front-end (GUI) interface.
I do this by sending 3 ajax requests for example and holding on to the
information received from them.

To add to the confusion after not properly seeing the correct user
session information set by Auth->user(). I can then continuously call
the controller/action from my browser and this time I will get the
session information every time regardless of which controller I use.

I have no idea why is behaving like that. Can someone please let me
know what the possible issue is. The main functions for the 3
controllers are shown below.

Thanks in advance.


In my AppController I have the following:

  var $components = array('Auth', 'Session', 'RequestHandler');

        public function beforeFilter() {
                $this->Auth->loginAction = array('controller' => 'portal', 
'action'
=> 'login');
                $this->Auth->loginRedirect = array('controller' => 'portal',
'action' => 'main');
                $this->Auth->logoutRedirect = array('controller' => 'portal',
'action' => 'index');
                $this->Auth->autoRedirect = false;
        } // End of beforeFilter()

Then I have 3 controllers to which I send ajax requests via POST.

Function from Controller 1:

        public function getGroups() {

                $this->layout = 'ajax';
                $aTariffGroup = array();
                $this->log("TARIFFGROUPSSSSSSSSSSSSSSSSSSSS", LOG_DEBUG);
                $this->log($_SESSION, LOG_DEBUG);

                if ( $this->RequestHandler->isAjax() ) {

                        if ( $this->User->Group->getGroupName($this->Auth->user
('group_id')) != 'superusers' ) {
                                $aTariffGroup = 
$this->CcTariffgroup->getGroups($this->Auth->user
('tariff_id'));
                        } else {
                                $aTariffGroup = 
$this->CcTariffgroup->getGroups();
                        }

                        $jTariffGroup = Set::extract($aTariffGroup, 
'{n}.cc_tariffgroup');
                        $this->set('j_groups', $jTariffGroup);
                }

        } // End of getGroups()

Function from Controller 2:

        public function getTrunkGroups() {

                $this->log("TRUNKSSSSSSSSSSSSSSS", LOG_DEBUG);
                $this->log($_SESSION, LOG_DEBUG);
                $this->layout = 'ajax';

                if ( $this->RequestHandler->isAjax() ) {

                        $iTotalProperty = $this->CcTrunk->find('count');
                        $aTrunks = $this->CcTrunk->find('all');
                        $jTrunks = Set::extract($aTrunks, '{n}.CcTrunk');

                        $this->set('total', $iTotalProperty);
                        $this->set('trunkgroups', $jTrunks);

                }

        } // End of getTrunkGroups()

Function from Controller 3:

        public function getGroups() {

                $this->log("GROUPSSSSSSSSSSSSSSSSSSSSSS", LOG_DEBUG);
                $this->log($_SESSION, LOG_DEBUG);

                $this->layout = 'ajax';

                if ( $this->RequestHandler->isAjax() ) {

                        $i_count = $this->Group->find('count');
                        $a_groups = $this->Group->find('all');
                        $j_groups = Set::extract($a_groups, '{n}.Group');

                        $this->set('j_groups', $j_groups);
                        $this->set('i_total', $i_count);

                }

        } // End of getGroups()

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to