-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Good Tuesday All java lover,
I have some tables to determine the rights access for a user,
master_user
userId, userName, userPasswd
master_menu
menuId, title, path
master_role
roleId, roleName, userId
master_role_access
roleId,menuId, startAccess, endAccess
please show me the concept how to create a dynamic menu for a user, especially the related about menubar component and DAO ( findMenuByUserId )
FYI : I use spring and hibernate
Thank a lot for reading, advice or comment my thread
Regards,
Pro G.
hi progamerdotcom,
Conceptually it seems straightforward. Read user details and build your user model. DAO should provide methods to get you user specific menu and then use either Java APIs to build Menu/Menuitem components or use ZK Bind to construct menu. What have you tried so far? Have you run into any issues? It would take someone few hours to implement this user case which is a big ask.
You can look at the available documentation like ZK Hibernate or you can learn how to use ZK+Spring and JPA from this ZK Todo sample app by Simon Messy to help you get the direction.
I strongly encourage you to have a look at spring security framework, unless you already did it. Security is a very delicate matter and in my opinion must be handled with care.
Spring security module can be used in many different ways. To integrate it with your own security model you have to implement an interface and the database access to load the implementation from your security database.
To enforce security I built some "security" aware menuitem components extending the Menuitem zul component. Once you have the authentication object made available by the spring security module, these components can access it and decide if make themselves visible or not (or disabled or not depending your needs). So the zul page menu definition contains always all the items, but these are dynamically sent to the user's browser depending on the user rigths.
Hope this can help you.
/Adriano
Thanks ashishd and Adriano.
@ashishd ::
I am learning to zk for 2 weeks, I still learn the components in zk, I try with the sample code from some war on internet,
with your links above , sorry I cant get some enlightenment :D ,, I must to be hard in learning thank for your advices
@Adriano ::
thanks , I will try the basic first, and will increase it.
in zksample2, its covered my need to create dynamic menu ?
thanks.
Good afternoon,
Menubar.zul:
<window id="wind" apply="com.pro.ctrl.MenubarCtrl"> </window>
MenubarCtrl.java
public class MenubarCtrl extends GenericForwardComposer{ private Menubar menubar; bla .. bla .. bla }
how to make MenubarCtrl to generate Menubar component programatically (not make in zul file).
I have list of menu by user.
List<Menu> listMenu = findListMenuByUser(String user);
Content of listMenu :
Menu ID : Parent ID : Path
1 : 1 : master_patient.zul
2: 1 : master_doctor.zul
3: 1: master_nurse.zul
Thanks
Asked: 2012-10-09 02:35:52 +0800
Seen: 179 times
Last updated: Oct 25 '12