protected void btnSpoof_Click(object sender, EventArgs e) { // Not sure we can update the view - let's see what this does // We should add an error panel to the root view? if (cbSpoofUsers.SelectedItem == null) { return; } eCAR3Entities pContext = new eCAR3Entities(); ListEditItem pItem = cbSpoofUsers.SelectedItem; int nId = (int)pItem.Value; CARUser pUser = pContext.CARUsers.Single(x => x.UserId == nId); if (Session [SessionVars.MkCurUserId] != null && nId == (int)Session [SessionVars.MkCurUserId]) { Session [SessionVars.MkSpoofId] = null; // Back to originally logged on user } else { Session [SessionVars.MkSpoofId] = nId; } Session [SessionVars.MkCurUserId] = nId; Session [SessionVars.MkCurUserName] = pUser.UserName; Session [SessionVars.MkCurUserBits] = pUser.RoleBits; // Redirect to default page - this might not be a valid page any more! Response.Redirect("~/Default.aspx"); }
protected void Page_Load(object sender, EventArgs e) { gUserId = Master.UserId; gUser = User; TabsEnabled = true; MpOptions = new ProviderOptions(); //Set the file name (for multiple file downloads) to Project Number initially fmAttachments.SettingsEditing.DownloadedArchiveName = Master.CAR.ProjectNumber.Replace("/", "-").Trim(); fmAttachments.CustomFileSystemProvider = new AttachmentFileProvider(fmAttachments.Settings.RootFolder, MpOptions, CARId); // First Time in Page if (!IsPostBack) { PreventSpoofing(); if (Assignment == null) { Assignment = FindAssignment(); } } // Every time in Page RestrictPermissions(); if (Assignment != null) { SetCreatorsPermissions(); SetVpopAnalPermissions(); SetAdminsPermissions(); SetOthersPermissions(); } SetBasicAdminsPermissions(); SetSupersPermissions(); AreRequiredFieldsDone(); }