Retrieving AuthLocalUsers info in another plugin

Asked by John Clements

How can I see/show what user is currently logged in with AuthLocalUser while inside another plugin?

sfContext::getInstance()->getUser()

The above will show me the "admin" that I am logged in as, but I need to view the "network" user. I would like to see the username and the status (allowed, denied, etc) of the user.

Thanks.

Question information

Language:
English Edit question
Status:
Answered
For:
AuthPuppy Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
John Clements (jclements-i) said :
#1

No clue anyone? GBastien? Anyone???

Revision history for this message
gbastien (gbastien02) said :
#2

Look at function executeMyaccount in apAuthLocalUserPlugin/modules/apAuthLocalUserLogin/actions/actions.class.php

It contains the following code:

    // Use the current identity
    $identity = $this->getUser()->getAttribute('identity');

    if (!is_null($identity) && ($identity->getAuthenticator() instanceof apAuthLocalUser)) {
      $this->form = new apAuthLocalUserMyAccountForm($identity->getIdentityObject());

So $identity->getIdentityObject() would be the apUser you want.

Revision history for this message
John Clements (jclements-i) said :
#3

Thanks! I had actually discovered another way earlier:

$identity = sfContext::getInstance()->getUser()->getAttribute('identity');

Then I just checked against:

$identity->getId();

I will check what you posted over the weekend. It is quitting time now and I am heading home to have a beer! Thanks again and have a good weekend.

Revision history for this message
John Clements (jclements-i) said :
#4

GBastien, I just tried what you suggested and it gave me an error.

Call to undefined method apAuthorizeDotNetSubscribeForm::getUser()

That is if I use $this->getUser(), but doing it with sfContext::getInstance()->getUser() works.

Off to home. Thanks again for your time.

Can you help with this problem?

Provide an answer of your own, or ask John Clements for more information if necessary.

To post a message you must log in.