public void BindSettings(UserSettings settings)
        {
            BindRetentionPolicy();


            string[] types = Enum.GetNames(typeof(ExchangeRetentionPolicyTagType));

            ddTagType.Items.Clear();
            for (int i = 0; i < types.Length; i++)
            {
                string name = GetSharedLocalizedString("Text." +types[i]);
                ddTagType.Items.Add(new ListItem(name, i.ToString()));
            }

            string[] action = Enum.GetNames(typeof(ExchangeRetentionPolicyTagAction));

            ddRetentionAction.Items.Clear();
            for (int i = 0; i < action.Length; i++)
            {
                string name = GetSharedLocalizedString("Text."+action[i]);
                ddRetentionAction.Items.Add(new ListItem(name, i.ToString()));
            }

            txtStatus.Visible = false;
        }
        public void BindSettings(UserSettings settings)
        {
            secMailboxPlan.Text = RetentionPolicy ? GetLocalizedString("secRetentionPolicy.Text") : GetLocalizedString("secMailboxPlan.Text");

            BindMailboxPlans();
            
            txtStatus.Visible = false;

            secMailboxFeatures.Visible = !RetentionPolicy;
            secMailboxGeneral.Visible = !RetentionPolicy;
            secStorageQuotas.Visible = !RetentionPolicy;
            secDeleteRetention.Visible = !RetentionPolicy;
            secLitigationHold.Visible = !RetentionPolicy;

            secArchiving.Visible = !RetentionPolicy;
            secRetentionPolicyTags.Visible = RetentionPolicy;

            gvMailboxPlans.Columns[4].Visible = !RetentionPolicy;
            gvMailboxPlans.Columns[5].Visible = !RetentionPolicy;

            btnAddMailboxPlan.ValidationGroup = MainValidationGroup;
            btnUpdateMailboxPlan.ValidationGroup = MainValidationGroup;
            valRequireMailboxPlan.ValidationGroup = MainValidationGroup;

            UpdateTags();

        }
        public void SaveSettings(UserSettings settings)
        {
            settings["MailboxPasswordPolicy"] = mailboxPasswordPolicy.Value;
            settings["OrgIdPolicy"] = orgIdPolicy.Value;
            settings["OrgPolicy"] = orgPolicy.Value;

            if (Utils.ParseBool(orgPolicy.Value, false))
            {
                List<AdditionalGroup> newAdditionalGroups = orgPolicy.GetGridViewGroups();
 
                foreach (AdditionalGroup oldGroup in additionalGroups)
                {
                    AdditionalGroup upGroup = newAdditionalGroups.Where(x => x.GroupId == oldGroup.GroupId).FirstOrDefault();

                    if(upGroup != null && upGroup.GroupName != oldGroup.GroupName)
                    {
                        ES.Services.Organizations.UpdateAdditionalGroup(oldGroup.GroupId, upGroup.GroupName);

                        newAdditionalGroups.Remove(upGroup);
                    }
                    else
                    {
                        ES.Services.Organizations.DeleteAdditionalGroup(oldGroup.GroupId);
                    }
                }

                foreach (AdditionalGroup newGroup in newAdditionalGroups)
                {
                    ES.Services.Organizations.AddAdditionalGroup(settings.UserId, newGroup.GroupName);
                }
            }
        }
 public void SaveSettings(UserSettings settings)
 {
     settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE] = ddTimeout.SelectedValue;
     settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_ADMINISTRATORS] = cbTimeoutAdministrators.Checked.ToString();
     settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_USERS] = cbTimeoutUsers.Checked.ToString();
     settings[RdsServerSettings.REMOVE_RUN_COMMAND_ADMINISTRATORS] = cbRunCommandAdministrators.Checked.ToString();
     settings[RdsServerSettings.REMOVE_RUN_COMMAND_USERS] = cbRunCommandUsers.Checked.ToString();
     settings[RdsServerSettings.REMOVE_POWERSHELL_COMMAND_ADMINISTRATORS] = cbPowershellAdministrators.Checked.ToString();
     settings[RdsServerSettings.REMOVE_POWERSHELL_COMMAND_USERS] = cbPowershellUsers.Checked.ToString();
     settings[RdsServerSettings.HIDE_C_DRIVE_ADMINISTRATORS] = cbHideCDriveAdministrators.Checked.ToString();
     settings[RdsServerSettings.HIDE_C_DRIVE_USERS] = cbHideCDriveUsers.Checked.ToString();
     settings[RdsServerSettings.REMOVE_SHUTDOWN_RESTART_ADMINISTRATORS] = cbShutdownAdministrators.Checked.ToString();
     settings[RdsServerSettings.REMOVE_SHUTDOWN_RESTART_USERS] = cbShutdownUsers.Checked.ToString();
     settings[RdsServerSettings.DISABLE_TASK_MANAGER_ADMINISTRATORS] = cbTaskManagerAdministrators.Checked.ToString();
     settings[RdsServerSettings.DISABLE_TASK_MANAGER_USERS] = cbTaskManagerUsers.Checked.ToString();
     settings[RdsServerSettings.CHANGE_DESKTOP_DISABLED_ADMINISTRATORS] = cbDesktopAdministrators.Checked.ToString();
     settings[RdsServerSettings.CHANGE_DESKTOP_DISABLED_USERS] = cbDesktopUsers.Checked.ToString();
     settings[RdsServerSettings.SCREEN_SAVER_DISABLED_ADMINISTRATORS] = cbScreenSaverAdministrators.Checked.ToString();
     settings[RdsServerSettings.SCREEN_SAVER_DISABLED_USERS] = cbScreenSaverUsers.Checked.ToString();
     settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE] = ddTreshold.SelectedValue;
     settings[RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION_ADMINISTRATORS] = cbViewSessionAdministrators.Checked.ToString();
     settings[RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION_Users] = cbViewSessionUsers.Checked.ToString();
     settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_ADMINISTRATORS] = cbControlSessionAdministrators.Checked.ToString();
     settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_Users] = cbControlSessionUsers.Checked.ToString();
     settings[RdsServerSettings.DISABLE_CMD_ADMINISTRATORS] = cbDisableCmdAdministrators.Checked.ToString();
     settings[RdsServerSettings.DISABLE_CMD_USERS] = cbDisableCmdUsers.Checked.ToString();            
 }
        public void BindSettings(UserSettings settings)
        {
            // parking page
            chkAddParkingPage.Checked = Utils.ParseBool(settings["AddParkingPage"], false);
            txtPageName.Text = settings["ParkingPageName"];
            txtPageContent.Text = settings["ParkingPageContent"];
			PublishingProfileTextBox.Text = settings["PublishingProfile"];
            chkEnableParkingPageTokens.Checked = Utils.ParseBool(settings["EnableParkingPageTokens"], false);

            // HostName
            txtHostName.Text = settings["HostName"];

            // default documents
            if (!String.IsNullOrEmpty(settings["DefaultDocuments"]))
                txtDefaultDocs.Text = String.Join("\n", settings["DefaultDocuments"].Split(',', ';'));

            // general settings
            chkWrite.Checked = Utils.ParseBool(settings["EnableWritePermissions"], false);
            chkDirectoryBrowsing.Checked = Utils.ParseBool(settings["EnableDirectoryBrowsing"], false);
            chkParentPaths.Checked = Utils.ParseBool(settings["EnableParentPaths"], false);
            chkDedicatedPool.Checked = Utils.ParseBool(settings["EnableDedicatedPool"], false);

            chkAuthAnonymous.Checked = Utils.ParseBool(settings["EnableAnonymousAccess"], false);
            chkAuthWindows.Checked = Utils.ParseBool(settings["EnableWindowsAuthentication"], false);
            chkAuthBasic.Checked = Utils.ParseBool(settings["EnableBasicAuthentication"], false);

            // extensions
            chkAsp.Checked = Utils.ParseBool(settings["AspInstalled"], false);
            Utils.SelectListItem(ddlAspNet, settings["AspNetInstalled"]);
            Utils.SelectListItem(ddlPhp, settings["PhpInstalled"]);
            chkPerl.Checked = Utils.ParseBool(settings["PerlInstalled"], false);
            chkPython.Checked = Utils.ParseBool(settings["PythonInstalled"], false);
            chkCgiBin.Checked = Utils.ParseBool(settings["CgiBinInstalled"], false);
			chkCfExt.Checked = Utils.ParseBool(settings["ColdFusionInstalled"], false);
			chkVirtDir.Checked = Utils.ParseBool(settings["CreateCFVirtualDirectoriesPol"], false);

            // anonymous account policy
            anonymousUsername.Value = settings["AnonymousAccountPolicy"];

            // virtual directories
            virtDirName.Value = settings["VirtDirNamePolicy"];

            // FrontPage
            frontPageUsername.Value = settings["FrontPageAccountPolicy"];
            frontPagePassword.Value = settings["FrontPagePasswordPolicy"];

			// secured folders
			securedUserNamePolicy.Value = settings["SecuredUserNamePolicy"];
			securedUserPasswordPolicy.Value = settings["SecuredUserPasswordPolicy"];
			securedGroupNamePolicy.Value = settings["SecuredGroupNamePolicy"];

            // folders
            txtSiteRootFolder.Text = settings["WebRootFolder"];
            txtSiteLogsFolder.Text = settings["WebLogsFolder"];
            txtSiteDataFolder.Text = settings["WebDataFolder"];
            chkAddRandomDomainString.Checked = Utils.ParseBool(settings["AddRandomDomainString"], false);
        }
        public void BindSettings(UserSettings settings)
        {
            txtFrom.Text = settings["From"];
            txtCC.Text = settings["CC"];
            txtSubject.Text = settings["Subject"];
			Utils.SelectListItem(ddlPriority, settings["Priority"]);
            txtHtmlBody.Text = settings["HtmlBody"];
            txtTextBody.Text = settings["TextBody"];
        }
        public void SaveSettings(UserSettings settings)
        {
            settings["From"] = txtFrom.Text;
            settings["CC"] = txtCC.Text;
            settings["Subject"] = txtSubject.Text;
			settings["Priority"] = ddlPriority.SelectedValue;
            settings["HtmlBody"] = txtHtmlBody.Text;
            settings["TextBody"] = txtTextBody.Text;
        }
        public void BindSettings(UserSettings settings)
        {
            // users
            userNamePolicy.Value = settings["UserNamePolicy"];
            userPasswordPolicy.Value = settings["UserPasswordPolicy"];

            // groups
            groupNamePolicy.Value = settings["GroupNamePolicy"];
        }
        public void SaveSettings(UserSettings settings)
        {
            // users
            settings["UserNamePolicy"] = userNamePolicy.Value;
            settings["UserPasswordPolicy"] = userPasswordPolicy.Value;

            // groups
            settings["GroupNamePolicy"] = groupNamePolicy.Value;
        }
        public void SaveSettings(UserSettings settings)
        {
            // users
            settings["UserNamePolicy"] = userNamePolicy.Value;
            settings["UserPasswordPolicy"] = userPasswordPolicy.Value;

            // databases
            settings["DatabaseNamePolicy"] = databaseNamePolicy.Value;
        }
        public void BindSettings(UserSettings settings)
        {
            // users
            userNamePolicy.Value = settings["UserNamePolicy"];
            userPasswordPolicy.Value = settings["UserPasswordPolicy"];

            // databases
            databaseNamePolicy.Value = settings["DatabaseNamePolicy"];
        }
        public void BindSettings(UserSettings settings)
        {
            // accounts
            accountNamePolicy.Value = settings["AccountNamePolicy"];
            accountPasswordPolicy.Value = settings["AccountPasswordPolicy"];

            // general
            txtCatchAll.Text = settings["CatchAllName"];
        }
        public void SaveSettings(UserSettings settings)
        {
            // accounts
            settings["AccountNamePolicy"] = accountNamePolicy.Value;
            settings["AccountPasswordPolicy"] = accountPasswordPolicy.Value;

            // databases
            settings["CatchAllName"] = txtCatchAll.Text.Trim();
        }
        public void BindSettings(UserSettings settings)
        {
            chkEnableLetter.Checked = Utils.ParseBool(settings["EnableLetter"], false);
            txtFrom.Text = settings["From"];
            txtCC.Text = settings["CC"];
            txtSubject.Text = settings["Subject"];
			Utils.SelectListItem(ddlPriority, settings["Priority"]);
            txtHtmlBody.Text = settings["HtmlBody"];
            txtTextBody.Text = settings["TextBody"];
        }
        public void SaveSettings(UserSettings settings)
        {
            settings["EnableLetter"] = chkEnableLetter.Checked.ToString();
            settings["From"] = txtFrom.Text;
            settings["CC"] = txtCC.Text;
            settings["Subject"] = txtSubject.Text;
			settings["Priority"] = ddlPriority.SelectedValue;
            settings["HtmlBody"] = txtHtmlBody.Text;
            settings["TextBody"] = txtTextBody.Text;
        }
        public void BindSettings(UserSettings settings)
        {
            // mailbox
            mailboxPasswordPolicy.Value = settings["MailboxPasswordPolicy"];
            orgIdPolicy.Value = settings["OrgIdPolicy"];

            additionalGroups = ES.Services.Organizations.GetAdditionalGroups(settings.UserId);
            
            orgPolicy.SetAdditionalGroups(additionalGroups);
            orgPolicy.Value = settings["OrgPolicy"];
        }
        public void SaveSettings(UserSettings settings)
        {
            settings["From"] = txtFrom.Text;
            settings["Subject"] = txtSubject.Text;
            settings["Priority"] = ddlPriority.SelectedValue;
            settings["HtmlBody"] = txtHtmlBody.Text;
            settings["TextBody"] = txtTextBody.Text;
            settings["LogoUrl"] = txtLogoUrl.Text;

            settings["PasswordResetPincodeSmsBody"] = txtPasswordResetPincodeSmsBody.Text;
        }
        public void BindSettings(UserSettings settings)
        {
            txtFrom.Text = settings["From"];
            txtSubject.Text = settings["Subject"];
            Utils.SelectListItem(ddlPriority, settings["Priority"]);
            txtHtmlBody.Text = settings["HtmlBody"];
            txtTextBody.Text = settings["TextBody"];
            txtLogoUrl.Text = settings["LogoUrl"];

            txtPasswordResetPincodeSmsBody.Text = settings["PasswordResetPincodeSmsBody"];
        }
        public void SaveSettings(UserSettings settings)
        {
            // passwords
            settings["PasswordPolicy"] = passwordPolicy.Value;

            // logo
            settings["LogoImageURL"] = txtLogoImageURL.Text.Trim();

            // demo message
            settings["DemoMessage"] = txtDemoMessage.Text;
        }
        public void BindSettings(UserSettings settings)
        {
            // passwords
            passwordPolicy.Value = settings["PasswordPolicy"];

            // logo
            txtLogoImageURL.Text = settings["LogoImageURL"];

            // demo message
            txtDemoMessage.Text = settings["DemoMessage"];
        }
 public void BindSettings(UserSettings settings)
 {
     if (PanelSecurity.SelectedUser.Role == UserRole.Administrator)
         BindServiceLevels();
     
     txtStatus.Visible = false;
 
     try
     {
         //Change container title
         ((Label)this.Parent.Parent.Parent.Parent.Parent.FindControl(WebsitePanel.WebPortal.DefaultPage.MODULE_TITLE_CONTROL_ID)).Text = "Service Levels";
     }
     catch { /*to do*/ }
 }
        public void BindSettings(UserSettings settings)
        {
            var timeouts = RdsServerSettings.ScreenSaverTimeOuts;
            ddTimeout.DataSource = timeouts;
            ddTimeout.DataTextField = "Value";
            ddTimeout.DataValueField = "Key";
            ddTimeout.DataBind();

            ddTimeout.SelectedValue = settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE];
            cbTimeoutAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_ADMINISTRATORS]);
            cbTimeoutUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_USERS]);

            cbRunCommandAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_RUN_COMMAND_ADMINISTRATORS]);
            cbRunCommandUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_RUN_COMMAND_USERS]);

            cbPowershellAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_POWERSHELL_COMMAND_ADMINISTRATORS]);
            cbPowershellUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_POWERSHELL_COMMAND_USERS]);

            cbHideCDriveAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.HIDE_C_DRIVE_ADMINISTRATORS]);
            cbHideCDriveUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.HIDE_C_DRIVE_USERS]);

            cbShutdownAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_SHUTDOWN_RESTART_ADMINISTRATORS]);
            cbShutdownUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_SHUTDOWN_RESTART_USERS]);

            cbTaskManagerAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.DISABLE_TASK_MANAGER_ADMINISTRATORS]);
            cbTaskManagerUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.DISABLE_TASK_MANAGER_USERS]);

            cbDesktopAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.CHANGE_DESKTOP_DISABLED_ADMINISTRATORS]);
            cbDesktopUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.CHANGE_DESKTOP_DISABLED_USERS]);

            cbScreenSaverAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.SCREEN_SAVER_DISABLED_ADMINISTRATORS]);
            cbScreenSaverUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.SCREEN_SAVER_DISABLED_USERS]);

            cbViewSessionAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION_ADMINISTRATORS]);
            cbViewSessionUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION_Users]);
            cbControlSessionAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_ADMINISTRATORS]);
            cbControlSessionUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_Users]);

            cbDisableCmdAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.DISABLE_CMD_ADMINISTRATORS]);
            cbDisableCmdUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.DISABLE_CMD_USERS]);

            ddTreshold.SelectedValue = settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE];            
        }
