0

dynamic menu using menubar component

asked 2012-10-09 02:35:52 +0800

progamerdotcom gravatar image progamerdotcom
117 5

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.

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2012-10-09 04:32:42 +0800

ashishd gravatar image ashishd flag of Taiwan
1972 6

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.

link publish delete flag offensive edit

answered 2012-10-09 14:23:01 +0800

aros54 gravatar image aros54
66

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

link publish delete flag offensive edit

answered 2012-10-10 02:24:49 +0800

progamerdotcom gravatar image progamerdotcom
117 5

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.

link publish delete flag offensive edit

answered 2012-10-25 08:05:17 +0800

progamerdotcom gravatar image progamerdotcom
117 5

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

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-10-09 02:35:52 +0800

Seen: 179 times

Last updated: Oct 25 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More