asp.net - Role implementation not picked up by menu list -
i implementing user roles. have menu list drawn in html , controlling visibility of them code behind. have 3 database tables, user w/ user_number, user_role_id
, roles w/ role_id, role_name
, user_roles w/ user_role_id, user_number, role_id
. role_id
integer linked role name. each user assigned 1 of 6 of these integers , role based on this. work expected apart administrator
role int 3. allow me display or hide table based on role, exception of lstadminmenu
. have tested other roles , menus , can show menu in role except lstadminmenu
in administrator role
. menu contorl is:
<li runat="server" id="lstadminmenu"><a class="menuitem">administration</a> <ul class="submenu"> <li><a href="../administrative/createstudent.aspx">create student</a></li> <li><a href="../administrative/enrollstudent.aspx">manual enrollments</a></li> <li><a href="../administrative/enrollstudent.aspx">edit student</a></li> <li><a href="../administrative/createstaff.aspx">create staff member</a></li> <li><a href="../administrative/createavos.aspx">create advisor</a></li> <li><a href="../administrative/addresults.aspx">input grades</a></li> <li><a href="../administrative/feespaid.aspx">fees</a></li> <li><a href="../administrative/newmodulesandprog.aspx">create module</a></li> <li><a href="../administrative/admineditdegreesmodules.aspx">edit modules</a></li> <li><a href="../administrative/editstudentstatus.aspx">student status</a></li> <li><a href="../administrative/markmodulesasrunningsuspended.aspx"/>module status</li> <li><a href="../administrative/addmoduleevents.aspx">module events</a></li> <li><a href="../administrative/passwordgeneration.aspx">password reset</a></li> <li><a href="../administrative/import.aspx">import</a></li> <li><a href="../administrative/addbuildingorroom.aspx">create estate</a></li> </ul> </li>
code behind:
'' initialise admin profile dim administrator boolean administrator = false each role role in userpermissions if role.role_id = 3 administrator = true exit end if next if administrator lstadminmenu.visible = true lstacademics.visible = false lstseniorum.visible = false lstacademicpm.visible = false else lstadminmenu.visible = false end if
also when debug says role aministrator , visibility of lstadminmenu
true. cannot 1 figured out @ all.
it appear many arguments visibility on page causing confliction roles. have changed menus hidden default , each item shows if correct user logged in. code more each role:
if administrator lstadminmenu.visible = true end if
Comments
Post a Comment