Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different session timeouts for admin and users in CAKEPHP 2.0. is it possible?

I am using cakephp 2.0 for developing a website. Site will contain only 2 types of users. Admin and users(customers). now I need to set session time out 10 minutes for customer and 1 hour for admin. is it possible ?. My core.php file contains the line like this,

Configure::write('Session', array(
    'defaults'      => 'php',
    'cookie'        => 'xyz',
    'timeout'       => 10,
    'checkAgent'    => false,
));
like image 916
AnNaMaLaI Avatar asked Dec 11 '25 22:12

AnNaMaLaI


1 Answers

It is more correct you do this condition in the AppController than to change your core.php this magnitude. You can make only this:

Configure::write('Session.timeout', 60);

And if you're using Acl, verify if user is admin using his own Acl method instead strripos.

like image 96
Paulo Rodrigues Avatar answered Dec 16 '25 02:12

Paulo Rodrigues



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!