aspose file tools
The moose likes JSP and the fly likes Role based Authorization for Tree Structure Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Role based Authorization for Tree Structure" Watch "Role based Authorization for Tree Structure" New topic
Author

Role based Authorization for Tree Structure

Deepaks Deshpande
Ranch Hand

Joined: Dec 06, 2007
Posts: 76

I have a javascript based tree structure in my jsp, I want to perform user level authorization for each node/leaf of the tree on clicks on the corresponding node/leaf. I am using the tree structure from http://www.destroydrop.com/javascripts/tree/default.html . I am adding the id, parentId, Name, Title,and path information of the node/leaf from the database by using JSONObject. I have a scenario where, at present I have 2 types of users - Admin and Group Users. Admin is authorized to view the entire tree structure. Group user is assigned to a particular group and should be able to view the tree structure according to the group to which he belongs. How should I perform user level authorization for this?

This message was edited 1 time. Last update was at by David Newton



Regards,
Deepak

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12612
Only build the tree nodes the user is allowed to see.
Deepaks Deshpande
Ranch Hand

Joined: Dec 06, 2007
Posts: 76

I have a ACL (Access Control List) table where in I get the particular user's access_group_id, which is the group id to which the signed in user belongs. Based on this I need to display nodes/leaves which can be viewed by that particular user.How should i check if the user is authorized to view the node/leaf when he clicks on the node.Can we do it in javascript ?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12612
Sure.
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 639
Why not build the data for constructing the tree in your Page Controller servlet?
There you should have your user identifier which you should be able to use to get the list of groups in which your user participates.
It should then be a simple matter to build the Tree data, including only those nodes your user is allowed to see.
Then, your view (JSP) page can just build the resulting page based on the data in the session (or wherever you store it).
No JavaScript necessary.

By the way, before you choose to implement via JavaScript, what happens when JavaScript is not enabled on a client?
 
 
subject: Role based Authorization for Tree Structure
 
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture