views:

411

answers:

2

hai everyone........

I am trying to generate dynamic menu according to the user permission given with ACL component in cake php..

ie., if a user logins, i need to check which all actions are permitted for that specific user and according that list of actions i need to generate menu

can any one help me to get all the permitted actions from the acos,aros,acos_aros tables

thanks in advance

+1  A: 

I have an AdminMenu model that defines my admin system navigation hierarchy. This is the same for all users. The structure is cached after every save to it. When a user logs into the Admin system, I fetch the menu data from the cache and also fetch all permissions that logged in user has been granted access to. I do this in a single query. The details are posted here.

I then recursively iterate through the menu data, checking each node against the permissions for that user, and build up a menu structure and store it in the session. This menu structure only contains the nodes the logged in user has permission to access, and it's only generated once, when they log in. This menu structure is then rendered with a helper.

In addition, the permissions are available in the session, so you can check whether to display links in your views or not, e.g. only display the link to delete a post if they have permission to delete it.

neilcrookes
+1  A: 

Try PoundCake Control Panel. Dynamic menu generation is implemented there. It generates only those menu items that user has access to based on acos, aros, acos_aros and menus tables. There is a controller to semi-automatically fill menus table with data from your acos table.

bancer
itz a nice tool i tried...........but it takes a lot of time to load.
RSK
How long does it take? That should be only the first time you access page. Because it verifies user's permissions to every menu item. The results are cached.
bancer