Exemplo n.º 23
0
 public void SaveSettings(UserSettings settings)
 {
     // accounts
     settings["UserNamePolicy"] = userNamePolicy.Value;
     settings["UserPasswordPolicy"] = userPasswordPolicy.Value;
 }
Exemplo n.º 24
0
 public void BindSettings(UserSettings settings)
 {
     // accounts
     userNamePolicy.Value = settings["UserNamePolicy"];
     userPasswordPolicy.Value = settings["UserPasswordPolicy"];
 }
Exemplo n.º 25
0
        public int CreateUserAccountInternal(int parentPackageId, string username, string password,
                                             int roleId, string firstName, string lastName, string email, string secondaryEmail, bool htmlMail,
                                             bool sendAccountLetter,
                                             bool createPackage, int planId, bool sendPackageLetter,
                                             string domainName, bool tempDomain, bool createWebSite,
                                             bool createFtpAccount, string ftpAccountName, bool createMailAccount, string hostName, bool createZoneRecord)
        {
            // check account
            int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive
                                                            | DemandAccount.IsReseller);

            if (accountCheck < 0)
            {
                return(accountCheck);
            }

            // check package
            int packageCheck = SecurityContext.CheckPackage(parentPackageId, DemandPackage.IsActive);

            if (packageCheck < 0)
            {
                return(packageCheck);
            }

            // check if username exists
            if (UserController.UserExists(username))
            {
                return(BusinessErrorCodes.ERROR_ACCOUNT_WIZARD_USER_EXISTS);
            }

            // check if domain exists
            int checkDomainResult = ServerController.CheckDomain(domainName);

            if (checkDomainResult < 0)
            {
                return(checkDomainResult);
            }

            // check if FTP account exists
            if (String.IsNullOrEmpty(ftpAccountName))
            {
                ftpAccountName = username;
            }

            if (FtpServerController.FtpAccountExists(ftpAccountName))
            {
                return(BusinessErrorCodes.ERROR_ACCOUNT_WIZARD_FTP_ACCOUNT_EXISTS);
            }

            // load parent package
            PackageInfo parentPackage = PackageController.GetPackage(parentPackageId);

            /********************************************
             *  CREATE USER ACCOUNT
             * *****************************************/
            UserInfo user = new UserInfo();

            user.RoleId   = roleId;
            user.StatusId = (int)UserStatus.Active;
            user.OwnerId  = parentPackage.UserId;
            user.IsDemo   = false;
            user.IsPeer   = false;

            // account info
            user.FirstName      = firstName;
            user.LastName       = lastName;
            user.Email          = email;
            user.SecondaryEmail = secondaryEmail;
            user.Username       = username;
