Autorizace na localhostu funguje na serveru ne
- darthcz
- Člen | 113
Dobrý den,
chtěl bych vás poprosit o pomoc s následujícím problémem:
v BasePresenteru mám následující kód:
if (!Environment::getUser()->isAllowed($this->name, $this->view))
....
V Configu tento:
;
; SECURITY WARNING: it is CRITICAL that this file & directory are NOT accessible directly via a web browser!
;
; If you don't protect this directory from direct web access, anybody will be able to see your passwords.
; https://nette.org/en/security-warning
;
[common]
; PHP configuration
php.date.timezone = "Europe/Prague"
php.iconv.internal_encoding = "UTF-8"
php.mbstring.internal_encoding = "UTF-8"
;php.default_charset = "UTF-8"
; variables
variable.lang = en
variable.tempDir = %appDir%/temp
variable.logDir = %appDir%/log
; services
service.Nette-Security-IAuthenticator = UsersModel
service.Nette-Security-IAuthorizator = ACL
service.Nette-Loaders-RobotLoader.option.directory[] = %appDir%
service.Nette-Loaders-RobotLoader.option.directory[] = %libsDir%
service.Nette-Loaders-RobotLoader.run = TRUE
ACL:
$this->allow('admin'); // admin muze vse
$this->allow('redaktor', 'Clanky', array('show', 'edit', 'delete'));
$this->allow('redaktor', 'Users', 'edit');
$this->allow('uzivatel', 'Clanky', 'show');
$this->allow('guest', array('Clanky'));
Jsou to úryvky. Pokud všechny soubory z ftp přehraju na localhost vše funguje. Pokud ale uplně stejné soubory nahraju na server, dostanu chybu 500 internal server error.
V logu se nachází:
[2010–07–01 14–20–57] PHP Fatal error: Uncaught exception ‚ApplicationException‘ with message ‚An error occured while executing error-presenter‘ in /u/SEO/krokus.cz/www/nette/Clanky/libs/Nette/loader.php:646
Nevíte někdo, čím by to mohlo být? Trávím na tom obrovské množství času a nemůžu na to přijít :(
Pokud umažu Environment::getUser()->isAllowed($this->name, $this->view), vše funguje.
- darthcz
- Člen | 113
Toto jsou údaje z Environment::getUser()
Localhost
User Object ( [guestRole] => guest [authenticatedRole] => authenticated [onLoggedIn] => [onLoggedOut] => [authenticationHandler:private] => [authorizationHandler:private] => [namespace:private] => [session:private] => SessionNamespace Object ( [data:private] => Array ( [authenticated] => 1 [identity] => Identity Object ( [id:private] => test@test.cz [roles:private] => Array ( [0] => uzivatel ) [data:private] => Array ( [id] => 15 [email] => test@test.cz [jmeno] => Test [prijmeni] => Test [telefon] => +85+ [heslo] => 098f6bcd4621d373cade4e832627b4f6 [prava] => uzivatel ) [frozen:private] => ) [reason] => [authTime] => 1277988708 [expireBrowser] => [expireDelta] => ) [meta:private] => Array ( [identity] => Array ( [V] => 1 ) ) [warnOnUndefined] => ) )
Server
User Object ( [guestRole] => guest [authenticatedRole] => authenticated [onLoggedIn] => [onLoggedOut] => [authenticationHandler:private] => [authorizationHandler:private] => [namespace:private] => [session:private] => SessionNamespace Object ( [data:private] => Array ( [authenticated] => 1 [identity] => Identity Object ( [id:private] => darthcz@gmail.com [roles:private] => Array ( [0] => admin ) [data:private] => Array ( [id] => 12 [email] => darthcz@gmail.com [jmeno] => sds [prijmeni] => sd [telefon] => +7 [heslo] => 74b87337454200d4d33f80c4663dc5e5 [prava] => admin ) [frozen:private] => ) [reason] => 1 [expireBrowser] => [expireDelta] => ) [meta:private] => Array ( [identity] => Array ( [V] => ) ) [warnOnUndefined] => ) )
- Honza Marek
- Člen | 1664
Kdyžtak když vypneš na chvíli ErrorPresenter, dostaneš lepší výjimku. On ten ErrorPresenter to nějak kazí, což je asi bug.