Session management with separate entry scripts

Starting from the suggestions on http://www.yiiframework.com/wiki/33/organize-directories-for-applications-with-front-end-and-back-end I am developing a double-ended application with an entry script for the front-end part and another one for the back-end administration panel.

My problem is that frontend and backend logons are independent. If I log in e.g. as "admin" on my backend, the frontend still has me as a guest, and if I log in from the frontend e.g. as "editor", I am seen as editor on the frontend and admin on the backend. If I log off from either end, both users are logged off.

I am using two separate config files, where the backend inherits and sort of extends the frontend settings.

This is the dump result of Yii::app()->session->toArray():


array

(

    '502a9d486b12ee08fa689a7b194d74c1__id' => '2'

    '502a9d486b12ee08fa689a7b194d74c1__name' => 'editor'

    '502a9d486b12ee08fa689a7b194d74c1name' => 'editor'

    '502a9d486b12ee08fa689a7b194d74c1role' => 'editors'

    '502a9d486b12ee08fa689a7b194d74c1__states' => array

    (

        'name' => true

        'role' => true

    )

    'bf092e7b507e19e4039c4f5cb58b9bc7__id' => '1'

    'bf092e7b507e19e4039c4f5cb58b9bc7__name' => 'admin'

    'bf092e7b507e19e4039c4f5cb58b9bc7name' => 'admin'

    'bf092e7b507e19e4039c4f5cb58b9bc7role' => 'administrators'

    'bf092e7b507e19e4039c4f5cb58b9bc7__states' => array

    (

        'name' => true

        'role' => true

    )

)

Both sessions are saved on the same cookie, but the login data for each entry script are stored on separate values.

Is there a way to have both scripts use the same values and share login data?

Thanks

gm

EDIT: the two ends share the models folder and thus the LoginForm.php file, as well as the UserIdentity component which extends CUserIdentity.

CWebUser::$stateKeyPrefix is configurable:




'components' => array(

	'user' => array(

		'stateKeyPrefix' => '...set it to the same value for both backend and frontend ',

	),

),




That works! Thanks a lot. I kept looking for the answer in CUserIdentity and CHttpSession…

I will post my improvement suggestions to the above mentioned wiki article as soon as I finish testing.

Yii rocks!

gm