//            user.Password = password;
            user.HtmlMail = htmlMail;

            // add a new user
            createdUserId = UserController.AddUser(user, false, password);
            if (createdUserId < 0)
            {
                // exit
                return(createdUserId);
            }
            userCreated = true;

            // create package
            // load hosting plan
            createdPackageId = -1;
            if (createPackage)
            {
                try
                {
                    HostingPlanInfo plan = PackageController.GetHostingPlan(planId);

                    PackageResult packageResult = PackageController.AddPackage(
                        createdUserId, planId, plan.PlanName, "", (int)PackageStatus.Active, DateTime.Now, false);
                    createdPackageId = packageResult.Result;
                }
                catch (Exception ex)
                {
                    // error while adding package

                    // remove user account
                    UserController.DeleteUser(createdUserId);

                    throw ex;
                }

                if (createdPackageId < 0)
                {
                    // rollback wizard
                    Rollback();

                    // return code
                    return(createdPackageId);
                }

                // create domain
                int domainId = 0;
                if ((createWebSite || createMailAccount || createZoneRecord) && !String.IsNullOrEmpty(domainName))
                {
                    try
                    {
                        DomainInfo domain = new DomainInfo();
                        domain.PackageId      = createdPackageId;
                        domain.DomainName     = domainName;
                        domain.HostingAllowed = false;
                        domainId = ServerController.AddDomain(domain, false, false);
                        if (domainId < 0)
                        {
                            // rollback wizard
                            Rollback();

                            // return
                            return(domainId);
                        }
                    }
                    catch (Exception ex)
                    {
                        // rollback wizard
                        Rollback();

                        // error while adding domain
                        throw new Exception("Could not add domain", ex);
                    }
                }

                if (createWebSite && (domainId > 0))
                {
                    // create web site
                    try
                    {
                        int webSiteId = WebServerController.AddWebSite(
                            createdPackageId, hostName, domainId, 0, true, false);
                        if (webSiteId < 0)
                        {
                            // rollback wizard
                            Rollback();

                            // return
                            return(webSiteId);
                        }
                    }
                    catch (Exception ex)
                    {
                        // rollback wizard
                        Rollback();

                        // error while creating web site
                        throw new Exception("Could not create web site", ex);
                    }
                }

                // create FTP account
                if (createFtpAccount)
                {
                    try
                    {
                        FtpAccount ftpAccount = new FtpAccount();
                        ftpAccount.PackageId = createdPackageId;
                        ftpAccount.Name      = ftpAccountName;
                        ftpAccount.Password  = password;
                        ftpAccount.Folder    = "\\";
                        ftpAccount.CanRead   = true;
                        ftpAccount.CanWrite  = true;

                        int ftpAccountId = FtpServerController.AddFtpAccount(ftpAccount);
                        if (ftpAccountId < 0)
                        {
                            // rollback wizard
                            Rollback();

                            // return
                            return(ftpAccountId);
                        }
                    }
                    catch (Exception ex)
                    {
                        // rollback wizard
                        Rollback();

                        // error while creating ftp account
                        throw new Exception("Could not create FTP account", ex);
                    }
                }

                if (createMailAccount && (domainId > 0))
                {
                    // create default mailbox
                    try
                    {
                        // load mail policy
                        UserSettings settings     = UserController.GetUserSettings(createdUserId, UserSettings.MAIL_POLICY);
                        string       catchAllName = !String.IsNullOrEmpty(settings["CatchAllName"])
                            ? settings["CatchAllName"] : "mail";

                        MailAccount mailbox = new MailAccount();
                        mailbox.Name      = catchAllName + "@" + domainName;
                        mailbox.PackageId = createdPackageId;

                        // gather information from the form
                        mailbox.Enabled = true;

                        mailbox.ResponderEnabled = false;
                        mailbox.ReplyTo          = "";
                        mailbox.ResponderSubject = "";
                        mailbox.ResponderMessage = "";

                        // password
                        mailbox.Password = password;

                        // redirection
                        mailbox.ForwardingAddresses = new string[] { };
                        mailbox.DeleteOnForward     = false;
                        mailbox.MaxMailboxSize      = 0;

                        int mailAccountId = MailServerController.AddMailAccount(mailbox);

                        if (mailAccountId < 0)
                        {
                            // rollback wizard
                            Rollback();

                            // return
                            return(mailAccountId);
                        }

                        // set catch-all account
                        MailDomain mailDomain = MailServerController.GetMailDomain(createdPackageId, domainName);
                        mailDomain.CatchAllAccount   = "mail";
                        mailDomain.PostmasterAccount = "mail";
                        mailDomain.AbuseAccount      = "mail";
                        MailServerController.UpdateMailDomain(mailDomain);

                        int mailDomainId = mailDomain.Id;
                    }
                    catch (Exception ex)
                    {
                        // rollback wizard
                        Rollback();

                        // error while creating mail account
                        throw new Exception("Could not create mail account", ex);
                    }
                }

                // Instant Alias / Temporary URL
                if (tempDomain && (domainId > 0))
                {
                    int instantAliasId = ServerController.CreateDomainInstantAlias("", domainId);
                    if (instantAliasId < 0)
                    {
                        // rollback wizard
                        Rollback();

                        return(instantAliasId);
                    }
                }

                // Domain DNS Zone
                if (createZoneRecord && (domainId > 0))
                {
                    ServerController.EnableDomainDns(domainId);
                }
            }

            // send welcome letters
            if (sendAccountLetter)
            {
                int result = PackageController.SendAccountSummaryLetter(createdUserId, null, null, true);
                if (result < 0)
                {
                    // rollback wizard
                    Rollback();

                    // return
                    return(result);
                }
            }

            if (createPackage && sendPackageLetter)
            {
                int result = PackageController.SendPackageSummaryLetter(createdPackageId, null, null, true);
                if (result < 0)
                {
                    // rollback wizard
                    Rollback();

                    // return
                    return(result);
                }
            }

            return(createdUserId);
        }
 public void SaveSettings(UserSettings settings)
 {
     settings["ExchangeMailboxPlansPolicy"] = "";
 }
