Zendcasts Forum

A community of developers who work with the Zend Framework and other enterprise PHP technologies

You are not logged in.

#1 2010-04-26 09:47:29

naievepanda
New member
Registered: 2010-04-26
Posts: 2

Zend_Navigation and Zend_Acl

Goodafternoon

I have been busy whole day studying / experimenting with zendFramwork.
Now i still have some issue:
I have build my navigation within an specific ini file (see below)
and i load that one into the application.ini with

; —
; Navigation
; —
config = APPLICATION_PATH "/configs/resources/navigation.ini"

this works great but if i want to load my routes the same way it doens't seem te find mij routes :s

; —
; Routes
; —
; config = APPLICATION_PATH "/configs/resources/routes.ini"

Second, i have setup an ACL and i know want to disable the logout link if you aren't logged in
and allso the profile link. i have searched on google but i could find a suited answer :s

Thnx in advance smile

navigation.ini

; —
; Navigation
; —
resources.view[] = ""
resources.navigation.pages.page1.label = "Home"
resources.navigation.pages.page1.module = "default"
resources.navigation.pages.page1.controller = "index"
resources.navigation.pages.page1.action = "index"

resources.navigation.pages.page2.label = "User"
resources.navigation.pages.page2.module = "default"
resources.navigation.pages.page2.controller = "user"
resources.navigation.pages.page2.action = "index"

resources.navigation.pages.page3.label = "Profile"
resources.navigation.pages.page3.module = "default"
resources.navigation.pages.page3.controller = "user"
resources.navigation.pages.page3.action = "profile"

resources.navigation.pages.page4.label = "Login"
resources.navigation.pages.page4.module = "default"
resources.navigation.pages.page4.controller = "user"
resources.navigation.pages.page4.action = "login"

resources.navigation.pages.page5.label = "Logout"
resources.navigation.pages.page5.module = "default"
resources.navigation.pages.page5.controller = "user"
resources.navigation.pages.page5.action = "logout"

acl.ini

[development]
acl.roles.guest         = null
acl.roles.user          = guest
acl.roles.admin         = user

acl.resources.allow.index.index     = guest
acl.resources.allow.error.error     = guest

acl.resources.allow.user.index      = guest
acl.resources.allow.user.login      = guest
acl.resources.allow.user.register   = guest
acl.resources.allow.user.profile    = user
acl.resources.allow.user.logout     = user
acl.resources.allow.user.admin      = admin

Offline

#2 2010-04-27 07:36:20

naievepanda
New member
Registered: 2010-04-26
Posts: 2

Re: Zend_Navigation and Zend_Acl

the problem with the loaded configs is solved
you have to add them as an array

; —
; Navigation
; —
config.nav = APPLICATION_PATH "/configs/resources/navigation.ini"

; —
; Routes
; —
config.routes = APPLICATION_PATH "/configs/resources/routes.ini"

Offline

#3 2010-08-26 20:45:22

samuelherzog
Member
From: Eugendorf, Austria
Registered: 2009-08-18
Posts: 27

Re: Zend_Navigation and Zend_Acl

In case somebody searches here:
to have the acl work on your navigation you need to define resource (and if suitable privileges) for your pages
using the example of your profile page:

resources.navigation.pages.page3.label = "Profile"
resources.navigation.pages.page3.module = "default"
resources.navigation.pages.page3.controller = "user"
resources.navigation.pages.page3.action = "profile"
resources.navigation.pages.page3.resource= "user" // matches the acl resource
resources.navigation.pages.page3.privilege = "profile" // matches the acl privilege

here is a blog series i've found helpful when learning Zend_Navigation (and integration with other components) http://www.brandonsavage.net/an-intro-t … avigation/

Offline

Board footer

Powered by FluxBB