protected void Page_Load(object sender, EventArgs e) { MAutoservice mClass = ((MAutoservice)this.Master); Tools.Tool.UpdateUri(this); LoginData login = LoginUser.LogedUser(this.Page); Boolean isAdmin = false; if (login != null) { IAMDatabase database = new IAMDatabase(IAMDatabase.GetWebConnectionString()); try { Int64 enterpriseId = 0; if ((Session["enterprise_data"]) != null && (Session["enterprise_data"] is EnterpriseData)) { enterpriseId = ((EnterpriseData)Session["enterprise_data"]).Id; } using (IAMRBAC rbac = new IAMRBAC()) isAdmin = rbac.HasAdminConsole(database, login.Id, enterpriseId); } catch { } } String html = ""; html += "<ul class=\"home\">"; if (isAdmin) { html += " <li><a href=\"" + Session["ApplicationVirtualPath"] + "admin/\"><div class=\"btn c2\"><div class=\"inner\"><i class=\"icon-change\"></i><span>Admin</span></div></div></a></li>"; } html += " <li><a href=\"" + Session["ApplicationVirtualPath"] + "autoservice/user/\"><div class=\"btn c3\"><div class=\"inner\"><i class=\"icon-profile\"></i><span>Informações gerais</span></div></div></a></li>"; html += " <li><a href=\"" + Session["ApplicationVirtualPath"] + "autoservice/user/changepassword/\"><div class=\"btn c1\"><div class=\"inner\"><i class=\"icon-key\"></i><span>Alterar senha</span></div></div></a></li>"; html += " <li><a href=\"" + Session["ApplicationVirtualPath"] + "autoservice/access_request/\"><div class=\"btn c5\"><div class=\"inner\"><i class=\"icon-page\"></i><span>Requisição de acesso</span></div></div></a></li>"; html += " <li><a href=\"" + Session["ApplicationVirtualPath"] + "logout/\"><div class=\"btn c4\"><div class=\"inner\"><i class=\"icon-exit\"></i><span>Desconectar</span></div></div></a></li>"; html += "</ul>"; contentHolder.Controls.Add(new LiteralControl(html)); }
protected void Page_Load(object sender, EventArgs e) { if (!EnterpriseIdentify.Identify(this.Page)) //Se houver falha na identificação da empresa finaliza a resposta { return; } login = LoginUser.LogedUser(this.Page); if (login == null) { Session["last_page"] = Request.ServerVariables["PATH_INFO"]; Response.Redirect("/login/"); } if ((Session["enterprise_data"]) != null && (Session["enterprise_data"] is EnterpriseData)) { enterpriseId = ((EnterpriseData)Session["enterprise_data"]).Id; } if (login != null) { try { using (IAMDatabase database = new IAMDatabase(IAMDatabase.GetWebConnectionString())) using (IAMRBAC rbac = new IAMRBAC()) isAdmin = rbac.HasAdminConsole(database, login.Id, enterpriseId); } catch { } } if (!isAdmin) { Response.Redirect(System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath + "autoservice/"); } //Identifica a página atual com objetivo de mostrar o ícone como selecionado no rodapé String scriptName = Request.Params["SCRIPT_NAME"].ToLower(); String ApplicationVirtualPath = Session["ApplicationVirtualPath"].ToString(); if (ApplicationVirtualPath == "/") { ApplicationVirtualPath = ""; } if (ApplicationVirtualPath != "") { scriptName = scriptName.Replace(ApplicationVirtualPath, ""); } l1 = l2 = l3 = false; scriptName = scriptName.Trim("/ ".ToCharArray()); switch (scriptName.ToLower()) { case "admin": l1 = true; break; } }