anyone know why this session check does not work like it suppose to

2008-10-09 Thread gabriel

I login, then want to check the session if a person has admin rights

If I login as an 'admin' where the role = admin or if I login as a non-
admin where the role=0, it displays in both situations the admin area
link...

the script:   if ($session-check('Auth.User.role') == 'admin') {
  echo $html-link('Admin Area', '/admin/');
  } else {
  echo $html-link('My Account', '/accnt/');
  }

In the debug the 'role' is set to '0'
in the debug I get :

[Auth] = Array
(
[User] = Array
(
[id] = 3
[username] = gab
[fname] =
[lname] = sdf
[email] = [EMAIL PROTECTED]
[tell] = sdf
[cell] =
[hnum] =
[street] =
[city] = 0
[county_id] = 0
[country_id] = 0
[pcode] =
[maillist] = 0
[created] = 2008-10-01 13:52:50
[role] = 0
[ip] =
[lastvisit] = -00-00 00:00:00
[emailssend] = 0
[browser] = 0
[screen] =
)

)

any help
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: anyone know why this session check does not work like it suppose to

2008-10-09 Thread 3lancer.eu

Hi,

There is essential difference between read() and check() methods of
the Session class.

However, you should rather use the following convention:
http://book.cakephp.org/view/247/AuthComponent-Methods#user-387

Regards,
Piotr
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: anyone know why this session check does not work like it suppose to

2008-10-09 Thread Gabriel Kolbe

ha-ha, thanks, so obvious!

On Thu, Oct 9, 2008 at 2:07 PM, 3lancer.eu [EMAIL PROTECTED] wrote:

 Hi,

 There is essential difference between read() and check() methods of
 the Session class.

 However, you should rather use the following convention:
 http://book.cakephp.org/view/247/AuthComponent-Methods#user-387

 Regards,
 Piotr
 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---