Hello all,

Another newbie question.  I've spent several days hunting for a way to
determine if a user has been authenticated or not from within
layout.php

Reading the API (symfony 1.4) I thought one of the three boolean
functions below would let me know if a user object is instantiated or
not, but they don't.  My goal is to check first and not call the
get('user') function unless the user  object has been instantiated.
The 'if' tests below yield the same results regardless of whether or
not I've logged in a user using the sfGuardPlugin.  I'm in the wrong
track it seems, but given that I'm attempting to execute this code
from layout.php, not sure what the correct approach should be.  Any
advice would be greatly appreciated. I note that config shows "symfony/
user/sfUser/authenticated: true"  and alternatively I've been trying
to figure out how to access that info, but with no luck.

Thanks
 -Michael


if(sfContext::getInstance()->hasInstance('user'))
  fwrite ($file, "hasInstance\n");
if(sfContext::getInstance()->has('user'))
  fwrite ($file, "has\n");
if(sfContext::getInstance()->offsetExists('user'))
  fwrite ($file, "offsetExists\n");
$user = sfContext::getInstance()->get('user');
fwrite ($file, $user.": \n");

session:
  symfony/user/sfUser/attributes: { symfony/user/sfUser/attributes:
{  }, admin_module: { sfGuardUser.sort: [username, asc],
sfGuardGroup.sort: [null, null], sfGuardPermission.sort: [null, null],
student_class_standing.sort: [class_of_year, desc], payment_type.sort:
[null, null], student.sort: [last_name, asc],
transaction_receipt.sort: [paid_date, desc], student_fee.sort: [null,
null], institution.sort: [null, null] }, symfony/user/sfUser/flash:
{  }, symfony/user/sfUser/flash/remove: {  }, sfGuardSecurityUser:
{ user_id: '2' } }
  symfony/user/sfUser/authenticated: true
  symfony/user/sfUser/credentials: [admin_permission,
frontoffice_permission, reports_permission, backoffice_permission]
  symfony/user/sfUser/culture: en
  symfony/user/sfUser/lastRequest: 1269561611

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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

To unsubscribe from this group, send email to 
symfony-users+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to