Click here to Skip to main content
15,904,024 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have googled search for a while but still couldn't get the right articles or examples to put me through. I'm currently working(learning) on a role based application which i doing well. I'm currently having a problem. i have a table in my sql db called SiteMap. This table has the following columns (id, Title, Description, Url, roles, parentId, TabType and TabOrder). I have values for each columns. What i want to achieve is that when a user logs in, i want to have navbar based on the role of that user. If the user is a guest, I want to display a navbar with the roles of just guest. How do i have this?

What I have tried:

here is how the db looks like

id  Title          Description    Url        roles    parentId    TabType    TabOrder
  
 1   ROOT             ROOT                      *        NULL         0           0
 
 2   Administrator   Padmin     PortalAdmin#   Admin       1          1           2

 3   Report                      Reporting#    Admin       1          1           3
 
 4  Ticket                       Ticket     Admin;Guest    1          1           4

 5  Manage Ticket             Mticket.aspx    Guest        4          4           2


here is a summary of what i want to do. When a user that is with the role of guest logs in, only Ticket(with sub menu Manage Ticket) should be in the navbar. If its a user with Admin role, Portal Administration, Report, Ticket(with submenu Manage Ticket) should be displayed in the navbar. I hope you do understand what i explained. Thanks
Posted
Updated 28-Jan-17 5:43am
v2
Comments
Peter Leow 12-Jan-17 10:28am    
You table data example looks confusing. Can you use <pre> tag to format and align them? There seems to be some missing data.
Mcbaloo 12-Jan-17 10:49am    
Done that. Honestly can't think of where to begin from that's why i didnt provide any code. Was told to make use of this approach for a project
ZurdoDev 12-Jan-17 14:00pm    
This is very simple. Check the role of the user, if they are guest then hide all options except for Ticket. If they are admin, then show everything.

1 solution

As you need a starting point have a look at this article here on CP - Binding Sitemaps with Menu Control Based on User Privilege at Runtime[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900