private async void NextIconButton_OnClick(object sender, EventArgs e) { if (!String.IsNullOrEmpty(FullNameTextBox.Text) || !String.IsNullOrEmpty(EmailTextBox.Text) || !String.IsNullOrEmpty(AddressTextBox.Text) || !String.IsNullOrEmpty(PhoneNumberTextBox.Text)) { StaticData.CurrentUser.Name = FullNameTextBox.Text; StaticData.CurrentUser.Email = EmailTextBox.Text; StaticData.CurrentUser.Address = AddressTextBox.Text; StaticData.CurrentUser.PhoneNumber = PhoneNumberTextBox.Text; StaticMethod.ShowProgress(this, "Registering...", 0, true, true); string temp = await UserAPI.Register(StaticData.CurrentUser); StaticMethod.ShowProgress(this, "Registering...", 0, true, false); NavigationService.Navigate( new Uri("/PageGroups/LoginGroup/LoginPage.xaml?username="******"&password="******"Please fill in all box", "Warning", MessageBoxButton.OK); } }
// PUT: api/Users public IHttpActionResult Put([FromBody] UserAPI userApi) { if (!ModelState.IsValid) { return(BadRequest()); } try { User oldUser = _userRepository.GetById(userApi.Id); if (oldUser == null) { _userRepository.Insert(userApi.ToUserNoCollections()); } else { User updatedUser = userApi.ToUserNoCollections(); updatedUser.Collections = oldUser.Collections; updatedUser.Created = oldUser.Created; _userRepository.Update(updatedUser); } } catch (Exception ex) { // TODO: Log errors Logger logger = LogManager.GetLogger("file"); logger.Log(LogLevel.Info, ex.Message); return(InternalServerError(ex)); } return(Ok()); }
/// <summary> /// Creación de usuario estandar /// </summary> /// <param name="user"></param> /// <returns></returns> public async Task <UserAPI> CreateUser(UserAPI user) { if (!IsAdmin()) { return(null); } var internalUser = new UserApp { UserName = user.Username, Name = user.Name }; var result = await _userManager.CreateAsync(internalUser, user.Password); if (result.Succeeded) { var userAdd = await _userManager.FindByNameAsync(user.Username); if (userAdd != null) { await _userManager.AddToRoleAsync(userAdd, UserRol.RegularRol); } return(userAdd?.ToUserAPI()); } return(null); }
private bool DisplayEditScreen() { SiteAPI m_refSiteApi = new SiteAPI(); UserAPI m_refUserApi = new UserAPI(); try { AppImgPath = m_refSiteApi.AppImgPath; AppName = m_refSiteApi.AppName; SITEPATH = m_refSiteApi.SitePath; //jsContentLanguage.Text = Convert.ToString(settings_data.Language) td_asset_loc.InnerHtml = "<input type=\"text\" size=\"50\" maxlength=\"255\" name=\"asset_loc\" id=\"asset_loc\" value=\"" + "assets" + "\">"; td_private_asset_loc.InnerHtml = "<input type=\"text\" id=\"private_asset_loc\" name=\"private_asset_loc\" size=\"50\" maxlength=\"255\" value=\"" + "privateassets" + "\">"; td_DomainUserName.InnerHtml = "<input type=\"text\" id=\"DomainUserName\" name=\"DomainUserName\" size=\"50\" maxlength=\"255\" value=\"" + "user name" + "\">"; td_ConfirmPassword.InnerHtml = "<input type=\"password\" id=\"ConfirmPassword\" name=\"ConfirmPassword\" size=\"50\" maxlength=\"255\" value=\"" + "user1" + "\">"; td_Password.InnerHtml = "<input type=\"password\" id=\"Password\" name=\"Password\" size=\"50\" maxlength=\"255\" value=\"" + "user1" + "\">"; return false; } catch (Exception) { return false; } }
public static void LoadNewOrg(string sPath) { //Variables XmlDocument doc = new XmlDocument(); doc.Load(sPath); XmlNodeList xmlCustomer = doc.GetElementsByTagName("command"); //Deal Import Variables string sOrg = ""; string sUser = ""; if (xmlCustomer.Count <= 0) { Console.WriteLine("ERROR:"); Console.WriteLine("There are no Customers in the specified XML file."); Console.ReadLine(); } else { //Set the Deal Import Variables Console.WriteLine(xmlCustomer[0].SelectSingleNode("org_name").InnerText); sOrg = xmlCustomer[0].SelectSingleNode("org_name").InnerText; sUser = xmlCustomer[0].SelectSingleNode("rep").InnerText; //Load the Global Org Object g_Org.name = sOrg; g_User = new UserAPI(sUser); } }
public async Task <IActionResult> PutUserAPI(long id, UserAPI userAPI) { if (id != userAPI.Id) { return(BadRequest()); } _context.Entry(userAPI).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserAPIExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task Run(CancellationToken token, List <string> apiKeys) { foreach (var apiKey in apiKeys) { token.ThrowIfCancellationRequested(); var overallProgress = (int)Math.Round(((double)apiKeys.IndexOf(apiKey) / apiKeys.Count) * 100, 0); SetProgress("Retrieving unlocked dyes", 0, overallProgress); var currentDyes = await GetAccountDyes(apiKey); SetProgress("Retrieving unlocked dyes", 25, overallProgress); var savedDyes = await UserAPI.GetAccountDyes(apiKey); SetProgress("Saving new dyes", 50, overallProgress); var newDyes = currentDyes.Where(x => !savedDyes.Any(y => y.DyeID == x.ID)).ToList(); if (newDyes.Count > 0) { await UserAPI.AddDyes(newDyes, apiKey); } SetProgress("Calculating total dye value", 65, overallProgress); var values = await ValueFactory.CalculateValue(currentDyes); if (values.Count > 0) { SetProgress("Saving total dye value", 90, overallProgress); await UserAPI.AddCategoryEntry(CategoryType.Dyes, values.Where(x => x.Value != null).Sum(x => x.Value.Coins), apiKey); } } }
public static bool LoadNewDeal(string sPath, string sStatus) { //Variables XmlDocument doc = new XmlDocument(); doc.Load(sPath); XmlNodeList xmlJobs = doc.GetElementsByTagName("command"); //Deal Import Variables string sOrgName = ""; string sTitle = ""; string sValue = ""; string sRep = ""; string sPerson = ""; string sEmail = ""; DealStatus dsStatus = new DealStatus { Status = DealStatus.dealStatus.Open }; if (xmlJobs.Count <= 0) { Console.WriteLine("ERROR:"); Console.WriteLine("There are no Jobs in the specified XML file."); Console.ReadLine(); return(true); } else { //Set the Deal Import Variables sOrgName = xmlJobs[0].SelectSingleNode("org_name").InnerText; sTitle = xmlJobs[0].SelectSingleNode("title").InnerText; sValue = xmlJobs[0].SelectSingleNode("value").InnerText; sRep = xmlJobs[0].SelectSingleNode("rep").InnerText; sPerson = xmlJobs[0].SelectSingleNode("client_name").InnerText; sEmail = xmlJobs[0].SelectSingleNode("email").InnerText; //Load global Deal object with values from FileMaker import g_User = new UserAPI(sRep); g_Deal.stage_id = g_User.GetStage(); g_Deal.title = sTitle; g_Deal.value = sValue.Replace("$", ""); //g_Deal.org_id = GetOrgID(sOrgName); if (sEmail.Contains(";")) { sEmail = sEmail.Substring(0, sEmail.IndexOf(";")); } g_Deal.person_id = GetPersonID(sEmail); //Hard Coded values for the Deal g_Deal.add_time = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); g_Deal.status = dsStatus.StatusText; if (DealExists(sTitle)) { return(false); } else { return(true); } } }
private async Task <IEnumerable <Board> > GetBoardList(uint startIndex, int page) { IsLoading = true; BoardListViewModel.BoardList.NoMore(); List <Board> list = new List <Board>(); try { list = await UserAPI.GetFollowingBoardList(Context.User.urlname, page); if (list.Count == 0) { BoardListViewModel.BoardList.NoMore(); } else { BoardListViewModel.BoardList.HasMore(); } return(list); } catch (Exception ex) { } finally { IsLoading = false; } return(list); }
private async Task <bool> Create(AccountViewModel account) { if (!ModelState.IsValid) { return(false); } UserAPI user = new UserAPI(); user.Username = account.Username; user.Email = account.Email; HttpRequestMessage apiRequest = CreateRequestToService(HttpMethod.Post, "Users"); apiRequest.Content = new ObjectContent <UserAPI>(user, new JsonMediaTypeFormatter()); HttpResponseMessage apiResponse; try { apiResponse = await HttpClient.SendAsync(apiRequest); } catch { return(false); } if (!apiResponse.IsSuccessStatusCode) { return(false); } PassCookiesToClient(apiResponse); return(true); }
public async Task GetAllUserPhotos() { UserAPI userAPI = new UserAPI(); string profilePhoto = ""; UIImage Image; foreach (User user in recipients) { Tuple <HttpStatusCode, string> photoResponse = await userAPI.GetUserPhotoForMapObjects(user.id); if (photoResponse.Item1 != HttpStatusCode.OK) { Console.WriteLine("Failed to retrieve profile photo or no profile photo found."); Image = UIImage.FromFile("donationIcon.png"); } else { Console.WriteLine("Successfully retrieved user photo."); profilePhoto = photoResponse.Item2; var imageBytes = Convert.FromBase64String(profilePhoto); var imageData = NSData.FromArray(imageBytes); Image = UIImage.LoadFromData(imageData); } UserPhotos.Add(user.id, Image); } }
/// <summary> /// Start new session by retrieving new Secret Key and AuthToken from Monitis API. /// </summary> public ActionResult Start() { ActionResult actionResult = new ActionResult(); UserAPI userAPI = new UserAPI(APIKey, APIType); _secretKey = userAPI.GetSecretKey(); if (String.IsNullOrEmpty(_secretKey)) { actionResult.AddError("Can't get secretkey"); } else { CurrentAuthToken = userAPI.GetAuthToken(_secretKey); if (String.IsNullOrEmpty(CurrentAuthToken)) { actionResult.AddError("Can't get authToken"); } else { actionResult.IsSuccessful = true; } } return(actionResult); }
public async Task <ActionResult <UserAPI> > PostUserAPI(UserAPI userAPI) { _context.Users.Add(userAPI); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetUserAPI), new { id = userAPI.Id }, userAPI)); }
private void MyProfileBtn_Click(object sender, EventArgs e) { //GlobalAPI.GetCacheFileInfo("wangpengtest", CacheFileType.Image, 0, (info) => //{ //}); ObjectPropertyInfoForm form = new ObjectPropertyInfoForm(); form.Text = "我的信息"; form.TargetObject = _selfNameCard; form.UpdateObjectAction = (o) => { NIM.User.UserAPI.UpdateMyCard(o as UserNameCard, (a) => { if (a == ResponseCode.kNIMResSuccess) { UserAPI.GetUserNameCard(new List <string>() { SelfId }, (ret) => { if (ret.Any()) { _selfNameCard = ret[0]; DisplayMyProfile(_selfNameCard); } }); } }); }; form.Show(); }
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) { AddMsg("正在读取当前用户信息..."); UserAPI userAPI = new UserAPI(App.Account); userAPI.Info((returnResult) => { Result result = returnResult.Item1; Person person = returnResult.Item2; if (result.ErrCode == Result.SUCCESS) { App.Account.Person = person; this.Dispatcher.BeginInvoke(() => { txtName.Text = person.Name; txtNickName.Text = person.NickName; txtFansCount.Text = person.FansNum.ToString(); txtFavoursCount.Text = person.FavNum.ToString(); txtIdolsCount.Text = person.IdolNum.ToString(); txtLevel.Text = person.Level.ToString(); txtOpenId.Text = person.OpenId; }); AddMsg("读取当前用户信息完成"); } else { AddMsg("读取当前用户信息失败"); AddMsg(String.Format("ErrCode: {0}", result.Msg)); } }); }
async void save() { Photo uploadedPhoto = new Photo(photoBase64String); UserController.Instance.photoObject = uploadedPhoto; UserAPI userAPI = new UserAPI(); DeletePhotoCell.IsEnabled = true; NoPhotoLabel.IsVisible = false; HttpStatusCode photoUpdated = await userAPI.UpdateUserPhoto(); switch (photoUpdated) { case HttpStatusCode.OK: UserController.Instance.ProfilePhotoSource = imageView.Source; UserController.Instance.mainPageController.updateMenuPhoto(); await DisplayAlert("", "User photo successfully updated", "OK"); break; case HttpStatusCode.BadRequest: DeletePhotoCell.IsEnabled = false; NoPhotoLabel.IsVisible = true; await DisplayAlert("", "User photo update failed (400)", "OK"); break; case HttpStatusCode.ServiceUnavailable: DeletePhotoCell.IsEnabled = false; NoPhotoLabel.IsVisible = true; await DisplayAlert("", "Server unavailable, check connection", "OK"); break; case HttpStatusCode.Unauthorized: DeletePhotoCell.IsEnabled = false; NoPhotoLabel.IsVisible = true; await DisplayAlert("", "Unauthorised to modify photo", "OK"); break; case HttpStatusCode.InternalServerError: DeletePhotoCell.IsEnabled = false; NoPhotoLabel.IsVisible = true; await DisplayAlert("", "Server error, please try again (500)", "OK"); break; } }
private API() { userAPI = new UserAPI(); songAPI = new SongAPI(); channelAPI = new ChannelAPI(); openChannelAPI = new OpenChannelAPI(); moreInfoAPI = new MoreInfoAPI(); }
public IActionResult Index() { //var userName = "******"; //var response = UserAPI.GetListAdministrator($"http://{Request.Host}", userName); var response = UserAPI.GetListAdministrator($"http://{Request.Host}", GlobalLogin.UserName); return(View(response)); }
/// <summary> /// Executes the method on application startup to display the landing window /// </summary> /// <param name="e"></param> protected override void OnStartup(StartupEventArgs e) { var userAPI = new UserAPI(APIHelper.GetAPIHelper().Client); var mainViewModel = new MainWindowViewModel(userAPI); var mainWindow = new MainWindow(mainViewModel); mainWindow.Show(); }
public void SetToken(AuthToken token) { OAuthorAPI.setToken(token); UserAPI.setToken(token); CategoryAPI.setToken(token); PinAPI.setToken(token); BoardAPI.setToken(token); }
public void Init(string id, string secret, string callback, string md) { OAuthorAPI.setup(id, secret, callback, md); UserAPI.setup(id, secret, callback, md); CategoryAPI.setup(id, secret, callback, md); PinAPI.setup(id, secret, callback, md); BoardAPI.setup(id, secret, callback, md); }
public UserService(UserAPI userAPI, IOptions <AppSettings> appSettings) { this.userAPI = userAPI; if (appSettings != null) { this.appSettings = appSettings.Value; } }
private API() { OAuthorAPI = new OAuthorAPI(""); UserAPI = new UserAPI(""); CategoryAPI = new CategoryAPI(""); PinAPI = new PinAPI(""); BoardAPI = new BoardAPI(""); }
static void Main(string[] args) { UserAPI user = new UserAPI("123456", "admin", "http://127.0.0.1:8888/api/v1/"); long id = user.addNewAsync("123", "123", "123").Result; Console.WriteLine(id); Console.ReadKey(); }
public async Task <ActionResult> EditUser(AccountEdit user) { UserAPI apiUser = new UserAPI(); apiUser.Username = user.newUsername ?? user.Username; apiUser.Email = user.newEmail; apiUser.Created = user.Created; apiUser.Modified = user.Modified; apiUser.Id = user.Id; // Edit User HttpRequestMessage apiRequest = CreateRequestToService(HttpMethod.Put, "Users"); apiRequest.Content = new ObjectContent <UserAPI>(apiUser, new JsonMediaTypeFormatter()); HttpResponseMessage apiResponse; try { apiResponse = await HttpClient.SendAsync(apiRequest); } catch { return(RedirectToAction("UserDetails")); } if (!apiResponse.IsSuccessStatusCode) { return(RedirectToAction("UserDetails")); } PassCookiesToClient(apiResponse); // Edit Identity User apiRequest = CreateRequestToService(HttpMethod.Put, "Accounts/Edit"); apiRequest.Content = new ObjectContent <AccountEdit>(user, new JsonMediaTypeFormatter()); try { apiResponse = await HttpClient.SendAsync(apiRequest); } catch { // TODO: Rollback User edit return(RedirectToAction("UserDetails")); } if (!apiResponse.IsSuccessStatusCode) { return(RedirectToAction("UserDetails")); } PassCookiesToClient(apiResponse); return(RedirectToAction("UserDetails")); }
public void GetDown() { UserAPI.GetUser((UserAPI.UserData userData) => { if (userData != null) { showText.text = JsonUtility.ToJson(userData); } }); }
public async Task <User> Login(string username, string password) { var token = await UserAPI.GetToken(username, password); var user = await UserAPI.LoadUser(token); SecurityContext.Login(token, user); return(user); }
private void EditInfoDialog_Load(object sender, EventArgs e) { UserAPI.UserDescription description = UserAPI.GetUserDescription(Program.users, Program.userinfo.userid); UserName.Text = description.username; oldUserName = description.username; oldPass = description.passwd; UserContact.Text = description.contact; (Controls["radioSex" + description.sex] as RadioButton).Checked = true; }
// GET: Accounts/Register public async Task <ActionResult> Register() { UserAPI user = await WhoAmI(); if (user != null) { TempData["Message"] = "Do you really want another account?"; } return(View()); }
public IHttpActionResult Post([FromBody] UserAPI userApi) { if (!ModelState.IsValid) { return(BadRequest()); } _userRepository.Insert(userApi.ToUserNoCollections()); return(Ok()); }
public static async Task ClassInitialize(TestContext tc) { UserController.Instance.isTestMode = true; ClinicianController.Instance.isTestMode = true; ServerConfig.Instance.serverAddress = "http://csse-s302g3.canterbury.ac.nz:80/testing/api/v1"; loginAPI = new LoginAPI(); userAPI = new UserAPI(); await UnitTestUtils.resetResample(); }
private void Page_Load(System.Object sender, System.EventArgs e) { Response.CacheControl = "no-cache"; Response.AddHeader("Pragma", "no-cache"); Response.Expires = -1; //Put user code to initialize the page here Ektron.Cms.Common.EkMessageHelper m_refMsg; UserAPI m_refUserApi = new UserAPI(); m_refMsg = m_refApi.EkMsgRef; string strUserName = Server.UrlDecode(m_refApi.GetCookieValue("Username")); if (Convert.ToBoolean(m_refApi.RequestInformationRef.IsMembershipUser) || m_refApi.RequestInformationRef.UserId == 0) { Response.Write("Please login as a cms user."); ek_nav_bottom.Attributes["src"] = "blank.htm"; ek_main.Attributes["src"] = "blank.htm"; } else { Page.Title = m_refApi.AppName + " " + m_refMsg.GetMessage("workarea page html title") + " " + HttpUtility.UrlDecode(Ektron.Cms.CommonApi.GetEcmCookie()["username"]); ek_nav_bottom.Attributes["src"] = ek_nav_bottom.Attributes["src"] + "?" + Request.ServerVariables["query_string"]; if (!(Request.QueryString["page"] == null)) { if (Request.QueryString["page"] != "") { litMainPage.Text = Request.QueryString["page"] + "?" + Request.ServerVariables["query_string"]; ek_main.Attributes["src"] = litMainPage.Text; } } else { if (strUserName == "builtin") { ek_main.Attributes["src"] = "blank.htm"; } else { Ektron.Cms.UserPreferenceData preference_data = m_refUserApi.GetUserPreferenceById(0); if (Convert.ToString(preference_data.FolderId) == "" && Ektron.Cms.DataIO.LicenseManager.LicenseManager.IsFeatureEnable(m_refApi.RequestInformationRef, Ektron.Cms.DataIO.LicenseManager.Feature.SocialNetworking, false)) { ek_main.Attributes["src"] = "dashboard.aspx" + "?" + Request.ServerVariables["query_string"]; } else { litMainPage.Text = "content.aspx?action=ViewContentByCategory&id=0" + "&" + Request.ServerVariables["query_string"]; ek_main.Attributes["src"] = litMainPage.Text; } } } } litWorkareaPrefix.Text = m_refApi.ApplicationPath; }
public Community_PersonalTags() { m_refStyle = new StyleHelper(); m_mode = ""; m_userId = 0; m_id = 0; m_refUserApi = new UserAPI(); m_refCommonAPI = new CommonApi(); m_refContentApi = new ContentAPI(); m_refMsg = RefCommonAPI.EkMsgRef; Utilities.SetLanguage(m_refCommonAPI); }
public CouponBase() { _UserApi = new UserAPI(); _CouponApi = new CouponApi(); _ContentApi = new ContentAPI(); _SiteApi = new SiteAPI(); _CurrencyApi = new CurrencyApi(); m_refMsg = m_refContentApi.EkMsgRef; this.IsAdmin = _ContentApi.IsAdmin(); this.IsCommerceAdmin = _UserApi.EkUserRef.IsARoleMember_CommerceAdmin(); this.SitePath = _ContentApi.SitePath.TrimEnd(new char[] { '/' }); this.ApplicationPath = _SiteApi.ApplicationPath.TrimEnd(new char[] { '/' }); }
private void Page_Load(System.Object sender, System.EventArgs e) { SiteAPI m_refSiteApi = new SiteAPI(); UserAPI m_refUserApi = new UserAPI(); m_refMsg = m_refSiteApi.EkMsgRef; AppImgPath = m_refSiteApi.AppImgPath; AppName = m_refSiteApi.AppName; SITEPATH = m_refSiteApi.SitePath; //call api and display values td_asset_loc.InnerHtml = "assets"; td_private_asset_loc.InnerHtml = "private"; td_domain_username.InnerHtml = "user1"; }
public CouponUserControlBase() { _UserApi = new UserAPI(); _CouponApi = new CouponApi(); _ContentApi = new ContentAPI(); _SiteApi = new SiteAPI(); _CurrencyApi = new CurrencyApi(); this.SitePath = _ContentApi.SitePath.TrimEnd(new char[] { '/' }); this.ApplicationPath = _SiteApi.ApplicationPath.TrimEnd(new char[] { '/' }); this.IsAdmin = _ContentApi.IsAdmin(); this.IsCommerceAdmin = _UserApi.EkUserRef.IsARoleMember_CommerceAdmin(); //check permissions - both admin and commerce admin can edit this.IsEditable = (this.IsCommerceAdmin == true || this.IsAdmin == true) ? true : false; }
public string GetGroupTags() { string returnValue; System.Text.StringBuilder result = new System.Text.StringBuilder(); TagData[] tdaGroup; Hashtable htTagsAssignedToUser; UserAPI m_refUserApi = new UserAPI(); try { htTagsAssignedToUser = new Hashtable(); result.Append("<fieldset>"); result.Append("<legend>" + m_refMsg.GetMessage("lbl group tags") + "</legend>"); result.Append("<div style=\"overflow: auto; height: 80px;\">"); if (this.m_iID > 0) { tdaGroup = m_refTagsApi.GetTagsForObject(this.m_iID, Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.CommunityGroup, -1); if (tdaGroup.Length > 0) { LocalizationAPI localizationApi = new LocalizationAPI(); for (int i = 0; i <= (tdaGroup.Length - 1); i++) { result.Append("<input disabled=\"disabled\" checked=\"checked\" type=\"checkbox\"> <img src=\'" + localizationApi.GetFlagUrlByLanguageID(tdaGroup[i].LanguageId) + "\' border=\"0\" /> " + tdaGroup[i].Text + "<br>"); } } } result.Append("</div>"); result.Append("</fieldset>"); } catch (Exception) { } finally { returnValue = result.ToString(); tdaGroup = null; htTagsAssignedToUser = null; } return returnValue; }
public void Display_View() { UserAPI m_refUserAPI = new UserAPI(); UserData uUser = new UserData(); uUser = m_refUserAPI.GetUserById(this.m_refContentApi.UserId, false, false); this.ltr_journal.Text = GetMessage("lbl journal desc"); this.txtBlogName.Text = string.Format(GetMessage("lbl users journal"), uUser.DisplayName); this.txtTitle.Text = GetMessage("lbl journal for user"); this.btn_Create.Attributes.Add("onclick", "javascript:VerifyBlog(); return false;"); this.btn_Create.Visible = false; this.txtBlogName.Visible = false; this.ltr_blogname.Visible = false; this.ltr_blogtitle.Visible = false; this.txtTitle.Visible = false; this.ltr_comments.Visible = false; this.chkEnable.Visible = false; this.chkModerate.Visible = false; this.chkRequire.Visible = false; this.drpVisibility.Visible = false; this.ltr_visibility.Visible = false; }
private void Process_DeSynchUsers() { AdDeSyncUserData[] result; m_refUserApi = new UserAPI(); try { result = m_refUserApi.DeSynchUsers(true); //Response.Redirect("adreports.aspx?action=ViewAllReportTypes", False) Response.Redirect("users.aspx?backaction=viewallusers&action=viewallusers&grouptype=0&groupid=2&id=2&FromUsers=1", false); } catch (Exception ex) { Utilities.ShowError(ex.Message); } }
private void Process_SynchCMSRelationShipsToAD() { Collection cUserIDs = new Collection(); Collection cGroupIDs = new Collection(); Collection cActions = new Collection(); int count; long userid = 0; int groupid = 0; string addelete = string.Empty; for (count = 1; count <= System.Convert.ToInt32(Request.Form["usercount"]); count++) { if (Request.Form["userid" + count.ToString()] != null) userid = System.Convert.ToInt64(Request.Form["userid" + count.ToString()]); if (Request.Form["groupid" + count.ToString()] != null) groupid = int.Parse(Request.Form["groupid" + count.ToString()].ToString()); if(Request.Form["delete" + count.ToString()] != null) addelete = Request.Form["delete" + count.ToString()].ToString(); if (addelete != "") { cUserIDs.Add(userid, count.ToString(), null, null); cGroupIDs.Add(groupid, count.ToString(), null, null); cActions.Add("delete", count.ToString(), null, null); } } m_refUserApi = new UserAPI(); m_refUserApi.SynchCMSRelationshipsToAD(cUserIDs, cGroupIDs, cActions); Response.Redirect("adreports.aspx?action=GetRelationshipsForSynch", false); }
private void Process_SynchCMSUsersToAD() { Collection cUserIDs = new Collection(); Collection cADUsernames = new Collection(); Collection cADDomains = new Collection(); Collection cActions = new Collection(); int count; for (count = 1; count <= System.Convert.ToInt32(Request.Form["usercount"]); count++) { long userid = 0; string adusername = string.Empty; string addomain = string.Empty; string addelete = string.Empty; if (Request.Form["userid" + count.ToString()] != null) userid = System.Convert.ToInt64(Request.Form["userid" + count.ToString()]); if (Request.Form["username" + count.ToString()] != null) adusername = Request.Form["username" + count.ToString()].ToString(); if (Request.Form["domain" + count.ToString()] != null) addomain = Request.Form["domain" + count.ToString()].ToString(); if (Request.Form["delete" + count.ToString()] != null) addelete = Request.Form["delete" + count.ToString()].ToString(); if (addelete != "") { cUserIDs.Add(userid, count.ToString(), null, null); cADUsernames.Add("", count.ToString(), null, null); cADDomains.Add("", count.ToString(), null, null); cActions.Add("delete", count.ToString(), null, null); } else if ((adusername != "") && (addomain != "")) { cUserIDs.Add(userid, count.ToString(), null, null); cADUsernames.Add(adusername, count.ToString(), null, null); cADDomains.Add(addomain, count.ToString(), null, null); cActions.Add("map", count.ToString(), null, null); } } m_refUserApi = new UserAPI(); m_refUserApi.SynchCMSUsersToAD(cUserIDs, cADUsernames, cADDomains, cActions, 0); Response.Redirect("adreports.aspx?action=GetUsersForSynch", false); }
protected void LoadToolBar() { UserAPI m_refUserApi = new UserAPI(); string AppImgPath = m_refUserApi.AppImgPath; ContentAPI refContentAPI = new ContentAPI(); string AppPath = refContentAPI.AppPath; System.Text.StringBuilder result = new System.Text.StringBuilder(); try { divTitleBar.InnerHtml = m_refStyle.GetTitleBar(GetMessage("lbl messages")); result.Append("<table><tr>"); // Back button result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/back.png", (string)("CommunityMessaging.aspx?action=" + (SentMode ? "viewallsent" : "viewall")), GetMessage("btn back"), GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true)); if (m_sentMode == false) { result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/emailAdd.png", "CommunityMessaging.aspx?action=editmsg", GetMessage("lbl compose a message"), GetMessage("lbl compose a message"), "", StyleHelper.AddEmailButtonCssClass, true)); result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/emailDelete.png", (string) ("CommunityMessaging.aspx?action=" + (SentMode ? "viewsentmsg" : "viewmsg") + "&mode=del&id=" + m_id), GetMessage("btn delete"), GetMessage("btn delete"), "", StyleHelper.DeleteEmailButtonCssClass)); if (m_bCanReply) { result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/emailReply.png", (string) ("CommunityMessaging.aspx?action=editmsg&id=" + m_id), GetMessage("lbl reply message"), GetMessage("lbl reply message"), "", StyleHelper.ReplyToEmailButtonCssClass)); } } else { result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/emailDelete.png", (string) ("CommunityMessaging.aspx?action=" + (SentMode ? "viewsentmsg" : "viewmsg") + "&mode=del&id=" + m_id), GetMessage("btn delete"), GetMessage("btn delete"), "", StyleHelper.DeleteEmailButtonCssClass, true)); } result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/emailForward.png", (string) ("CommunityMessaging.aspx?action=editmsg&mode=fwd&id=" + m_id + "&userid=" + m_msgUserId), GetMessage("lbl forward message"), GetMessage("lbl forward message"), "", StyleHelper.ForwardEmailButtonCssClass)); long previousMsgID = 0; long nextMsgID = 0; refContentAPI.GetAjacentPrivateMessagesForCurrentUser(Convert.ToInt64(m_id), System.Convert.ToBoolean(!(SentMode)), ref previousMsgID, ref nextMsgID); if (previousMsgID > 0) { result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/arrowLeft.png", (string) ("CommunityMessaging.aspx?action=" + (SentMode ? "viewsentmsg" : "viewmsg") + "&id=" + previousMsgID.ToString() + "&userid=" + m_msgUserId.ToString()), GetMessage("lbl previous message"), GetMessage("lbl previous message"), "", StyleHelper.PreviousButtonCssClass)); } else { result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/arrowLeftOff.png", "#", GetMessage("lbl previous message"), GetMessage("lbl previous message"), "", StyleHelper.PreviousDisabledButtonCssClass)); } if (nextMsgID > 0) { result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/arrowRight.png", (string) ("CommunityMessaging.aspx?action=" + (SentMode ? "viewsentmsg" : "viewmsg") + "&id=" + nextMsgID.ToString() + "&userid=" + m_msgUserId.ToString()), GetMessage("lbl next message"), GetMessage("lbl next message"), "", StyleHelper.NextButtonCssClass)); } else { result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/arrowRightOff.png", "#", GetMessage("lbl next message"), GetMessage("lbl next message"), "", StyleHelper.NextDisabledButtonCssClass)); } //CommunityMessaging.aspx?action=" + IIf(SentMode, "viewsentmsg", "viewmsg") + "&id=" + aMessages(idx).ID.ToString() result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/print.png", "javascript:window.print();", GetMessage("lbl print message"), GetMessage("lbl print message"), "", StyleHelper.PrintButtonCssClass)); result.Append(StyleHelper.ActionBarDivider); result.Append("<td>"); if (SentMode) { result.Append(m_refStyle.GetHelpButton("view_sent_msg", "")); } else { result.Append(m_refStyle.GetHelpButton("view_msg", "")); } result.Append("</td>"); result.Append("</tr></table>"); divToolBar.InnerHtml = result.ToString(); result = null; } catch (Exception ex) { Utilities.ShowError(ex.Message); } finally { refContentAPI = null; } }
protected override void Page_Load(System.Object sender, System.EventArgs e) { //Put user code to initialize the page here if (! (Request.QueryString["grouptype"] == null) && Request.QueryString["grouptype"] != "") { m_intGroupType = Convert.ToInt32(Request.QueryString["grouptype"]); } if (! (Request.QueryString["groupid"] == null) && Request.QueryString["groupid"] != "") { m_intGroupId = Convert.ToInt64(Request.QueryString["groupid"]); } Hashtable hts = new Hashtable(); string connection = ""; UserAPI m_refUserApi = new UserAPI(); Ektron.Cms.User.EkUser m_refUser; string tmpPath = ""; string path = ""; string strUser = ""; string[] arrUser; SettingsData setting_data; SiteAPI m_refSiteApi = new SiteAPI(); StringBuilder sbTemp = new StringBuilder(); StringBuilder sbBrowseJS = new StringBuilder(); try { if (Request.QueryString["method"] != "") { sMethod = Request.QueryString["method"]; if (Page.IsPostBack == true && Request.Form["cn_path"] != "" && Request.Form["cn_name"] != "") { AddLDAPUsersToSystem(); Response.Redirect("../users.aspx?action=viewallusers&grouptype=" + m_intGroupType.ToString() + "&groupid=" + m_intGroupId.ToString() + "&id=" + m_intGroupId.ToString() + "&OrderBy=user_name", false); return; } } m_refMsg = m_refUserApi.EkMsgRef; setting_data = m_refSiteApi.GetSiteVariables(-1); StyleSheetJS.Text = m_refStyle.GetClientScript(); if (Request.QueryString["path"] != null) { path = (string) (Request.QueryString["path"].ToString().Replace("~", "=")); } m_refUser = m_refUserApi.EkUserRef; if (setting_data.LDAPSettings.ServerType == Ektron.Cms.Common.EkEnumeration.LDAPServerType.ActiveDirectory || setting_data.LDAPSettings.ServerType == Ektron.Cms.Common.EkEnumeration.LDAPServerType.Novell) { hts = m_refUser.BrowseLDAPTree(path, ref connection, m_refUserApi.RequestInformationRef.ADUsername, m_refUserApi.RequestInformationRef.ADPassword); } else { hts = m_refUser.BrowseLDAPTree(path, ref connection, "", ""); } if (path.EndsWith(",")) { tmpPath = path.Remove(System.Convert.ToInt32(path.Length - 1), 1); } ltrorgdomain.Text = connection; ltrpath.Text = tmpPath; sbTemp.Append("<script language=\"javascript\">" + Environment.NewLine); sbTemp.Append(" var connection = \'" + connection + "\';" + Environment.NewLine); sbTemp.Append(" var path = \'" + tmpPath + "\';" + Environment.NewLine); sbTemp.Append("</script>" + Environment.NewLine); sbBrowseJS.Append(" <script language=\"javascript\">" + Environment.NewLine); sbBrowseJS.Append(" function toggleVisibility(me){").Append(Environment.NewLine); sbBrowseJS.Append(" if (me.style.visibility==\"hidden\"){").Append(Environment.NewLine); sbBrowseJS.Append(" me.style.visibility=\"visible\";").Append(Environment.NewLine); sbBrowseJS.Append(" }").Append(Environment.NewLine); sbBrowseJS.Append(" else {").Append(Environment.NewLine); sbBrowseJS.Append(" me.style.visibility=\"hidden\";").Append(Environment.NewLine); sbBrowseJS.Append(" }").Append(Environment.NewLine); sbBrowseJS.Append(" }").Append(Environment.NewLine); sbBrowseJS.Append(" function SelectUser(cn) {" + Environment.NewLine); sbBrowseJS.Append(" var rExp;" + Environment.NewLine); sbBrowseJS.Append(" var path2;" + Environment.NewLine); sbBrowseJS.Append(" rExp = /ou=/gi;" + Environment.NewLine); sbBrowseJS.Append(" if (path.length == 0){path2 = path;} else {path2 = path + \',\';}" + Environment.NewLine); if (sMethod == "select") { // sbBrowseJS.Append(" alert(path2 + connection);" & Environment.NewLine) sbBrowseJS.Append(" toggleVisibility(document.getElementById(\'dvHoldMessage\'));" + Environment.NewLine); sbBrowseJS.Append(" document.getElementById(\'cn_name\').value = cn;" + Environment.NewLine); sbBrowseJS.Append(" document.getElementById(\'cn_path\').value = path2 + connection;" + Environment.NewLine); sbBrowseJS.Append(" document.forms[0].submit();" + Environment.NewLine); } else { if (Request.QueryString["from"] == "users") { sbBrowseJS.Append(" window.opener.document.forms[0]." + (Request.QueryString["uniqueid"]) + "LDAP_username.value = cn;" + Environment.NewLine); if (setting_data.LDAPSettings.ServerType == Ektron.Cms.Common.EkEnumeration.LDAPServerType.ActiveDirectory) { sbBrowseJS.Append(" var rExp_cn;" + Environment.NewLine); sbBrowseJS.Append(" rExp_cn = /cn=/gi;" + Environment.NewLine); } sbBrowseJS.Append(" window.opener.document.forms[0]." + (Request.QueryString["uniqueid"]) + "LDAP_ldapdomain.value = path2 + connection;" + Environment.NewLine); } else if (Request.QueryString["from"] == "members") { sbBrowseJS.Append(" window.opener.userinfo.username.value = cn;" + Environment.NewLine); sbBrowseJS.Append(" window.opener.userinfo.domain.value = path2 + connection;" + Environment.NewLine); } else if (Request.QueryString["from"] == "setup") { sbBrowseJS.Append(" window.opener.userinfo.username.value = cn;" + Environment.NewLine); sbBrowseJS.Append(" window.opener.userinfo.domain.value = path2 + connection;" + Environment.NewLine); } sbBrowseJS.Append(" self.close();" + Environment.NewLine); } sbBrowseJS.Append(" }" + Environment.NewLine); sbBrowseJS.Append(" </script>" + Environment.NewLine); if (path.Length > 0) { path = path.Replace("=", "~"); sbTemp.Append("<br/><a href=\"#\" onClick=\"history.back(1);\">Up</a><br/>"); } else { sbTemp.Append("<br/> <br/>"); } IDictionaryEnumerator Enumerator; Enumerator = hts.GetEnumerator(); while (Enumerator.MoveNext()) { //Response.Write(Enumerator.Key.ToString() & "<br/>") if (setting_data.LDAPSettings.ServerType == Ektron.Cms.Common.EkEnumeration.LDAPServerType.ActiveDirectory) { string[] aRay; string cnstring = ""; string userstring = ""; string tString = Enumerator.Key.ToString(); aRay = tString.Split(new string[] {"||"}, StringSplitOptions.None); userstring = aRay[0]; cnstring = aRay[1]; if (!string.IsNullOrEmpty(userstring) && (cnstring.ToLower().IndexOf("cn=") == 0) || (cnstring.ToLower().IndexOf("uid=") > -1)) { strUser = userstring.Replace("\'", "\\\'"); sbTemp.Append("<br><a href=\"#\" onclick=\"SelectUser(\'" + strUser + "\');\">"); sbTemp.Append("<img src=\"" + AppImgPath + "../UI/Icons/user.png\" /></a>"); sbTemp.Append(" " + cnstring); //+ "<b>(" + Enumerator.Value.ToString() + ")</b>") } else if ((cnstring.ToLower().IndexOf("ou=") == 0) || (cnstring.ToLower().IndexOf("cn=") == 0)) { sbTemp.Append("<br><a href=\"browse.aspx?grouptype=" + m_intGroupType + "&groupid=" + m_intGroupId.ToString() + "&method=" + sMethod + ("&from=" + Request.QueryString["from"] + "&uniqueid=" + Request.QueryString["uniqueid"] + "&path=" + cnstring.Replace("=", "~") + "," + path + "\">")); sbTemp.Append("<img src=\"" + AppImgPath + "ico_menu-closed.gif\" border=0/></a> "); sbTemp.Append(" " + cnstring.ToString()); //+ "<b>(" + Enumerator.Value.ToString() + ")</b>") } } else { if (Enumerator.Value.ToString().ToLower().IndexOf("nsmanageddomain") > -1 || Enumerator.Value.ToString().ToLower().IndexOf("person") > -1 || Enumerator.Value.ToString().ToLower().IndexOf("organizational") > -1 || Enumerator.Value.ToString().ToLower().IndexOf("organization") > -1) { if ((Enumerator.Key.ToString().ToLower().IndexOf("cn=") == 0) || (Enumerator.Key.ToString().ToLower().IndexOf("uid=") > -1)) { arrUser = (Enumerator.Key.ToString()).Split('='); strUser = arrUser[1]; strUser = strUser.Replace("\'", "\\\'"); sbTemp.Append("<br><a href=\"#\" onclick=\"SelectUser(\'" + strUser + "\');\">"); sbTemp.Append("<img src=\"" + AppImgPath + "../UI/Icons/user.png\" /></a>"); sbTemp.Append(" " + Enumerator.Key.ToString()); //+ "<b>(" + Enumerator.Value.ToString() + ")</b>") } else if ((Enumerator.Key.ToString().ToLower().IndexOf("ou=") == 0) || (Enumerator.Key.ToString().ToLower().IndexOf("o=") == 0) || (Enumerator.Key.ToString().ToLower().IndexOf("dc=") == 0)) { sbTemp.Append("<br><a href=\"browse.aspx?grouptype=" + m_intGroupType + "&groupid=" + m_intGroupId.ToString() + "&method=" + sMethod + ("&from=" + Request.QueryString["from"] + "&uniqueid=" + Request.QueryString["uniqueid"] + "&path=" + Enumerator.Key.ToString().Replace("=", "~") + "," + path + "\">")); sbTemp.Append("<img src=\"" + AppImgPath + "ico_menu-closed.gif\" border=0/></a> "); sbTemp.Append(" " + Enumerator.Key.ToString()); //+ "<b>(" + Enumerator.Value.ToString() + ")</b>") } } } } ltrMain.Text = sbTemp.ToString(); ltrBrowseJS.Text = sbBrowseJS.ToString(); BrowseLDAPToolBar(); } catch (Exception ex) { if (ex.Message.IndexOf("operational") > -1 || ex.Message.ToLower().IndexOf("no such object") > -1) { Utilities.ShowError(m_refMsg.GetMessage("ldap setup err")); //"Unable to connect to your LDAP Server. Please verify your setup configuration.") } else { Utilities.ShowError(ex.Message); } } }
public string MakeUserTaskEmailLink2(Ektron.Cms.Content.EkTask taskObj, bool blnShowFullName) { string returnValue; UserAPI objUserAPI = new UserAPI(); UserData objUserData = new UserData(); string strUserFullName; objUserData = objUserAPI.GetActiveUserById(taskObj.AssignedToUserID, false); strUserFullName = objUserData.FirstName + " " + objUserData.LastName; if (blnShowFullName == false) { if (IsLoggedInUsersEmailValid()) { returnValue = "<a href=\"#\"" + "onclick=\"LoadEmailChildPage(\'userid=" + taskObj.AssignedToUserID + MakeNotes_Email("Task", taskObj.TaskTitle) + "\')\"" + " title=\'" + gtMessEmail.GetMessage("alt send email to") + " \"" + strUserFullName.Replace("\'", "`") + "\"" + "\'>" + taskObj.AssignedToUser + " " + MakeEmailGraphic() + "</a>"; } else { returnValue = taskObj.AssignedToUser; } } else { if (IsLoggedInUsersEmailValid()) { returnValue = "<a href=\"#\"" + "onclick=\"LoadEmailChildPage(\'userid=" + taskObj.AssignedToUserID + MakeNotes_Email("Task", taskObj.TaskTitle) + "\')\"" + " title=\'" + gtMessEmail.GetMessage("alt send email to") + " \"" + strUserFullName.Replace("\'", "`") + "\"" + "\'>" + strUserFullName + " (" + taskObj.AssignedToUser + ")" + " " + MakeEmailGraphic() + "</a>"; } else { returnValue = strUserFullName + " (" + taskObj.AssignedToUser + ")"; } } return returnValue; }
private void Display_EditPermissions() { long nFolderId; if (_ItemType == "folder") { _FolderData = _ContentApi.GetFolderById(_Id); nFolderId = _Id; if (_FolderData.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionBoard) || _FolderData.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionForum)) { _IsBoard = true; } else if (_FolderData.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.Blog)) { _IsBlog = true; } } else { _ContentData = _ContentApi.GetContentById(_Id, 0); _FolderData = _ContentApi.GetFolderById(_ContentData.FolderId); nFolderId = _ContentData.FolderId; } EditPermissionsToolBar(); _PageData = new Collection(); UserPermissionData[] userpermission_data; UserGroupData usergroup_data; UserData user_data; UserAPI m_refUserAPI = new UserAPI(); if (Request.QueryString["base"] == "group") { userpermission_data = _ContentApi.GetUserPermissions(_Id, _ItemType, 0, Request.QueryString["PermID"], ContentAPI.PermissionUserType.All, ContentAPI.PermissionRequestType.All); //cTmp = ContObj.GetOrderedItemPermissionsv2_0(cTmp, retString) usergroup_data = m_refUserAPI.GetUserGroupByIdForFolderAdmin(nFolderId, Convert.ToInt64(Request.QueryString["PermID"])); _IsMembership = usergroup_data.IsMemberShipGroup; } else { userpermission_data = _ContentApi.GetUserPermissions(_Id, _ItemType, Convert.ToInt64(Request.QueryString["PermID"]), "", ContentAPI.PermissionUserType.All, ContentAPI.PermissionRequestType.All); user_data = m_refUserAPI.GetUserByIDForFolderAdmin(nFolderId, Convert.ToInt64(Request.QueryString["PermID"]), false, false); _IsMembership = user_data.IsMemberShip; } frm_itemid.Value = _Id.ToString(); frm_type.Value = Request.QueryString["type"]; frm_base.Value = _Base; frm_permid.Value = Request.QueryString["PermID"]; frm_membership.Value = Request.QueryString["membership"]; if (_IsMembership) { td_ep_membership.Visible = false; hmembershiptype.Value = "1"; } else { td_ep_membership.InnerHtml = _StyleHelper.GetEnableAllPrompt(); hmembershiptype.Value = "0"; } Populate_EditPermissionsGenericGrid(userpermission_data); Populate_EditPermissionsAdvancedGrid(userpermission_data); }
private void Display_AddPermissions() { UserGroupData usergroup_data; System.Collections.Generic.List<UserGroupData> userGroupDataList = new System.Collections.Generic.List<UserGroupData>(); UserData user_data; System.Collections.Generic.List<UserData> userDataList = new System.Collections.Generic.List<UserData>(); UserAPI m_refUserAPI = new UserAPI(); long nFolderId; frm_itemid.Value = _Id.ToString(); frm_type.Value = Request.QueryString["type"]; frm_base.Value = Request.QueryString["base"]; frm_permid.Value = Request.QueryString["PermID"]; frm_membership.Value = Request.QueryString["membership"]; if (_ItemType == "folder") { _FolderData = _ContentApi.GetFolderById(_Id); nFolderId = _Id; if (_FolderData.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionBoard) || _FolderData.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionForum)) { _IsBoard = true; } else if (_FolderData.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.Blog)) { _IsBlog = true; } } else { _ContentData = _ContentApi.GetContentById(_Id, 0); _FolderData = _ContentApi.GetFolderById(_ContentData.FolderId); nFolderId = _ContentData.FolderId; } AddPermissionsToolBar(); if (Request.QueryString["base"] == "group") { usergroup_data = m_refUserAPI.GetUserGroupByIdForFolderAdmin(nFolderId, Convert.ToInt64(Request.QueryString["PermID"])); Populate_AddPermissionsGenericGrid(usergroup_data); Populate_AddPermissionsAdvancedGrid(usergroup_data); _IsMembership = usergroup_data.IsMemberShipGroup; } else if (Request.QueryString["base"] == "user") { user_data = m_refUserAPI.GetUserByIDForFolderAdmin(nFolderId, Convert.ToInt64(Request.QueryString["PermID"]), false, false); Populate_AddPermissionsGenericGrid(user_data); Populate_AddPermissionsAdvancedGrid(user_data); _IsMembership = user_data.IsMemberShip; } else { string[] Groups = Request.QueryString["groupIDS"].Split(",".ToCharArray()); string[] Users = Request.QueryString["userIDS"].Split(",".ToCharArray()); int groupCount = 0; int userCount = 0; if (Request.QueryString["groupIDS"] != "") { for (groupCount = 0; groupCount <= Groups.Length - 1; groupCount++) { userGroupDataList.Add(m_refUserAPI.GetUserGroupByIdForFolderAdmin(nFolderId, Convert.ToInt64(Groups[groupCount]))); } _IsMembership = userGroupDataList[0].IsMemberShipGroup; } if (Request.QueryString["userIDS"] != "") { for (userCount = 0; userCount <= Users.Length - 1; userCount++) { userDataList.Add(m_refUserAPI.GetUserByIDForFolderAdmin(nFolderId, Convert.ToInt64(Users[userCount]), false, false)); } _IsMembership = userDataList[0].IsMemberShip; } Populate_AddPermissionsGenericGridForUsersAndGroup(userGroupDataList, userDataList); Populate_AddPermissionsAdvancedGridForUsersAndGroup(userGroupDataList, userDataList); } if (_IsMembership) { td_ep_membership.Visible = false; hmembershiptype.Value = "1"; } else { td_ep_membership.InnerHtml = _StyleHelper.GetEnableAllPrompt(); hmembershiptype.Value = "0"; } }
protected void LoadToolBar() { UserAPI m_refUserApi = new UserAPI(); string AppImgPath = m_refUserApi.AppImgPath; System.Text.StringBuilder result = new System.Text.StringBuilder(); string helpBtnText = string.Empty; try { divTitleBar.InnerHtml = m_refStyle.GetTitleBar((string) (SentMode ? (GetMessage("lbl sent messages")) : (GetMessage("lbl inbox")))); result.Append("<table ><tr>"); if (Request.QueryString["action"] == "viewallsent") { result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + "../UI/Icons/back.png", "CommunityMessaging.aspx?action=viewall", m_refMsg.GetMessage("alt back button text"), m_refMsg.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true)); result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + "../UI/Icons/emailDelete.png", "javascript:DelSelMsgs(" + (SentMode ? "true" : "false") + ");", m_refMsg.GetMessage("lbl del sel"), m_refMsg.GetMessage("lbl del sel"), "", StyleHelper.DeleteEmailButtonCssClass, true)); } else { result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + "../UI/Icons/emailAdd.png", "CommunityMessaging.aspx?action=editmsg", GetMessage("lbl compose a message"), GetMessage("lbl compose a message"), "", StyleHelper.AddEmailButtonCssClass, true)); result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + "../UI/Icons/emailDelete.png", "javascript:DelSelMsgs(" + (SentMode ? "true" : "false") + ");", m_refMsg.GetMessage("lbl del sel"), m_refMsg.GetMessage("lbl del sel"), "", StyleHelper.DeleteEmailButtonCssClass)); result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + "../UI/Icons/emailSent.png", "CommunityMessaging.aspx?action=viewallsent", m_refMsg.GetMessage("lbl sent messages"), m_refMsg.GetMessage("lbl sent messages"), "", StyleHelper.SentEmailsButtonCssClass)); helpBtnText = "messaging_inbox"; } result.Append(StyleHelper.ActionBarDivider); result.Append("<td>"); result.Append(m_refStyle.GetHelpButton(helpBtnText, "")); result.Append("</td>"); result.Append("</tr></table>"); divToolBar.InnerHtml = result.ToString(); result = null; } catch (Exception ex) { Utilities.ShowError(ex.Message); } }
private string GetUserFullName(long userid) { string retval = string.Empty; UserAPI objUserAPI = new UserAPI(); UserData objUserData = objUserAPI.GetActiveUserById(userid, false); retval = objUserData.FirstName + " " + objUserData.LastName; return retval; }
public bool Display_ViewConfiguration() { m_refUserApi = new UserAPI(); m_refSiteApi = new SiteAPI(); AppImgPath = m_refUserApi.AppImgPath; AppName = m_refUserApi.AppName; RegisterResources(); setting_data = m_refSiteApi.GetSiteVariables(m_refUserApi.UserId); mapping_data = m_refUserApi.GetADMapping(m_refUserApi.UserId, "userprop", 1, 0, 1); group_data = m_refUserApi.GetUserGroupById(1); sync_data = m_refUserApi.GetADStatus(); //domain_data = m_refUserApi.GetDomains(1, 0) AdValid = setting_data.AdValid; //CBool(siteVars("AdValid")) ViewToolBar(); //VERSION versionNumber.InnerHtml = m_refMsg.GetMessage("version") + " " + m_refSiteApi.Version + " " + m_refSiteApi.ServicePack; //BUILD NUMBER buildNumber.InnerHtml = "<i>(" + m_refMsg.GetMessage("build") + m_refSiteApi.BuildNumber + ")</i>"; licenseMessageContainer.Visible = false; if (!(AdValid)) { TR_domaindetail.Visible = false; licenseMessageContainer.Visible = true; licenseMessage.InnerHtml = m_refMsg.GetMessage("entrprise license with AD required msg"); } else { if ((sync_data.SyncUsers) || (sync_data.SyncGroups) || (sync_data.SyncRelationships) || (sync_data.DeSyncUsers) || (sync_data.DeSyncGroups)) { if (setting_data.ADAuthentication == 1) { ltr_status.Text = "<a href=\"adreports.aspx?action=ViewAllReportTypes\">" + m_refMsg.GetMessage("ad enabled not configured") + "</a>"; } else { ltr_status.Text = "<a href=\"adreports.aspx?action=ViewAllReportTypes\">" + m_refMsg.GetMessage("ad disabled not configured") + "</a>"; } } else {sync.Visible =false; } if (setting_data.IsAdInstalled) { installed.InnerHtml = m_refMsg.GetMessage("active directory installed") + " "; } else { installed.InnerHtml = m_refMsg.GetMessage("active directory not installed") + " "; } TD_flag.InnerHtml = m_refMsg.GetMessage("active directory authentication flag"); if (setting_data.ADAuthentication == 1) { TD_flagenabled.InnerHtml = m_refMsg.GetMessage("AD enabled"); } else if (setting_data.ADAuthentication == 2) { TD_flagenabled.InnerHtml = m_refMsg.GetMessage("LDAP enabled"); } else { TD_flagenabled.InnerHtml = m_refMsg.GetMessage("disabled"); } TD_dirflag.InnerHtml = m_refMsg.GetMessage("active directory flag"); if (setting_data.ADIntegration) { TD_intflag.InnerHtml = m_refMsg.GetMessage("enabled"); } else { TD_intflag.InnerHtml = m_refMsg.GetMessage("disabled"); } TD_autouser.InnerHtml = m_refMsg.GetMessage("auto add user flag"); if (setting_data.ADAutoUserAdd) { TD_autouserflag.InnerHtml = m_refMsg.GetMessage("enabled"); } else { TD_autouserflag.InnerHtml = m_refMsg.GetMessage("disabled"); } lgd_autoAddType.InnerHtml = m_refMsg.GetMessage("lbl auto add header"); autoAddTypeProperty.InnerHtml = m_refMsg.GetMessage("lbl auto add user type"); if (setting_data.ADAutoUserAddType == Ektron.Cms.Common.EkEnumeration.AutoAddUserTypes.Member) { autoAddTypeValue.InnerHtml = m_refMsg.GetMessage("lbl member"); } else { autoAddTypeValue.InnerHtml = m_refMsg.GetMessage("lbl author"); } TD_autogroup.InnerHtml = m_refMsg.GetMessage("auto add user to group flag"); if (setting_data.ADAutoUserToGroup) { TD_autogroupflag.InnerHtml = m_refMsg.GetMessage("enabled"); } else { TD_autogroupflag.InnerHtml = m_refMsg.GetMessage("disabled"); } userProperty.InnerHtml = m_refMsg.GetMessage("user property mapping title"); TD_cmstitle.InnerHtml = m_refMsg.GetMessage("cms property title"); TD_dirproptitle.InnerHtml = m_refMsg.GetMessage("active directory property title"); int i = 0; if (!(mapping_data == null)) { System.Text.StringBuilder result = new System.Text.StringBuilder(); for (i = 0; i <= mapping_data.Length - 1; i++) { result.Append("<tr>"); result.Append("<td class=\"label\">" + GetResourseText(mapping_data[i].CmsName) + ":</td>"); result.Append("<td class=\"readOnlyValue\">" + mapping_data[i].AdName + "</td>"); result.Append("<tr>"); } mapping_list.Text = result.ToString(); } adminGroupMap.InnerHtml = m_refMsg.GetMessage("cms admin group map"); TD_grpnameval.InnerHtml = group_data.GroupName; TD_grpDomainVal.InnerHtml = group_data.GroupDomain; domain.InnerHtml = m_refMsg.GetMessage("domain title") + ":"; //If (domain_data.Length = 0) Then //domainValue.InnerHtml += "<font color=""red""><strong>" & m_refMsg.GetMessage("generic no domains found") & " " & m_refMsg.GetMessage("generic check ad config msg") & "</strong></font>" //Else if (setting_data.ADDomainName == "") { domainValue.InnerHtml += m_refMsg.GetMessage("all domain select caption"); } else if (setting_data.ADAuthentication == 2) { domainValue.InnerHtml += m_refMsg.GetMessage("all domain select caption"); } else { domainValue.InnerHtml += setting_data.ADDomainName; } //End If } return false; }
private void Page_Load(System.Object sender, System.EventArgs e) { //Put user code to initialize the page here m_refUserApi = new UserAPI(); //ltrHttpHose.Text = Request.ServerVariables[http_host).ToLower(); m_bADAdvanced = m_refUserApi.RequestInformationRef.ADAdvancedConfig; jsUniqueID.Text = UniqueID + "_"; m_refMsg = (new CommonApi()).EkMsgRef; RegisterResources(); }
private bool Update() { try { int i; string Org; string Port; string LDAPDomain = ""; Array arrLDAPDomain; Array arrOrgU; Array arrOrgUSep; long arrCount2; long arrCount; string sChar = ":"; Hashtable page_addata = new Hashtable(); System.Collections.Specialized.NameValueCollection pagedata = new System.Collections.Specialized.NameValueCollection(); for (i = 1; i <= System.Convert.ToInt32(Request.Form[userpropcount.UniqueID]); i++) { if (!string.IsNullOrEmpty(Request.Form["userpropvalue" + i.ToString()])) { pagedata.Add(Request.Form["userpropname" + i.ToString()].ToString(), Request.Form["userpropvalue" + i.ToString()].ToString()); } } UserAPI m_refUserApi = new UserAPI(); //TODO: The following comments added by UDAI on 11/22/05. for defect#16785 //while implementing LDAP, ADGroupSelect hardcoded and widely used in this page for VS2003. I am keeping the same hardcode //parameter according to VS2005 (: to $). This page needs radio group using servercontrol property. //TODO: The following comments added by SCOTTK on 1/04/06. for defect# 17121 & 17367 // We were getting issues with the : to $ switch in 5.1.x, so I am placing code here to detect the right char to show if (!string.IsNullOrEmpty(Request.Form[UniqueID + "$ADGroupSelect"])) { sChar = "$"; } else if (!string.IsNullOrEmpty(Request.Form[UniqueID + "_ADGroupSelect"])) { sChar = "_"; } else { sChar = ":"; } if (Request.Form[UniqueID + sChar + "ADGroupSelect"] == "enable_adauth") { //only update user properties if AD Authentication is to be enabled m_refUserApi.UpdateADMapping(m_refUserApi.UserId, pagedata); } if (Request.Form[UniqueID + sChar + "ADGroupSelect"] == "enable_adauth") { page_addata.Add("ADAuthentication", 1); } else if (Request.Form[UniqueID + sChar + "ADGroupSelect"] == "disable_adauth") { page_addata.Add("ADAuthentication", 0); } else { page_addata.Add("ADAuthentication", 2); } if (!string.IsNullOrEmpty(Request.Form[EnableADInt.UniqueID])) { page_addata.Add("ADIntegration", 1); } else { page_addata.Add("ADIntegration", 0); } if (!string.IsNullOrEmpty(Request.Form[EnableAutoUser.UniqueID])) { page_addata.Add("ADAutoUserAdd", 1); } else { page_addata.Add("ADAutoUserAdd", 0); } page_addata.Add("ADAutoUserAddType", Request.Form[drpAutoAddType.UniqueID]); if (!string.IsNullOrEmpty(Request.Form[EnableAutoUserToGroup.UniqueID])) { page_addata.Add("ADAutoUserToGroup", 1); } else { page_addata.Add("ADAutoUserToGroup", 0); } if (Request.Form[UniqueID + sChar + "ADGroupSelect"] == "enable_adauth") { if (!string.IsNullOrEmpty(Request.Form["domainname"])) { page_addata.Add("ADDomainName", Request.Form["domainname"].ToString()); } } else if (Request.Form[UniqueID + sChar + "ADGroupSelect"] == "enable_LDAP") { Org = Request.Form[ServerText.UniqueID].ToString(); Port = Request.Form[PortText.UniqueID].ToString(); if (Request.Form[LDAPDomainText.UniqueID] != null) arrLDAPDomain = (Request.Form[LDAPDomainText.UniqueID].ToString()).Split('.'); else arrLDAPDomain = new List<string>().ToArray(); for (arrCount = 0; arrCount <= (arrLDAPDomain.Length - 1); arrCount++) { if (!(LDAPDomain == "")) { LDAPDomain += ","; } LDAPDomain += "dc="; LDAPDomain += arrLDAPDomain.GetValue(arrCount).ToString(); } arrCount = 0; Org += "</p>"; Org += Port; if (!string.IsNullOrEmpty(LDAPDomain)) { Org += "</p>"; Org += LDAPDomain; } Org += "</server>"; arrOrgUSep = (Request.Form[OrgUnitText.UniqueID].ToString()).Split(new string[] {"</>"}, StringSplitOptions.None); for (arrCount2 = 0; arrCount2 <= (arrOrgUSep.Length - 1); arrCount2++) { if (!(arrOrgUSep.GetValue(arrCount2).ToString() == "")) { arrOrgU = Strings.Split(arrOrgUSep.GetValue(arrCount2).ToString(), ",", -1, 0); bool first; first = true; for (arrCount = 0; arrCount <= (arrOrgU.Length - 1); arrCount++) { if (!(arrOrgU.GetValue(arrCount).ToString() == "")) { if (!(first)) { Org += ","; } first = false; //Org &= "ou=" Org += arrOrgU.GetValue(arrCount).ToString(); } } Org += "</>"; } } if (!string.IsNullOrEmpty(Request.Form[OrgText.UniqueID])) { Org += "o="; Org += Request.Form[OrgText.UniqueID].ToString(); } Org += (string) ("</server>" + Request.Form[drp_LDAPtype.UniqueID]); if (!string.IsNullOrEmpty(Request.Form[LDAP_SSL.UniqueID])) { Org += "</server>" + "SSL"; } else { Org += "</server>"; } if (!string.IsNullOrEmpty(Request.Form[txtLDAPAttribute.UniqueID])) { Org += (string) ("</server>" + Ektron.Cms.Common.EkFunctions.GetDbString(Request.Form[txtLDAPAttribute.UniqueID], 20, true)); } else { Org += "</server>"; } page_addata.Add("ADDomainName", Org); } else { if (!string.IsNullOrEmpty(Request.Form["domainname"])) { page_addata.Add("ADDomainName", Request.Form["domainname"].ToString()); } } SiteAPI m_refSiteApi = new SiteAPI(); m_refSiteApi.UpdateSiteVariables(page_addata); if (!string.IsNullOrEmpty(Request.Form[EnableADInt.UniqueID])) { //only update admin mapping if AD turned on m_refUserApi.MapCMSUserGroupToAD(1, Request.Form[admingroupname.UniqueID].ToString(), Request.Form[admingroupdomain.UniqueID].ToString()); } return (true); //Response.Redirect("adconfigure.aspx", False) } catch (Exception ex) { throw (new Exception(ex.Message)); } }
/// <summary> /// 构造函数 /// </summary> /// <param name="client">操作类实例</param> public UserInterface(Client client) : base(client) { api = new UserAPI(client); }
private void Page_Load(System.Object sender, System.EventArgs e) { Response.CacheControl = "no-cache"; Response.AddHeader("Pragma", "no-cache"); Response.Expires = -1; try { //Put user code to initialize the page here TR_count.Visible = false; m_refSiteApi = new SiteAPI(); m_refUserApi = new UserAPI(); m_refMsg = m_refSiteApi.EkMsgRef; AppImgPath = m_refUserApi.AppImgPath; CmsUserIcon = "<img src=\"" + AppImgPath + "../UI/Icons/user.png\" valign=\"absbottom\" title=\"CMS User\">"; MemberShipUserIcon = "<img src=\"" + AppImgPath + "../UI/Icons/userMembership.png\" valign=\"absbottom\" title=\"MemberShip User\">"; CmsGroupIcon = "<img src=\"" + AppImgPath + "../UI/Icons/users.png\" valign=\"absbottom\" title=\"CMS Group\">"; MemberShipGroupIcon = "<img src=\"" + AppImgPath + "../UI/Icons/usersMembership.png\" valign=\"absbottom\" title=\"MemberShip User\">"; AppPath = m_refUserApi.AppPath; CmsUserIcon = "<img src=\"" + AppImgPath + "../UI/Icons/user.png\" valign=\"absbottom\" title=\"CMS User\">"; MemberShipUserIcon = "<img src=\"" + AppImgPath + "../UI/Icons/userMembership.png\" valign=\"absbottom\" title=\"MemberShip User\">"; CmsGroupIcon = "<img src=\"" + AppImgPath + "../UI/Icons/users.png\" valign=\"absbottom\" title=\"CMS Group\">"; MemberShipGroupIcon = "<img src=\"" + AppImgPath + "../UI/Icons/usersMembership.png\" valign=\"absbottom\" title=\"MemberShip User\">"; CmsUserIcon = "<img src=\"" + AppImgPath + "../UI/Icons/user.png\" valign=\"absbottom\" title=\"CMS User\">"; MemberShipUserIcon = "<img src=\"" + AppImgPath + "../UI/Icons/userMembership.png\" valign=\"absbottom\" title=\"MemberShip User\">"; CmsGroupIcon = "<img src=\"" + AppImgPath + "../UI/Icons/users.png\" valign=\"absbottom\" title=\"CMS Group\">"; MemberShipGroupIcon = "<img src=\"" + AppImgPath + "../UI/Icons/usersMembership.png\" valign=\"absbottom\" title=\"MemberShip User\">"; if (!(Request.QueryString["action"] == null)) { if (Request.QueryString["action"] != "") { m_strPageAction = Request.QueryString["action"].ToLower(); } } StyleSheetJS.Text = m_refStyle.GetClientScript(); Utilities.ValidateUserLogin(); RegisterResources(); if (!(Page.IsPostBack)) { switch (m_strPageAction) { case "desynchgroups": DeSynchGroups(); break; case "desynchusers": DeSynchUsers(); break; case "viewallreporttypes": ViewAllReportTypes(); break; case "getusersforsynch": GetUsersForSync(); break; case "getgroupsforsynch": GetGroupsForSync(); break; case "getrelationshipsforsynch": GetRelationshipsForSync(); break; } } else { switch (m_strPageAction) { case "getusersforsynch": Process_SynchCMSUsersToAD(); break; case "getgroupsforsynch": Process_SynchCMSGroupsToAD(); break; case "getrelationshipsforsynch": Process_SynchCMSRelationShipsToAD(); break; case "desynchusers": Process_DeSynchUsers(); break; } } } catch (Exception ex) { Utilities.ShowError(ex.Message); } }
/// <summary> /// Handles the Getting all the users based on the search text passed by the user on UI. /// </summary> private void GetUsers() { if (!string.IsNullOrEmpty(Strings.Trim(this.m_strSearchText))) { UserRequestData req = new UserRequestData(); UserAPI m_refUserApi = new UserAPI(); req.Type = (this.m_UserType == EkEnumeration.UserTypes.AuthorType ? 0 : 1); req.Group = (this.m_UserType == EkEnumeration.UserTypes.AuthorType ? 2 : 888888); req.RequiredFlag = 0; req.OrderBy = string.Empty; req.OrderDirection = "asc"; req.SearchText = this.m_strSearchText; req.PageSize = m_refContentApi.RequestInformationRef.PagingSize; req.CurrentPage = this.m_intCurrentPage; userList = m_refUserApi.GetAllUsers(ref req); this.m_intTotalPages = req.TotalPages; } }
private void AddLDAPUsersToSystem() { Collection sdUsersNames = new Collection(); Collection sdUsersDomains = new Collection(); string strUsername = ""; string strDomain = ""; strUsername = ""; strDomain = ""; strUsername = Request.Form["cn_name"].ToString(); strDomain = Request.Form["cn_path"].ToString(); if ((strUsername != "") && (strDomain != "")) { sdUsersNames.Add(strUsername, "0", null, null); sdUsersDomains.Add(strDomain, "0", null, null); } Response.Write(strUsername + " " + strDomain + "<br /"); Ektron.Cms.User.EkUser usr; bool ret = false; UserAPI m_refUserApi = new UserAPI(); usr = m_refUserApi.EkUserRef; ret = usr.AddLDAPUsersToCMSByUsername(sdUsersNames, sdUsersDomains, m_intGroupType); }
public bool ProcessSubmission() { SiteAPI m_refSiteApi = new SiteAPI(); Hashtable pagedata; Hashtable modulelicense; Hashtable modulelicenses = new Hashtable(); Collection prefs = new Collection(); long FolderId; int i = 0; pagedata = new Hashtable(); while (Request.Form["mlicenseid" + (i + 1)] != null && Request.Form["mlicenseid" + (i + 1)].ToString().Length > 0) { modulelicense = new Hashtable(); modulelicense.Add("ID", System.Convert.ToInt32(Request.Form["mlicenseid" + (i + 1)])); modulelicense.Add("License", Request.Form["mlicense" + (i + 1)]); modulelicense.Add("Type", 0); modulelicenses.Add(i, modulelicense); i++; modulelicense = null; } pagedata.Add("ModuleLicenses", modulelicenses); pagedata.Add("LicenseKey", Request.Form["license"]); pagedata.Add("AppLanguage", Request.Form["language"]); pagedata.Add("SystemEmail", Request.Form["SystemEmaillAddr"]); if (Request.Form["SystemAsynchStaging"] != null && (Request.Form["SystemAsynchStaging"]).ToString().Length > 0) { pagedata.Add("AsynchStaging", 1); m_refSiteApi.RequestInformationRef.IsStaging = true; } else { pagedata.Add("AsynchStaging", 0); m_refSiteApi.RequestInformationRef.IsStaging = false; } if (Request.Form["SystemAsynchLocation"] != null && (Request.Form["SystemAsynchLocation"]).ToString().Length > 0) { pagedata.Add("AsynchLocation", Request.Form["SystemAsynchLocation"]); } else { pagedata.Add("AsynchLocation", Request.Form["SystemAsynchLocation"]); } //These settings only appliy to the eWebEditPro editor, other wise set the defaut values in it. if (ConfigurationManager.AppSettings["ek_DataDesignControl"] != null && ConfigurationManager.AppSettings["ek_DataDesignControl"].ToString() == "eWebEditPro") { int ContentSize = 1000000; int SummarySize = 65000; if (int.TryParse(Request.Form["content_size"], out ContentSize)) { if (ContentSize < 1000000) ContentSize = 1000000; } if (int.TryParse(Request.Form["summary_size"], out SummarySize)) { if (SummarySize < 65000) SummarySize = 65000; } pagedata.Add("MaxContentSize", ContentSize.ToString()); pagedata.Add("MaxSummarySize", SummarySize.ToString()); } else { pagedata.Add("MaxContentSize", "1000000"); pagedata.Add("MaxSummarySize", "65000"); } //End content size if (Request.Form["EnableMessaging"] != null && Request.Form["EnableMessaging"] != "") { pagedata.Add("EnableMessaging", 1); } else { pagedata.Add("EnableMessaging", 0); } if (Request.Form["filesystemsupport"] != null && Request.Form["filesystemsupport"] != "") { pagedata.Add("FileSystemSupport", 1); } else { pagedata.Add("FileSystemSupport", 0); } if (!(Request.Form["PublishPdfEnabled"] == null)) { if (Request.Form["PublishPdfEnabled"] != "") { pagedata.Add("PublishPdfEnabled", 1); } else { pagedata.Add("PublishPdfEnabled", 0); } } else { pagedata.Add("PublishPdfEnabled", 0); } if (Request.Form[font_style.UniqueID] != null && (Request.Form[font_style.UniqueID]).ToString().Length > 0) { pagedata.Add("EnableFontButtons", 1); } else { pagedata.Add("EnableFontButtons", 0); } //If (Len(Request.Form(styles.UniqueID))) Then // pagedata.Add("RemoveStyles", 1) //Else // pagedata.Add("RemoveStyles", 0) //End If if (Request.Form[word_styles.UniqueID] != null && (Request.Form[word_styles.UniqueID]).ToString().Length > 0) { pagedata.Add("PreserveWordStyles", 1); } else { pagedata.Add("PreserveWordStyles", 0); } if (Request.Form[word_classes.UniqueID] != null && (Request.Form[word_classes.UniqueID]).ToString().Length > 0) { pagedata.Add("PreserveWordClasses", 1); } else { pagedata.Add("PreserveWordClasses", 0); } pagedata.Add("PreApprovalGroup", "0"); if (Request.Form[chkVerifyUserOnAdd.UniqueID] == "on") { pagedata.Add("VerifyUserOnAdd", "1"); } else { pagedata.Add("VerifyUserOnAdd", "0"); } if (Request.Form[chkEnablePreApproval.UniqueID] == "on") { pagedata.Add("EnablePreApproval", "1"); } else { pagedata.Add("EnablePreApproval", "0"); } //if (Request.Form["access"] != null && Request.Form["access"].ToString().Length > 0) //{ // pagedata.Add("accessibility", Request.Form["access"]); //} //else //{ // pagedata.Add("accessibility", 0); //} //if (access_none.Selected) //{ // pagedata.Add("accessibility", access_none.Value); //} //else if (access_loose.Selected) //{ // pagedata.Add("accessibility", access_loose.Value); //} //else if (access_strict.Selected) //{ // pagedata.Add("accessibility", access_strict.Value); //} //else //{ // pagedata.Add("accessibility", 0); //} if (Request.Form[access.UniqueID] != null) { pagedata.Add("accessibility", Request.Form[access.UniqueID]); } else { pagedata.Add("accessibility", 0); } prefs.Add("9999", "width", null, null); prefs.Add("9999", "height", null, null); prefs.Add(Request.Form[templatefilename.UniqueID], "template", null, null); if (Request.Form[chkSmartDesktop.UniqueID] == "on") { FolderId = -1; } else { if (Request.Form["folderId"] != "") { FolderId = Convert.ToInt64(Request.Form["folderId"]); } else { FolderId = 0; } } prefs.Add(FolderId, "folderid", null, null); if (Request.Form[forcePrefs.UniqueID] == "on") { prefs.Add("1", "forcesetting", null, null); } else { prefs.Add("0", "forcesetting", null, null); } prefs.Add("1", "dispborders", null, null); //if (Request.Form[disptitletext.UniqueID] == "on") //{ // prefs.Add("1", "disptitletext", null, null); //} //else //{ // prefs.Add("0", "disptitletext", null, null); //} m_refSiteApi.UpdateSiteVariables(pagedata); Ektron.Cms.DataIO.LicenseManager.LicenseManager.Reset(m_refSiteApi.RequestInformationRef); Collection oldUser = new Collection(); oldUser.Add(Request.Form[userid.UniqueID], "UserID", null, null); oldUser.Add(Request.Form[username.UniqueID], "UserName", null, null); oldUser.Add(Request.Form["pwd"], "Password", null, null); oldUser.Add("", "Domain", null, null); oldUser.Add("BUILTIN", "FirstName", null, null); oldUser.Add("BUILTIN", "LastName", null, null); oldUser.Add("0", "Language", null, null); oldUser.Add("", "EditorOptions", null, null); oldUser.Add("", "EmailAddr1", null, null); oldUser.Add("1", "DisableMsg", null, null); if (Request.Form["chkAccountLocked"] != null && Request.Form["chkAccountLocked"] != "") { oldUser.Add(254, "LoginAttempts", null, null); } else { oldUser.Add(0, "LoginAttempts", null, null); } UserAPI m_refUserApi = new UserAPI(); m_refUserApi.UpdateUser(oldUser); m_refUserApi.UpdateUserPreferences(0, prefs); return (true); }
protected void uploadFile_Click(object sender, EventArgs e) { string fileName = string.Empty; HttpPostedFile fileUpld = ekFileUpload.PostedFile; string hasValidExtension = ""; List<string> AllowedFileTypes = new List<string>(); AllowedFileTypes.AddRange(DocumentManagerData.Instance.FileTypes.ToString().Split(','.ToString().ToCharArray())); if (fileUpld.ContentLength > 0) { Ektron.Cms.UserAPI uAPI = new UserAPI(); _fileExtension = Path.GetExtension(fileUpld.FileName); //hasValidExtension = (string) (AllowedFileTypes.Find(new Predicate<string>(new System.EventHandler(CheckExtension)))); hasValidExtension = AllowedFileTypes.Find(new Predicate<string>(CheckExtension)); if ((hasValidExtension != null)&& hasValidExtension != "") { //If Image Gallery, Should check if the file type is an image file type if ((Request.QueryString["prop"] != null)&& Request.QueryString["prop"].ToLower() == "image") { if (! Ektron.Cms.Common.EkFunctions.IsImage(_fileExtension)) { ltrStatus.Text = m_refMsg.GetMessage("msg invalid file upload images only"); setInvalid(); return; } } fileName = Path.GetFileName(fileUpld.FileName); int fileLength = fileUpld.ContentLength; byte[] fileData = new byte[fileLength - 1+ 1]; string file = Convert.ToString(fileUpld.InputStream.Read(fileData, 0, fileLength)); if (fileData.Length > 0) { System.IO.MemoryStream stream = new System.IO.MemoryStream(fileData); m_refContApi.RequestInformationRef.UserId = uAPI.UserId; m_refContApi.ContentLanguage = _contentLanguage; Ektron.ASM.AssetConfig.AssetData asstData = new Ektron.ASM.AssetConfig.AssetData(); Ektron.Cms.API.Content.Content cContent = new Ektron.Cms.API.Content.Content(); asstData = m_refContApi.EkContentRef.GetAssetDataBasedOnFileName(fileName, _folderID, _taxonomyID); if ((asstData != null)&& asstData.ID != "" && asstData.Name != "") { Ektron.Cms.AssetUpdateData astData = new AssetUpdateData(); TaxonomyBaseData[] taxonomyCatArray = null; _contentID = Convert.ToInt64(asstData.ID); ContentData cData = cContent.GetContent(_contentID, Ektron.Cms.ContentAPI.ContentResultType.Published); astData.FileName = fileName; astData.FolderId = _folderID; astData.ContentId = cData.Id; astData.Teaser = cData.Teaser; astData.Comment = cData.Comment; astData.Title = cData.Title; astData.GoLive = cData.GoLive; astData.TaxonomyTreeIds = this._taxonomyID.ToString(); //Assigning the categories taxonomyCatArray = m_refContApi.ReadAllAssignedCategory(_contentID); if ((taxonomyCatArray != null)&& taxonomyCatArray.Length > 0) { foreach (TaxonomyBaseData tBaseData in taxonomyCatArray) { if (astData.TaxonomyTreeIds == "") { astData.TaxonomyTreeIds = tBaseData.TaxonomyId.ToString(); } else { astData.TaxonomyTreeIds += (string) ("," + tBaseData.TaxonomyId.ToString()); } } } //Assigning the metadatas if ((cData.MetaData != null)&& cData.MetaData.Length > 0) { astData.MetaData = new Ektron.Cms.AssetUpdateMetaData[cData.MetaData.Length - 1 + 1]; for (int i = 0; i <= cData.MetaData.Length - 1; i++) { astData.MetaData[i] = new AssetUpdateMetaData(); astData.MetaData[i].TypeId = cData.MetaData[i].TypeId; astData.MetaData[i].ContentId = cData.Id; astData.MetaData[i].Text = cData.MetaData[i].Text; } } astData.EndDate = cData.EndDate; astData.EndDateAction = (Ektron.Cms.Common.EkEnumeration.CMSEndDateAction) (Enum.Parse(typeof(Ektron.Cms.Common.EkEnumeration.CMSEndDateAction), cData.EndDateAction.ToString(), true)); //Updating the Content bool isUpdated = m_refContApi.EditAsset(stream, astData); } else { Ektron.Cms.AssetUpdateData astData = new AssetUpdateData(); astData.FileName = fileName; astData.FolderId = _folderID; astData.Title = Path.GetFileNameWithoutExtension(fileName); astData.LanguageId = _contentLanguage; astData.TaxonomyTreeIds = this._taxonomyID.ToString(); _contentID = m_refContApi.AddAsset(stream, astData); } jsMetaUrl.Text = ""; if (m_refContApi.EkContentRef.DoesFolderRequireMetadataOrTaxonomy(_folderID, _contentLanguage)) { var _taxString = string.Empty; if (this._taxonomyID != -1) { _taxString = (string) ("&taxonomyId=" + this._taxonomyID); } jsMetaUrl.Text = m_refContApi.AppPath + "DMSMetadata.aspx?contentId=" + _contentID + "&idString=" + _contentID + "&folderId=" + _folderID + _taxString + "&close=true&EkTB_iframe=true&height=550&width=650&modal=true&refreshCaller=true"; } isFileUploadComplete.Value = "true"; ClientScript.RegisterStartupScript(this.GetType(), "closeThickBox", "uploadClick();", true); } } else { ltrStatus.Text = m_refMsg.GetMessage("msg invalid file upload"); setInvalid(); } } else { ltrStatus.Text = m_refMsg.GetMessage("lbl upload file"); setInvalid(); } }
private bool DisplayEditConfiguration() { SiteAPI m_refSiteApi = new SiteAPI(); UserAPI m_refUserApi = new UserAPI(); SettingsData settings_data; UserData user_data; UserGroupData[] group_data; UserPreferenceData preference_data; try { AppImgPath = m_refSiteApi.AppImgPath; AppName = m_refSiteApi.AppName; AppPath = m_refSiteApi.AppPath; SITEPATH = m_refSiteApi.SitePath; user_data = m_refUserApi.GetUserById(Ektron.Cms.Common.EkConstants.BuiltIn, false, false); preference_data = m_refUserApi.GetUserPreferenceById(0); group_data = m_refUserApi.GetAllUserGroups("GroupName"); VerifyTrue = "<img src=\"" + AppPath + "images/UI/Icons/check.png\" border=\"0\" alt=\"Item is Enabled\" title=\"Item is Enabled\">"; VerifyFalse = "<img src=\"" + AppImgPath + "icon_redx.gif\" border=\"0\" alt=\"Item is Disabled\" title=\"Item is Disabled\">"; settings_data = m_refSiteApi.GetSiteVariables(m_refSiteApi.UserId, true); jsContentLanguage.Text = Convert.ToString(settings_data.Language); //VERSION td_version.InnerHtml = m_refMsg.GetMessage("version") + m_refSiteApi.Version + " " + m_refSiteApi.ServicePack; //BUILD NUMBER td_buildnumber.InnerHtml = "<i>(" + m_refMsg.GetMessage("build") + m_refSiteApi.BuildNumber + ")</i>"; //Which Editor m_SelectedEditControl = Utilities.GetEditorPreference(Request); //LICENSE //defect: 60170 //td_licensekey.InnerHtml = "<input type=\"text\" maxlength=\"4000\" name=\"license\" value=\"" + settings_data.LicenseKey + "\" />"; td_licensekey.InnerHtml ="<TEXTAREA name=\"license\" rows=\"1\" cols=\"1\">" + settings_data.LicenseKey + "</TEXTAREA>"; td_licensekey.InnerHtml += "<input type=\"hidden\" maxlength=\"4000\" name=\"license1\" value=\"" + settings_data.LicenseKey + "\" />"; td_licensekey.InnerHtml += "<br/>"; td_licensekey.InnerHtml += "<span class=\"ektronCaption\">" + m_refMsg.GetMessage("license key help text") + "</span>"; //MODULE LICENSE System.Text.StringBuilder module_text = new System.Text.StringBuilder(); int i = 0; if (!(settings_data.ModuleLicense == null)) { for (i = 0; i <= settings_data.ModuleLicense.Length - 1; i++) { if (i > 0) { module_text.Append("<div class=\"ektronTopSpaceSmall\"></div>"); } module_text.Append(i + 1 + ". "); module_text.Append("<input type=\"text\" maxlength=\"4000\" name=\"mlicense" + (i + 1) + "\" value=\"" + settings_data.ModuleLicense[i].License + "\">" + "\r\n"); module_text.Append("<input type=\"hidden\" name=\"mlicenseid" + (i + 1) + "\" value=\"" + settings_data.ModuleLicense[i].Id + "\">" + "\r\n"); } } module_text.Append("<div class=\"ektronTopSpaceSmall\"></div>"); module_text.Append(i + 1 + ". "); module_text.Append("<input type=\"text\" maxlength=\"4000\" name=\"mlicense" + (i + 1) + "\" value=\"\">" + "\r\n"); module_text.Append("<input type=\"hidden\" name=\"mlicenseid" + (i + 1) + "\" value=\"0\">" + "\r\n"); td_modulelicense.InnerHtml = module_text.ToString(); //LANGUAGE LIST LanguageData[] active_lang_list; active_lang_list = m_refSiteApi.GetAllActiveLanguages(); td_languagelist.InnerHtml = "<select id=\"language\" name=\"language\" selectedindex=\"0\">"; if (!(active_lang_list == null)) { for (i = 0; i <= active_lang_list.Length - 1; i++) { //If (Convert.ToString(active_lang_list(i).Id) = settings_data.Language) Then td_languagelist.InnerHtml += "<option value=\"" + active_lang_list[i].Id + "\" "; if (Convert.ToString(active_lang_list[i].Id) == settings_data.Language) { td_languagelist.InnerHtml += " selected"; } td_languagelist.InnerHtml += "> " + active_lang_list[i].Name + "</option>"; //End If } } td_languagelist.InnerHtml += "</select>"; //These settings only appliy to the eWebEditPro editor if (ConfigurationManager.AppSettings["ek_DataDesignControl"] != null && ConfigurationManager.AppSettings["ek_DataDesignControl"].ToString() == "eWebEditPro") { trSettings.Visible = true; trSummary.Visible = true; //MAX CONTENT SIZE td_maxcontent.InnerHtml = "<input type=\"Text\" maxlength=\"9\" size=\"9\" name=\"content_size\" value=\"" + settings_data.MaxContentSize + "\">"; td_maxcontent.InnerHtml += "<br/>"; td_maxcontent.InnerHtml += "<span class=\"ektronCaption\">" + m_refMsg.GetMessage("settings max content help text") + "</span>"; //MAX SUMMARY SIZE td_maxsummary.InnerHtml = "<input type=\"Text\" maxlength=\"9\" size=\"9\" name=\"summary_size\" value=\"" + settings_data.MaxSummarySize + "\" >"; td_maxsummary.InnerHtml += "<br/>"; td_maxsummary.InnerHtml += "<span class=\"ektronCaption\">" + m_refMsg.GetMessage("settings max summary help text") + "</span>"; } //SYSTEM EMAIL td_email.InnerHtml = "<input type=\"Text\" maxlength=\"50\" size=\"25\" name=\"SystemEmaillAddr\" value=\"" + settings_data.Email + "\">"; td_email.InnerHtml += "<div class=\"ektronCaption\">"; //EMAIL NOTIFICATION if (settings_data.EnableMessaging) { td_email.InnerHtml += "<input type=\"CHECKBOX\" name=\"EnableMessaging\" value=\"enable_msg\" CHECKED=\"True\">"; } else { td_email.InnerHtml += "<input type=\"CHECKBOX\" name=\"EnableMessaging\" value=\"enable_msg\">"; } td_email.InnerHtml += m_refMsg.GetMessage("enable mail messages") + " "; td_email.InnerHtml += "</div>"; //Server Type if (Convert.ToBoolean(settings_data.AsynchronousStaging)) { td_server_type.InnerHtml += "<input type=\"CHECKBOX\" name=\"SystemAsynchStaging\" value=\"enable_msg\" CHECKED=\"True\">"; } else { td_server_type.InnerHtml = "<input type=\"CHECKBOX\" name=\"SystemAsynchStaging\" value=\"enable_msg\" >"; } td_server_type.InnerHtml += "Staging Server" + " "; td_server_type.InnerHtml += "<br/>"; td_server_type.InnerHtml += "<span class=\"ektronCaption\">" + m_refMsg.GetMessage("lbl enable server type message") + "</span>"; //Asyncronous Processor Location if (!(settings_data.AsynchronousLocation == null)) { // OldSystemAsynchLocation is needed because a disabled input field is not posted td_asynch_location.InnerHtml = "<input type=\"Hidden\" name=\"OldSystemAsynchLocation\" value=\"" + settings_data.AsynchronousLocation + "\">"; td_asynch_location.InnerHtml += "<input type=\"Text\" maxlength=\"255\" name=\"SystemAsynchLocation\" value=\"" + settings_data.AsynchronousLocation + "\""; } else { td_asynch_location.InnerHtml = "<input type=\"Text\" maxlength=\"255\" name=\"SystemAsynchLocation\" value=\"\""; } td_asynch_location.InnerHtml += ">"; td_asynch_location.InnerHtml += "<br/>"; td_asynch_location.InnerHtml += "<span class=\"ektronCaption\">"; td_asynch_location.InnerHtml += m_refMsg.GetMessage("lbl Example Location") + " http://localhost/CMS400Developer/Workarea/webservices/EktronAsyncProcessorWS.asmx"; td_asynch_location.InnerHtml += "</span>"; //PUBLISHPDF and PUBLISHHTML would check this flag. if (settings_data.PublishPdfSupported) { string schk = ""; if (settings_data.PublishPdfEnabled) { schk = " checked "; } PubPdf.Text = "<tr>"; PubPdf.Text += "<td class=\"label shortLabel\">"; PubPdf.Text += "<label for=\"PublishPdfEnabled\">" + m_refMsg.GetMessage("alt Enable office documents to be published in other format") + ":" + "</label>"; PubPdf.Text += "</td>"; PubPdf.Text += "<td class=\"value\">"; PubPdf.Text += "<input type=\"checkbox\" name=\"PublishPdfEnabled\" id=\"PublishPdfEnabled\"" + schk + " >"; PubPdf.Text += "</td>"; PubPdf.Text += "</tr>"; } else { PubPdf.Visible = false; } //LIBRARY FOLDER CREATION if (settings_data.FileSystemSupport) { td_libfolder.InnerHtml = "<input type=\"CHECKBOX\" name=\"filesystemsupport\" value=\"enable_msg\" CHECKED=\"True\" Onclick=\"javascript:return AreYouSure();\">"; } else { td_libfolder.InnerHtml = "<input type=\"CHECKBOX\" name=\"filesystemsupport\" value=\"enable_msg\" Onclick=\"javascript: return AreYouSure()\">"; } //BUILT IN USER //Dim x As System.Web.UI.WebControls.TextBox userid.Value = user_data.Id.ToString(); username.Value = user_data.Username; TD_Pwd.InnerHtml = "<input type=\"password\" value=\"" + user_data.Password + "\" id=\"pwd\" name=\"pwd\" maxlength=\"50\" Onkeypress=\"javascript:return CheckKeyValue(event,\'34\');\">"; TD_Pwd2.InnerHtml = "<input type=\"password\" value=\"" + user_data.Password + "\" id=\"confirmpwd\" name=\"confirmpwd\" maxlength=\"50\" Onkeypress=\"javascript:return CheckKeyValue(event,\'34\');\">"; if ((m_refUserApi.RequestInformationRef.LoginAttempts != -1) && (m_refUserApi.IsAdmin() || m_refUserApi.UserId == 999999999 || (m_refUserApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.AdminUsers)))) { accountLocked.Text = "<input type=\"checkbox\" id=\"chkAccountLocked\" name=\"chkAccountLocked\" "; if (user_data.IsAccountLocked(m_refUserApi.RequestInformationRef)) { accountLocked.Text += " checked "; } accountLocked.Text += " />"; } else { accountLocked.Text = "<input type=\"hidden\" id=\"chkAccountLocked\" name=\"chkAccountLocked\" "; if (user_data.IsAccountLocked(m_refUserApi.RequestInformationRef)) { accountLocked.Text += " value=\"on\" />"; } else { accountLocked.Text += " value=\"\" />"; } } //styles.Items.Add(New ListItem(m_refMsg.GetMessage("remove styles"), "remove")) //styles.Items.Add(New ListItem(m_refMsg.GetMessage("do not remove styles"), "")) //If (settings_data.RemoveStyles) Then // styles.Items(0).Selected = True //Else // styles.Items(1).Selected = True //End If //styles.Attributes.Add("onClick", "javascript:checkWordStlyes();") //If (settings_data.RemoveStyles) Then // 'jsRemoveStyle = "1" //End If if (settings_data.EnableFontButtons) { font_style.Checked = true; } if (settings_data.PreserveWordStyles) { word_styles.Checked = true; } if (settings_data.PreserveWordClasses) { word_classes.Checked = true; } if (preference_data.Template != "") { templatefilename.Value = preference_data.Template; } if (Convert.ToString(preference_data.FolderId) == "") { chkSmartDesktop.Checked = true; } folderId.Value = preference_data.FolderId; if (preference_data.ForceSetting) { forcePrefs.Checked = true; } //if (preference_data.DisplayTitleText == "1") //{ //disptitletext.Checked = true; //} //txtHeight.Value = Convert.ToString(preference_data.Height) //txtWidth.Value = Convert.ToString(preference_data.Width) if (settings_data.VerifyUserOnAdd) { chkVerifyUserOnAdd.Checked = true; } if (settings_data.EnablePreApproval) { chkEnablePreApproval.Checked = true; } access_def.Value = settings_data.Accessibility; SetAccessibilityRadioButtons(); return (false); } catch { return true; } }
private bool Display_EditConfiguration() { string[] arrOrg; string[] arrItem; long arrCount; string[] arrDomain; long arrCount2; string[] arrOrg2; bool isUnit = false; string[] arrServer; string[] arrLDAPDomain; string strLDAPDomain = ""; string[] arrLDAPDomainElement; bool first = true; string adselectedstate = ""; m_refUserApi = new UserAPI(); m_refSiteApi = new SiteAPI(); AppImgPath = m_refUserApi.AppImgPath; AppName = m_refUserApi.AppName; setting_data = m_refSiteApi.GetSiteVariables(-1); mapping_data = m_refUserApi.GetADMapping(m_refUserApi.UserId, "userprop", 1, 0, 1); cGroup = m_refUserApi.GetUserGroupById(1); sync_data = m_refUserApi.GetADStatus(); try { domain_data = m_refUserApi.GetDomains(1, 0); } catch { domain_data = null; } EditToolBar(); //POPULATE TOOL BAR //VERSION versionNumber.InnerHtml = m_refMsg.GetMessage("version") + " " + m_refSiteApi.Version + " " + m_refSiteApi.ServicePack; //BUILD NUMBER buildNumber.InnerHtml = "<i>(" + m_refMsg.GetMessage("build") + m_refSiteApi.BuildNumber + ")</i>"; if ((sync_data.SyncUsers) || (sync_data.SyncGroups) || (sync_data.SyncRelationships) || (sync_data.DeSyncUsers) || (sync_data.DeSyncGroups)) { if (setting_data.ADAuthentication == 1) { ltr_status.Text = "<a href=\"adreports.aspx?action=ViewAllReportTypes\">" + m_refMsg.GetMessage("ad enabled not configured") + "</a>"; } else { ltr_status.Text = "<a href=\"adreports.aspx?action=ViewAllReportTypes\">" + m_refMsg.GetMessage("ad disabled not configured") + "</a>"; } } //Ektron.Cms.Sync doesn't have "visible" //else //{ // Ektron.Cms.Sync.visible = false; //} if (setting_data.IsAdInstalled) { installed.InnerHtml = m_refMsg.GetMessage("active directory installed"); } else { installed.InnerHtml = m_refMsg.GetMessage("active directory not installed"); } if (setting_data.ADAuthentication == 1) { EnableADAuth.Checked = true; adselectedstate = ""; //OrgUnitText.Disabled = True OrgText.Disabled = true; ServerText.Disabled = true; drp_LDAPtype.Enabled = false; PortText.Disabled = true; LDAPDomainText.Disabled = true; txtLDAPAttribute.Enabled = false; LDAP_SSL.Disabled = true; admingroupdomain.Disabled = false; admingroupname.Disabled = false; drpAutoAddType.Enabled = true; } else if (setting_data.ADAuthentication == 0) { DisableAD.Checked = true; adselectedstate = "disabled"; //OrgUnitText.Disabled = True OrgText.Disabled = true; ServerText.Disabled = true; drp_LDAPtype.Enabled = false; PortText.Disabled = true; LDAPDomainText.Disabled = true; txtLDAPAttribute.Enabled = false; LDAP_SSL.Disabled = true; admingroupdomain.Disabled = true; admingroupname.Disabled = true; } else { EnableLDAP.Checked = true; adselectedstate = "disabled"; //OrgUnitText.Disabled = False OrgText.Disabled = false; ServerText.Disabled = false; drp_LDAPtype.Enabled = true; PortText.Disabled = false; LDAPDomainText.Disabled = false; txtLDAPAttribute.Enabled = true; LDAP_SSL.Disabled = false; admingroupdomain.Disabled = true; admingroupname.Disabled = true; } lgd_autoAddType.InnerHtml = m_refMsg.GetMessage("lbl auto add header"); autoAddTypeProperty.InnerHtml = m_refMsg.GetMessage("lbl auto add user type"); drpAutoAddType.Items.Add(new ListItem(m_refMsg.GetMessage("lbl author"), "0")); drpAutoAddType.Items.Add(new ListItem(m_refMsg.GetMessage("lbl member"), "1")); drpAutoAddType.SelectedIndex = setting_data.ADAutoUserAddType.GetHashCode(); if (setting_data.ADIntegration) { EnableADInt.Checked = true; } if (!(setting_data.ADAuthentication == 1)) { EnableADInt.Disabled = true; } if (setting_data.ADAutoUserAdd) { EnableAutoUser.Checked = true; } if (!(setting_data.ADAuthentication == 1)) { EnableAutoUser.Disabled = true; } //EnableAutoUserToGroup if (setting_data.ADAutoUserToGroup) { EnableAutoUserToGroup.Checked = true; } if (!(setting_data.ADAuthentication == 1)) { EnableAutoUserToGroup.Disabled = true; } userProperty.InnerHtml = m_refMsg.GetMessage("user property mapping"); cmsProperty.InnerHtml = m_refMsg.GetMessage("cms property value"); activeDirectoryProperty.InnerHtml = m_refMsg.GetMessage("active directory property value"); userpropcount.Value = mapping_data.Length.ToString(); int i; System.Text.StringBuilder result = new System.Text.StringBuilder(); if (!(mapping_data == null)) { for (i = 0; i <= mapping_data.Length - 1; i++) { result.Append("<tr>"); result.Append("<td class=\"label\">" + GetResourseText(mapping_data[i].CmsName) + ":</td>"); result.Append("<td>"); result.Append("<input type=\"hidden\" maxlength=\"50\" size=\"50\" name=\"userpropname" + (i + 1) + "\" id=\"userpropname" + (i + 1) + "\" value=\"" + mapping_data[i].CmsName + "\">"); result.Append("<input type=\"text\" maxlength=\"50\" size=\"25\" " + adselectedstate + " name=\"userpropvalue" + (i + 1) + "\" id=\"userpropvalue" + (i + 1) + "\" value=\"" + mapping_data[i].AdName + "\">"); result.Append("</td>"); result.Append("</tr>"); } mapping_list.Text = result.ToString(); result = null; } adminGroupMap.InnerHtml = m_refMsg.GetMessage("cms admin group map"); adGroupName.InnerHtml = m_refMsg.GetMessage("AD Group Name"); adDomain.InnerHtml = m_refMsg.GetMessage("AD Domain"); admingroupname.Value = cGroup.GroupName; admingroupdomain.Value = cGroup.GroupDomain; drp_LDAPtype.Items.Add(new ListItem(m_refMsg.GetMessage("LDAP AD"), "AD")); drp_LDAPtype.Items.Add(new ListItem(m_refMsg.GetMessage("LDAP NO"), "NO")); drp_LDAPtype.Items.Add(new ListItem(m_refMsg.GetMessage("LDAP SU"), "SU")); drp_LDAPtype.Items.Add(new ListItem(m_refMsg.GetMessage("LDAP OT"), "OT")); drp_LDAPtype.Attributes.Add("onchange", "javascript:CheckLDAP(\'\', true);"); if (setting_data.ADAuthentication == 2) { if (setting_data.ADDomainName.IndexOf("</p>") + 1 > 0) //defect 17813 - SMK { setting_data.ADDomainName = setting_data.ADDomainName.Replace("<", "<"); setting_data.ADDomainName = setting_data.ADDomainName.Replace(">", ">"); setting_data.ADDomainName = setting_data.ADDomainName.Replace(""", "\""); setting_data.ADDomainName = setting_data.ADDomainName.Replace("'", "\'"); } LDAPSettingsData ldapsettings; ldapsettings = Ektron.Cms.Common.EkFunctions.GetLDAPSettings(setting_data.ADDomainName); /* From VB source arrDomain = Split(setting_data.ADDomainName, "</server>") arrServer = Split(arrDomain(0), "</p>") */ string tempDomainName = setting_data.ADDomainName; tempDomainName = tempDomainName.Replace("</server>", "|").Replace("</p>", "^"); arrDomain = tempDomainName.Split("|".ToCharArray()); arrServer = arrDomain[0].ToString().Split("^".ToCharArray()); ServerText.Value = ldapsettings.Server; PortText.Value = ldapsettings.Port.ToString(); LDAPjs.Text += "<script language=\"javascript\" type=\"text/javascript\">" + Environment.NewLine; drp_LDAPtype.SelectedIndex = ldapsettings.ServerType.GetHashCode(); LDAPjs.Text += " CheckLDAP(\'" + drp_LDAPtype.Items[drp_LDAPtype.SelectedIndex].Value + "\', false);" + Environment.NewLine; LDAP_SSL.Checked = ldapsettings.EncryptionType == Ektron.Cms.Common.EkEnumeration.LDAPEncryptionType.SSL; txtLDAPAttribute.Text = ldapsettings.Attribute; if ((arrServer.Length - 1) > 1) { // arrLDAPDomain = Split(arrServer(2), ",") VB Source arrLDAPDomain = arrServer[2].Split(','); for (arrCount = 0; arrCount <= (arrLDAPDomain.Length - 1); arrCount++) { arrLDAPDomainElement = arrLDAPDomain.GetValue(arrCount).ToString().Split('='); if (arrLDAPDomainElement[0] == "dc") { if (!(strLDAPDomain == "")) { strLDAPDomain += "."; } strLDAPDomain += arrLDAPDomainElement[1]; } } LDAPDomainText.Value = strLDAPDomain; } arrOrg2 = arrDomain[1].Split(new string[] {"</>"}, StringSplitOptions.None); for (arrCount2 = 0; arrCount2 <= (arrOrg2.Length - 1); arrCount2++) { //Response.Write(arrOrg2(arrCount2) & "<br/>") if (!(arrOrg2.GetValue(arrCount2).ToString() == "")) { arrOrg = arrOrg2.GetValue(arrCount2).ToString().Split(','); for (arrCount = 0; arrCount <= (arrOrg.Length - 1); arrCount++) { if (!(arrOrg.GetValue(arrCount).ToString() == "")) { //arrItem = Strings.Split(arrOrg(arrCount), "=", -1, 0); arrItem = arrOrg.GetValue(arrCount).ToString().Split('='); if ((arrItem[0].Trim() == "o") && arrCount2 == (arrOrg2.Length - 1)) { OrgText.Value = arrItem.GetValue(1).ToString(); //ElseIf (arrItem(0) = "ou" Or arrItem(0) = " ou") Then // If (Not first) Then // OrgUnitText.Value &= "," // End If // OrgUnitText.Value &= "ou=" & arrItem(1) // isUnit = True // first = False } else { if (! first) { OrgUnitText.Value += ","; } OrgUnitText.Value += arrOrg.GetValue(arrCount); isUnit = true; first = false; } } } if (isUnit) { OrgUnitText.Value += "</>"; isUnit = false; first = true; } } } } if (domain_data == null) { searchLink.InnerHtml = "<a href=\"#\" OnClick=\"javascript:alert(\'" + m_refMsg.GetMessage("javascript: alert cannot search no domains") + "\\n" + m_refMsg.GetMessage("generic check ad config msg") + "\'); return false;\">" + m_refMsg.GetMessage("generic Search") + "</a>"; } else if (domain_data.Length == 0) { searchLink.InnerHtml = "<a href=\"#\" OnClick=\"javascript:alert(\'" + m_refMsg.GetMessage("javascript: alert cannot search no domains") + "\\n" + m_refMsg.GetMessage("generic check ad config msg") + "\'); return false;\">" + m_refMsg.GetMessage("generic Search") + "</a>"; } else { searchLink.InnerHtml = "<a href=\"#\" OnClick=\"javascript:DoSearch();\">" + m_refMsg.GetMessage("generic Search") + "</a>"; } domain.InnerHtml = m_refMsg.GetMessage("domain title") + ":"; result = new System.Text.StringBuilder(); result.Append(" "); if (domain_data == null && !m_refUserApi.RequestInformationRef.ADAdvancedConfig) { string selected = ""; result.Append("<select " + adselectedstate + " name=\"domainname\" id=\"domainname\">"); if (setting_data.ADDomainName == "") { selected = " selected"; } // Keep the "All Domains" drop down for continuity result.Append("<option value=\"\" " + selected + ">" + m_refMsg.GetMessage("all domain select caption") + "</option>"); result.Append("</select>"); } else if ((domain_data == null && m_refUserApi.RequestInformationRef.ADAdvancedConfig) || domain_data.Length == 0) { result.Append("<font color=\"red\"><strong>" + m_refMsg.GetMessage("generic no domains found") + " " + m_refMsg.GetMessage("generic check ad config msg") + "</strong></font>"); } else { if (m_refUserApi.RequestInformationRef.ADAdvancedConfig) { for (i = 0; i <= domain_data.Length - 1; i++) { if (i > 0) result.Append(" "); result.Append(domain_data[i].Name).Append("<br/>"); } } else { string selected = ""; result.Append("<select " + adselectedstate + " name=\"domainname\" id=\"domainname\">"); if (setting_data.ADDomainName == "") { selected = " selected"; } result.Append("<option value=\"\" " + selected + ">" + m_refMsg.GetMessage("all domain select caption") + "</option>"); for (i = 0; i <= domain_data.Length - 1; i++) { if (domain_data[i].Name == setting_data.ADDomainName) { selected = " selected"; } else { selected = ""; } result.Append("<option value=\"" + domain_data[i].Name + "\"" + selected + ">" + domain_data[i].Name + "</option>"); } result.Append("</select>"); } } domainDropdown.InnerHtml = result.ToString(); return false; }
/// <summary> /// 获得远程服务器用户信息 /// </summary> /// <param name="sessionKey"></param> /// <returns></returns> private static Entity GetRemoteUser(string sessionKey) { //调用接口获取登录用户信息 UserAPI userAPI = new UserAPI(); ApiResponse arGetMember = userAPI.GetUser(SessionKey); if (!arGetMember.ApiSucc)//接口调用异常 { //记录日志 string code = Logger.Error(new Exception(arGetMember.ApiMessage), "接口调用异常"); return null; } if (!arGetMember.ActSucc) { return null; } Entity oUser = (Entity)arGetMember.GetData("user"); return oUser; }