Exemplo n.º 27
0
 public int UpdateUserSettings(UserSettings settings)
 {
     return(UserController.UpdateUserSettings(settings));
 }
        public void BindSettings(UserSettings settings)
        {
            // mailbox
			mailboxPasswordPolicy.Value = settings["MailboxPasswordPolicy"];
        }
Exemplo n.º 29
0
 public int UpdateUserSettings(UserSettings settings)
 {
     return UserController.UpdateUserSettings(settings);
 }
Exemplo n.º 30
0
 public static void SetDisplayItemsPerPage(int itemsNumber)
 {
     UserSettings settings = new UserSettings();
     settings.UserId = PanelSecurity.SelectedUserId;
     settings.SettingsName = UserSettings.DISPLAY_PREFS;
     settings[UserSettings.GRID_ITEMS] = itemsNumber.ToString();
     int res =  ES.Services.Users.UpdateUserSettings(settings);
     
     HttpContext.Current.Session[ITEMS_PER_PAGE_SESSION] = itemsNumber;
 }
Exemplo n.º 31
0
        private static string GetWebSiteUsername(UserSettings webPolicy, string domainName)
        {
            UsernamePolicy policy = new UsernamePolicy(webPolicy["AnonymousAccountPolicy"]);

            // remove dots from the domain
            domainName = Regex.Replace(domainName, "\\W+", "", RegexOptions.Compiled);

            if (!policy.Enabled)
            {
                // default algorythm
                int maxLength = MAX_ACCOUNT_LENGTH - ANON_ACCOUNT_SUFFIX.Length - 2;
                string username = (domainName.Length > maxLength) ? domainName.Substring(0, maxLength) : domainName;
                return (username + ANON_ACCOUNT_SUFFIX); // suffix
            }
            else
            {
                // policy-enabled
                // use prefix and suffix only

                // adjust maximum length
                int maxLength = MAX_ACCOUNT_LENGTH - 2; // 2 symbols for number
                if (policy.Prefix != null)
                    maxLength -= policy.Prefix.Length;

                if (policy.Suffix != null)
                    maxLength -= policy.Suffix.Length;

                string username = (domainName.Length > maxLength) ? domainName.Substring(0, maxLength) : domainName;
                return ((policy.Prefix != null) ? policy.Prefix : "")
                    + username
                    + ((policy.Suffix != null) ? policy.Suffix : "");
            }
        }
