Alex Tech Adventures The webs best tutorials!

Welcome, Guest
Please Login or Register.    Lost Password?

Unsafe behavior with un-registered resources
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Unsafe behavior with un-registered resources
#659
Unsafe behavior with un-registered resources 1 Year, 9 Months ago Karma: 1
I have played around a little with your source from tutorial 19 (and earlier version aswell) and have some questions and behaviors I would like to clear out:

First.. do I have any preformence, effective or security reasons or why should I use nagivagion in XML? For me it just look more complicated. My own setup will be: a public module and a admin module with both own layouts and menus.

So when i comment out/delete the nav-implemention in the bootstrip-file:
// $navContainerConfig = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml', 'nav');
// $navContainer = new Zend_Navigation($navContainerConfig);
//
// $view->navigation($navContainer)->setAcl($this->_acl)->setRole(Zend_Registry::get('role'));


A very strange behavior appears:
When I type in and open a controller/action that is not registered as a resource in LibraryACL.php the error "Resource 'admin:book' not found " will be printed, but not just that:
Also the controller/script data/view will be dispach and showed together with a double of the layout. See attach printscreen.

So this comes after I de-active the navigation.xml, because if the nagiation should be active but a controller/action is open without it's registered in the LibraryACL.php it will make a earlier error-message that also stop's the rest of page from prosecute.

How do I solve this, or should is stick with the navigation-idea? Then give me a good reasion
Again, thanks for good site and tutorials!
This image is hidden for guests. Please login or register to see it.
Skatan
Fresh Boarder
Posts: 11
graphgraph
User Offline Click here to see the profile of this user
Last Edit: 2010/05/12 21:18 By Skatan.
The administrator has disabled public write access.
 
#661
Re:Unsafe behavior with un-registered resources 1 Year, 9 Months ago Karma: 16
Double layout problem is not related to navigation, as far as I remember. I think I fixed that by changing method preDispatch in AccessCheck to dispatchLoopStartup. Problem here is with preDispatch ACL permissions are checked twice when error occurs because preDispatch happens for every new request, including internal redirect on errors. dispatchLoopStartup starts working at a lower level so a second dispatch route does not trigger it.

Let me know if this does not fix it.

About navigation now.
The whole point is to avoid having to deal with HTML when creating menus. It makes sure links are always correct and secured links are not present by accident with help of ACL. True, if ACL disables a controller no one can get to it anyway even if it is listed in menu, but with Z_Nav it prevents potential oversight.
So all in all its just a convenience.

Why XML?
Format does not matter but what does matter is if you use Z_Cache menu will not be processed (unless it changes). You do not want to waste resources on something that is static most of the time so by caching it Z_Nav reads the xml only when necessary. I do see your point on how the same thing can be done by not using Z_Nav in the first place and just put the menu manually in layout.

What would be really nice is if the IDE generated the XML menu file automatically when I create controllers/actions eliminating the need to do any work on the menu at all. Until then, Z_Nav only avoids mistakes in HTML code and potential oversight in putting up links to denied controllers.
alexanderrv
Administrator
Posts: 279
graph
User Offline Click here to see the profile of this user
Gender: Male tmthv2 alexchatonly@hotmail.com Location: Freeport, Bahamas Birthdate: 1989-04-14
The administrator has disabled public write access.
 
#666
Re:Unsafe behavior with un-registered resources 1 Year, 8 Months ago Karma: 1
Hey again Alex,

dispatchLoopStartup dosn't help, the layout, the controller&view-data gets public and the layout gets double.

XML-nav maybe is a idea after all, do you have a solution to make seperat navigations files for each module, like one for public/default and another for admin.
Skatan
Fresh Boarder
Posts: 11
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#685
Re:Unsafe behavior with un-registered resources 1 Year, 7 Months ago Karma: 1
Still no solution idea?
Skatan
Fresh Boarder
Posts: 11
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#686
Re:Unsafe behavior with un-registered resources 1 Year, 7 Months ago Karma: 16
Hi.
There should exist a punishment for me when I neglect questions for too long.

I am beginning to think this is a ZF bug. There was already a similar one back in 1.5 zendframework.com/issues/browse/ZF-2993 but was due to missing view scripts.
In our case ErrorHandler plugin does not behave properly specifically on ACL. Even forcing mvcSuccessfulActionOnly = true does not help. Look at how mvcSuccessfulActionOnly =true/false affects the layout when throwing any random exception in any controller throw new Exception('forced exception');. When it is false, you get a double layout and when true - as a part of parent, all as expected. ACL issues ignore that setting.

That said, it could still be me who is putting ACL check at the wrong sequence causing layout renderer to be activated twice regardles of above option. Cannot figure out where it should be instead. And Googling for "double layout" gives me results to this topic which really does not help in seeing if others experience the same issue :/

I have 2 ideas for separate navigation for each module. I want to see which one of them will work after looking a this double layout issue.
alexanderrv
Administrator
Posts: 279
graph
User Offline Click here to see the profile of this user
Gender: Male tmthv2 alexchatonly@hotmail.com Location: Freeport, Bahamas Birthdate: 1989-04-14
Last Edit: 2010/06/16 10:21 By alexanderrv.
The administrator has disabled public write access.
 
Go to topPage: 1
Moderators: alexanderrv
You are here: Home Forum

Statistics

Members : 1401
Content : 42
Web Links : 1
Content View Hits : 191193

Poll

Interested in TinyBrowser and TinyMce plugin for ZF?
 

Who's Online

We have 37 guests online