Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

session

posted by dao27 9 years ago

i updated to the last flowrish code and have some problem:

if ($find_agency->getAgencyName() === fRequest::get("user_name") && $find_agency->getPassword() === fRequest::get("password"))
			{
				fAuthorization::setUserAuthLevel($find_agency->getAgencyType());
				fAuthorization::setUserToken($find_agency->getAgencyId());
				fAuthorization::setUserACLs(array(
					'*' => array(
						'*'
					)
				));
				fURL::redirect(fAuthorization::getRequestedURL(TRUE, 'http://localhost/turism/admin/'));
			}
			else
			{
				throw new fValidationException("Username or/and password don't match.");
			}

so :

fCore::expose(fAuthorization::getUserACLs());
echo fAuthorization::getUserAuthLevel();


if (fAuthorization::checkACL('users', 'edit')) {
    echo 'ai voie';
} else { echo 'nu ai voie'; }

works for that page and other from that patch but in admin director doesn't. What shoul i do?

Your code never calls fAuthorization::requireACL(), fAuthorization::requireAuthLevel() or fAuthorization::requireLoggedIn(), so I don't believe fAuthorization::getRequestedURL() will return anything.

The issue you are having is that fURL::redirect() isn't redirecting to the proper place, correct? If this isn't the case, can you include some more code so I can see how you are setting up your session.

posted by wbond 9 years ago

if i call fAuthorization::requireACL(); i never can go to admin because the fCore::expose(fAuthorization::getUserACLs()) print {null} and i don't have right to see that page and redirect me back to fAuthorization::setLoginPage. my issue is that the session keep value on http://site.com(index.php or somethingelse.php) but don't keep session include auth or ACl on http://site.com/admin/{index.php or somethingelse.php}. redirecting on fURL::redirect(fAuthorization::getRequestedURL(TRUE, 'http://localhost/turism/admin/')) work.

posted by dao27 9 years ago

right back i write the message i figure out what cause the problem. for admin part i have anoter config.php so in that i call another fSession::setPath (DOC_ROOT . '/storage/session/') and now this directory become others since i have another DOC_ROOT. tanks for your time, i'm glad i figure out. but curiosity is that before used auth class not with ACL and with same config file different from site to admin and it's the first time i have this issue.

posted by dao27 9 years ago

I'm glad you figured this out. It has seemed that many of the session issues I've fielded seem to be related to not initializing the session the same on different pages. I wonder how I could add some documentation to improve this.

posted by wbond 9 years ago