/// <summary> /// Page_Init checks to ensure that the query string is valid and the given position is valid /// </summary> protected void Page_Init(object sender, EventArgs e) { if (currentPosition == null) { Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.UNKNOWN)); } else if (!Roles.IsUserInRole("Admin")) //If the user isn't an admin, check department relationships { User u = daoFactory.GetUserDao().GetUserByLogin(HttpContext.Current.User.Identity.Name); bool positionAccess = false; foreach (Department d in currentPosition.Departments) { //Check if the current unit is in the user's units if (u.Units.Contains(d.Unit)) { positionAccess = true; break; } } //We have gone through all the departments, check if the user has access if (positionAccess == false) { Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.AUTH)); } } }
protected void Page_PreRender(object sender, EventArgs e) { if (!Roles.IsUserInRole("Admin")) { Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.AUTH)); } }
/// <summary> /// Check to ensure that they querystring "PositionID" is not null or empty /// </summary> private void CheckQueryString() { if (string.IsNullOrEmpty(Request.QueryString[STR_PositionID])) { Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.UNKNOWN)); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { lblErrorType.Text = RecruitmentConfiguration.ErrorMessage(Request.QueryString["reason"]); } }
private void createProfileForUser(string email) { Applicant newUser = ApplicationBLL.GetByEmail(email); if (newUser == null) { Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.AUTH)); return; } //Create a blank profile for the logged in user Profile blankProfile = new Profile(); blankProfile.AssociatedApplicant = newUser; blankProfile.FirstName = string.Empty; blankProfile.LastName = string.Empty; blankProfile.Address1 = string.Empty; blankProfile.City = string.Empty; blankProfile.State = string.Empty; blankProfile.LastUpdated = null; using (var ts = new TransactionScope()) { ProfileBLL.EnsurePersistent(blankProfile); ts.CommitTransaction(); } }
protected void Page_Load(object sender, EventArgs e) { //Only Scott can use this testing page if (!Roles.IsUserInRole("EmulationUser")) { Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.AUTH)); } }
protected void Page_Load(object sender, EventArgs e) { //if the current position does not have a database association, redirect to an error page if (currentPosition == null) { Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.UNKNOWN)); } //Make sure the current's position isn't closed and that it is allowing applications if (currentPosition.Closed || !currentPosition.AllowApps) { Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.AUTH)); } //Now we have a valid Position, so fill in the corresponding fields Title = string.Format("Position Details: {0}", currentPosition.PositionTitle); lblPositionTitle.Text = currentPosition.PositionTitle; lblPositionNumber.Text = currentPosition.PositionNumber; //txtPositionDescription.Text = currentPosition.ShortDescription; litPositionDescription.Text = currentPosition.ShortDescription; //lblDatePosted.Text = currentPosition.DatePosted.ToShortDateString(); lblDeadline.Text = currentPosition.Deadline.ToShortDateString(); lblDepartments.Text = currentPosition.DepartmentList; lblNumReferences.Text = currentPosition.NumReferences.ToString(); lblNumPublications.Text = currentPosition.NumPublications.ToString(); //lblHRRep.Text = currentPosition.HRRep ?? "N/A"; //lblHRPhone.Text = currentPosition.HRPhone ?? "N/A"; //lblHREmail.Text = currentPosition.HREmail ?? "N/A"; //Setup the StyleSheet //First find the "primary department" if (currentPosition.PrimaryDepartment == null) { //If we don't have a primary department, get the default theme pnlDepartmentLogo.CssClass = defaultTheme.ThemeName; } else { Theme primaryDepartmentTheme = ThemeBLL.GetNullableByID(currentPosition.PrimaryDepartment.DepartmentFIS); if (primaryDepartmentTheme == null) { //If the primary department doesn't have a theme, get the default pnlDepartmentLogo.CssClass = defaultTheme.ThemeName; } else { //We have a primary dept and a theme pnlDepartmentLogo.CssClass = primaryDepartmentTheme.ThemeName; } } }
/// <summary> /// Page_Init checks to ensure that the query string is valid and the given position is valid /// </summary> protected void Page_Init(object sender, EventArgs e) { if (currentPosition == null) { Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.QUERY)); } bool allowedAccess = false; foreach (CommitteeMember memberAccess in currentPosition.CommitteeMembers) { if (memberAccess.DepartmentMember.LoginID == HttpContext.Current.User.Identity.Name) { //Only committee members should have access if (memberAccess.MemberType.ID == (int)MemberTypes.CommitteeChair || memberAccess.MemberType.ID == (int)MemberTypes.CommitteeMember) { allowedAccess = true; break; } } } if (!allowedAccess) //if they don't have committee access, check admin access { if (Roles.IsUserInRole("Admin")) { allowedAccess = true; } else { User u = daoFactory.GetUserDao().GetUserByLogin(HttpContext.Current.User.Identity.Name); foreach (Department d in currentPosition.Departments) { //Check if the current unit is in the user's units if (u.Units.Contains(d.Unit)) { allowedAccess = true; break; } } } } if (!allowedAccess) { Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.AUTH)); } }
protected void Page_Init(object sender, EventArgs e) { if (User.Identity.IsAuthenticated == false) { FormsAuthentication.RedirectToLoginPage(); return; } bool CommitteeMember = CommitteeMemberBLL.IsUserMember(MemberTypes.AllCommittee); bool FacultyOrReviewMember = CommitteeMemberBLL.IsUserMember(MemberTypes.FacultyMember) || CommitteeMemberBLL.IsUserMember(MemberTypes.Reviewer); pnlCommitteeAccess.Visible = CommitteeMember; pnlFacultyAccess.Visible = FacultyOrReviewMember; //If the user is neither, redirect them to the error page if (!CommitteeMember && !FacultyOrReviewMember) { Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.AUTH)); } }
/* * public ErrorReporting eReport = new ErrorReporting(WebConfigurationManager.AppSettings["AppName"], * WebConfigurationManager.AppSettings["ErrorFromEmail"], * WebConfigurationManager.AppSettings["ErrorAdminEmail"]); */ protected override void OnError(EventArgs e) { //Might want to rollback the transaction whenever an error gets this far up the stack NHibernateSessionManager.Instance.RollbackTransaction(); //Grab the page context HttpContext ctx = HttpContext.Current; //Grab the exception that raised this error Exception ex = ctx.Server.GetLastError(); //Only handle HttpException Errors if (ex.GetType().Name == "HttpException") { //Clear the error and redirect to the page the raised this error (getting a fresh copy) ctx.Server.ClearError(); ctx.Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.SESSION)); } base.OnError(e); }
/// <summary> /// Page_Init checks to ensure that the query string is valid, the logged in user is an admin or equivalent, the given application is valid /// </summary> protected void Page_Init(object sender, EventArgs e) { if (currentApplication == null) { //if the current application does not have a database association, redirect to an error page Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.UNKNOWN)); } if (AdministrativeAccess) //Only allow in administrative access { //Check User Permissions if the user isn't an admin if (!Roles.IsUserInRole("Admin")) { if (PositionBLL.VerifyPositionAccess(currentApplication.AppliedPosition) == false) { //If the user does not have position access, redirect to the not authorized page Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.AUTH)); } } } else //Use committee rules { bool allowedAccess = false; bool reviewerAccess = false; CommitteeMemberBLL.CheckAccess(currentApplication.AppliedPosition, out allowedAccess, out reviewerAccess); if (!allowedAccess) { Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.AUTH)); } if (reviewerAccess) { gviewReferences.Columns[INT_REFERENCE_FILE_COLUMN].Visible = false; } } //Trace.Write("Valid user and application " + currentApplication.ID.ToString() + Environment.NewLine); }
private void DataBindExistingPosition() { //current position should not be null if (currentPosition == null) { Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.UNKNOWN)); } if (Roles.IsUserInRole("Admin") == false && PositionBLL.VerifyPositionAccess(currentPosition) == false) { Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.AUTH)); } //If we do, databind all of the fields on the form //Set the posted date to now txtDeadline.Text = currentPosition.Deadline.ToShortDateString(); txtPositionTitle.Text = currentPosition.PositionTitle; txtPositionNumber.Text = currentPosition.PositionNumber; txtHRRep.Text = currentPosition.HRRep; txtHRPhone.Text = currentPosition.HRPhone; txtHREmail.Text = currentPosition.HREmail; DepartmentList = new List <Department>(); foreach (Department d in currentPosition.Departments) { DepartmentList.Add(d); } gviewDepartments.DataSource = DepartmentList; gviewDepartments.DataBind(); if (currentPosition.Steps.Contains(ApplicationStepType.CurrentPosition)) { chkShowCurrentPosition.Checked = true; } if (currentPosition.Steps.Contains(ApplicationStepType.Education)) { chkShowEducation.Checked = true; } filePositionDescription.Visible = false; reqValPositionDescription.Visible = false; txtShortDescription.Text = currentPosition.ShortDescription; if (currentPosition.ReferenceTemplate != null) { txtReferenceTemplate.Text = currentPosition.ReferenceTemplate.TemplateText; } txtPublications.Text = currentPosition.NumPublications.ToString(); txtReferences.Text = currentPosition.NumReferences.ToString(); chkAllowApplications.Checked = currentPosition.AllowApps; chkAllowFaculty.Checked = currentPosition.FacultyView; chkPositionClosed.Checked = currentPosition.Closed; lbtnDownloadPositionDescription.Visible = true; litDownloadPositionDescription.Visible = true; ibtnReplacePositionDescription.Visible = true; if (currentPosition.SearchPlanFile != null) //legacy positions may have a null search plan { fileSearchPlan.Visible = false; reqValSearchPlan.Visible = false; lbtnDownloadSearchPlan.Visible = true; litDownloadSearchPlan.Visible = true; ibtnReplaceSearchPlan.Visible = true; } //Change the text of the position status literal and then submit button to represent an edit litPositionState.Text = "Edit Position"; btnModifyPosition.Text = "Update!"; }