Exemplo n.º 32
0
        public static int SendPasswordReminder(string username, string ip)
        {
            // place log record
            TaskManager.StartTask("USER", "SEND_REMINDER", username);
            TaskManager.WriteParameter("IP", ip);

            try
            {
                // try to get user from database
                UserInfo user = GetUserInternally(username);
                if (user == null)
                {
                    TaskManager.WriteWarning("Account not found");
                    // Fix for item #273 (NGS-9)
                    //return BusinessErrorCodes.ERROR_USER_NOT_FOUND;
                    return(0);
                }

                UserSettings settings = UserController.GetUserSettings(user.UserId, UserSettings.PASSWORD_REMINDER_LETTER);
                string       from     = settings["From"];
                string       cc       = settings["CC"];
                string       subject  = settings["Subject"];
                string       body     = user.HtmlMail ? settings["HtmlBody"] : settings["TextBody"];
                bool         isHtml   = user.HtmlMail;

                MailPriority priority = MailPriority.Normal;
                if (!String.IsNullOrEmpty(settings["Priority"]))
                {
                    priority = (MailPriority)Enum.Parse(typeof(MailPriority), settings["Priority"], true);
                }

                if (body == null || body == "")
                {
                    return(BusinessErrorCodes.ERROR_SETTINGS_PASSWORD_LETTER_EMPTY_BODY);
                }

                // set template context items
                Hashtable items = new Hashtable();
                items["user"]  = user;
                items["Email"] = true;

                // get reseller details
                UserInfo reseller = UserController.GetUser(user.OwnerId);
                if (reseller != null)
                {
                    reseller.Password = "";
                    items["reseller"] = reseller;
                }

                subject = PackageController.EvaluateTemplate(subject, items);
                body    = PackageController.EvaluateTemplate(body, items);

                // send message
                MailHelper.SendMessage(from, user.Email, cc, subject, body, priority, isHtml);

                return(0);
            }
            catch (Exception ex)
            {
                throw TaskManager.WriteError(ex);
            }
            finally
            {
                TaskManager.CompleteTask();
            }
        }
        public void SaveSettings(UserSettings settings)
        {
			// mailbox
			settings["MailboxPasswordPolicy"] = mailboxPasswordPolicy.Value;
        }
        private static MailTemplate EvaluateOrganizationSummaryTemplate(ExchangeOrganization org)
        {
            #region create template context
            Hashtable items = new Hashtable();

            // add organization
            items["org"] = org;

            // add package information
            PackageInfo space = PackageController.GetPackage(org.PackageId);
            items["space"] = space;

            // add user information
            UserInfo user = UserController.GetUser(space.UserId);
            items["user"] = user;
            #endregion

            #region load template
            // load template settings
            UserSettings settings = UserController.GetUserSettings(user.UserId, UserSettings.EXCHANGE_HOSTED_EDITION_ORGANIZATION_SUMMARY);
            if (settings == null)
            {
                return(null);
            }

            // create template
            MailTemplate template = new MailTemplate();

            // from
            template.From = settings["From"];

            // BCC
            template.Bcc = settings["CC"];

            // subject
            template.Subject = settings["Subject"];

            // body
            template.IsHtml = user.HtmlMail;
            string bodySetting = template.IsHtml ? "HtmlBody" : "TextBody";
            template.Body = settings[bodySetting];

            // priority
            string priority = settings["Priority"];
            template.Priority = String.IsNullOrEmpty(priority)
                ? MailPriority.Normal
                : (MailPriority)Enum.Parse(typeof(MailPriority), priority, true);
            #endregion

            #region evaluate template
            if (template.Subject != null)
            {
                template.Subject = PackageController.EvaluateTemplate(template.Subject, items);
            }

            if (template.Body != null)
            {
                template.Body = PackageController.EvaluateTemplate(template.Body, items);
            }
            #endregion

            return(template);
        }