private void securityChecking(string userId, string domain) { nUser usr = new nUser(userId, domain); if (usr.isLdapUser) { if (usr.isWebAdmin()) { usr.managerId = 0; usr.isSales = false; usr.isActive = usr.isAdmin = usr.isReportViewer = true; if (!usr.isDBuser) { if (usr.addDBUser()) { usr.Dispose(); securityChecking(userId, domain); return; } } else if (!usr.isActive) { usr.updateDBUser(); } } if (usr.isDBuser && usr.isActive) { Session["usr"] = usr; FormsAuthentication.RedirectFromLoginPage(usr.domain + "/" + usr.UID, false); if (Request.QueryString["ReturnUrl"] == null) { if (Request.UrlReferrer != null) Response.Redirect(Request.UrlReferrer.ToString()); else Response.Redirect("default.aspx"); } else Response.Redirect(Request.QueryString["ReturnUrl"].ToString()); } } else { Label5.Text = "Login Failed"; } }
protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e) { if (e.CommandName == "Update") { string u = ((Label)e.Item.FindControl("uid")).Text.ToString(); string dom = ((Label)e.Item.FindControl("dom")).Text.ToString(); nUser usr = new nUser(u, dom); usr.isActive = ((CheckBox)e.Item.FindControl("isActive")).Checked; usr.isAdmin = ((CheckBox)e.Item.FindControl("isAdmin")).Checked; usr.isSales = ((CheckBox)e.Item.FindControl("isSales")).Checked; usr.isReportViewer = ((CheckBox)e.Item.FindControl("isReportViewer")).Checked; usr.isPriceView = ((CheckBox)e.Item.FindControl("isPriceView")).Checked; usr.uGroup = ((DropDownList)e.Item.FindControl("uGroupList")).SelectedValue.ToString(); usr.updateDBUser(); //nLog.addLog(Me.uid, "Update User", usr.uid + " Updated", Request.Url.ToString(), Session.SessionID); } }