Esempio n. 1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Check if the user is authorized
            if (!(PortalSecurity.HasApprovePermissions(ModuleID)))
            {
                PortalSecurity.AccessDeniedEdit();
            }

            // Fill email form with default
            if (!IsPostBack)
            {
                // Destinators
                ModuleSettings ms = null;
                for (int i = 0; i < portalSettings.ActiveTab.Modules.Count; i++)
                {
                    ms = (ModuleSettings)portalSettings.ActiveTab.Modules[i];
                    if (ms.ModuleID == ModuleID)
                    {
                        break;
                    }
                }
                string tmp = ms.AuthorizedAddRoles.Trim();
                tmp += ms.AuthorizedEditRoles.Trim();
                tmp += ms.AuthorizedDeleteRoles.Trim();
                string[] emails = MailHelper.GetEmailAddressesInRoles(tmp.Split(";".ToCharArray()), portalSettings.PortalID);
                for (int i = 0; i < emails.Length; i++)
                {
                    emailForm.To.Add(emails[i]);
                }
                // Subject
                emailForm.Subject = Esperantus.Localize.GetString("SWI_REJECT_SUBJECT1", "The new content of ") + "'" + ms.ModuleTitle + "'" + Localize.GetString("SWI_REJECT_SUBJECT2", " has been rejected");
                // Message
                emailForm.HtmlBodyText = Esperantus.Localize.GetString("SWI_REJECT_BODY", "You can find the rejected content at:") + "<br><br><a href='" + UrlReferrer + "'>" + UrlReferrer + "</a>";
            }
        }
 protected override void LoadSettings()
 {
     if (PortalSecurity.HasEditPermissions(this.portalSettings.ActiveModule) == false)
     {
         PortalSecurity.AccessDeniedEdit();
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Handles OnUpdate event
 /// </summary>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 protected override void OnUpdate(EventArgs e)
 {
     // Verify that the current user has access to add in this module
     if (PortalSecurity.HasPropertiesPermissions(ModuleID) == false)
     {
         // Removed by Mario Endara <*****@*****.**> (2004/11/04)
         //				&& PortalSecurity.IsInRoles("Admins") == false)
         PortalSecurity.AccessDeniedEdit();
     }
     base.OnUpdate(e);
 }
Esempio n. 4
0
 /// <summary>
 /// Load settings
 /// </summary>
 protected override void LoadSettings()
 {
     // Verify that the current user has access to edit this module
     // Removed by Mario Endara <*****@*****.**> (2004/11/04)
     //			if (PortalSecurity.HasAddPermissions(ModuleID) == false && PortalSecurity.IsInRoles("Admins") == false)
     if (PortalSecurity.HasAddPermissions(ModuleID) == false)
     {
         PortalSecurity.AccessDeniedEdit();
     }
     base.LoadSettings();
 }
Esempio n. 5
0
        /// <summary>
        /// Load settings
        /// </summary>
        protected override void LoadSettings()
        {
            // Verify that the current user has access to edit this module
            // Removed by Mario Endara <*****@*****.**> (2004/11/04)
            // if (PortalSecurity.HasEditPermissions(ModuleID) == false && PortalSecurity.IsInRoles("Admins") == false)
            if (PortalSecurity.HasEditPermissions(this.ModuleID) == false && (!UserProfile.HasEditThisPageAccess()) && (!UserProfile.CurrentUser.HasPermission(AccessPermissions.MODULE_HTML_CONTENT_EDITING)))
            {
                PortalSecurity.AccessDeniedEdit();
            }

            base.LoadSettings();
        }
Esempio n. 6
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!EditMode && !bool.Parse(portalSettings.CustomSettings["SITESETTINGS_ALLOW_NEW_REGISTRATION"].ToString()))
            {
                PortalSecurity.AccessDeniedEdit();
            }

            Control myControl = GetCurrentProfileControl();

            EditControl = ((IEditUserProfile)myControl);
            EditControl.RedirectPage = Rainbow.HttpUrlBuilder.BuildUrl(TabID);

            register.Controls.Add(myControl);
        }
Esempio n. 7
0
        /// <summary>
        /// Load settings
        /// </summary>
        protected override void LoadSettings()
        {
            int modId = this.PortalSettings.ActiveModule;

            if (modId < 1)
            {
                modId = getModId();
            }

            if (PortalSecurity.HasEditPermissions(modId) == false)
            {
                PortalSecurity.AccessDeniedEdit();
            }
        }
        /// <summary>
        /// Handles OnDelete event at Page level<br/>
        /// Performs OnDelete actions that are common to all Pages<br/>
        /// Can be overridden
        /// </summary>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected virtual void OnDelete(EventArgs e)
        {
            if (Delete != null)
            {
                Delete(this, e);   //Invokes the delegates
            }
            //Flush cache
            OnFlushCache();

            // Verify that the current user has access to delete in this module
            if (PortalSecurity.HasDeletePermissions(ModuleID) == false)
            {
                PortalSecurity.AccessDeniedEdit();
            }

            // any other code goes here
        }
        /// <summary>
        /// Handles OnUpdate event at Page level<br/>
        /// Performs OnUpdate actions that are common to all Pages<br/>
        /// Can be overridden
        /// </summary>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected virtual void OnUpdate(EventArgs e)
        {
            if (Update != null)
            {
                Update(this, e);   //Invokes the delegates
            }
            //Flush cache
            OnFlushCache();

            // Verify that the current user has access to edit this module
            // June 23, 2003: Mark McFarlane made change to check for both Add AND Edit permissions
            // Since UI.Page.EditPage and UI.Page.AddPage both inherit from this UI.Page class
            if (PortalSecurity.HasEditPermissions(ModuleID) == false &&
                PortalSecurity.HasAddPermissions(ModuleID) == false)
            {
                PortalSecurity.AccessDeniedEdit();
            }

            // any other code goes here
        }
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            // Check if the user is authorized
            if (!(PortalSecurity.HasAddPermissions(ModuleID) ||
                  PortalSecurity.HasEditPermissions(ModuleID) ||
                  PortalSecurity.HasDeletePermissions(ModuleID)))
            {
                PortalSecurity.AccessDeniedEdit();
            }

            // Fill email form with default
            if (!IsPostBack)
            {
                // Destinators
                ModuleSettings ms = null;
                for (int i = 0; i < portalSettings.ActivePage.Modules.Count; i++)
                {
                    ms = (ModuleSettings)portalSettings.ActivePage.Modules[i];
                    if (ms.ModuleID == ModuleID)
                    {
                        break;
                    }
                }
                string[] emails =
                    MailHelper.GetEmailAddressesInRoles(ms.AuthorizedApproveRoles.Split(";".ToCharArray()),
                                                        portalSettings.PortalID);
                for (int i = 0; i < emails.Length; i++)
                {
                    emailForm.To.Add(emails[i]);
                }
                // Subject
                emailForm.Subject =
                    General.GetString("SWI_REQUEST_APPROVAL_SUBJECT", "Request approval of the new content of '") +
                    ms.ModuleTitle + "'";
                // Message
                emailForm.HtmlBodyText = General.GetString("SWI_REQUEST_BODY", "You can find the new content at:") +
                                         "<br><br><a href='" + UrlReferrer + "'>" + UrlReferrer + "</a>";
            }
        }
Esempio n. 11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack == false)
            {
                BindCountry();
                BindState();

                // Edit check
                if (EditMode)   // Someone requested edit this record
                {
                    //True is use is editing himself, false if is edited by an admin
                    selfEdit = (userName == PortalSettings.CurrentUser.Identity.Email);

                    // Removed by Mario Endara <*****@*****.**> (2004/11/04)
                    //					if (PortalSecurity.IsInRoles("Admins") || selfEdit)
                    if (PortalSecurity.HasEditPermissions(ModuleID) || PortalSecurity.HasAddPermissions(ModuleID) ||
                        selfEdit)
                    {
                        //We can edit

                        // Hide
                        RequiredPassword.Visible = false;
                        RequiredConfirm.Visible  = false;
                        EditPasswordRow.Visible  = true;
                        SaveChangesBtn.Visible   = true;
                        RegisterBtn.Visible      = false;

                        // Obtain a single row of event information
                        UsersDB accountSystem = new UsersDB();

                        RainbowUser memberUser = accountSystem.GetSingleUser(userName);

                        try {
                            originalUserID    = memberUser.ProviderUserKey;
                            NameField.Text    = memberUser.Name;
                            EmailField.Text   = memberUser.Email;
                            CompanyField.Text = memberUser.Company;
                            AddressField.Text = memberUser.Address;
                            ZipField.Text     = memberUser.Zip;
                            CityField.Text    = memberUser.City;

                            CountryField.ClearSelection();
                            if (CountryField.Items.FindByValue(memberUser.CountryID) != null)
                            {
                                CountryField.Items.FindByValue(memberUser.CountryID).Selected = true;
                            }
                            BindState();
                            StateField.ClearSelection();
                            if (StateField.Items.Count > 0 &&
                                StateField.Items.FindByValue(memberUser.StateID.ToString()) != null)
                            {
                                StateField.Items.FindByValue(memberUser.StateID.ToString()).Selected = true;
                            }

                            FaxField.Text          = memberUser.Fax;
                            PhoneField.Text        = memberUser.Phone;
                            SendNewsletter.Checked = memberUser.SendNewsletter;

                            //stores original password for later check
                            // originalPassword = memberUser.GetPassword();  NOT STILL SUPPORTED
                        }
                        catch (System.ArgumentNullException error) {
                            // no  existe el usuario;
                        }
                    }
                    else
                    {
                        //We do not have rights to do it!
                        PortalSecurity.AccessDeniedEdit();
                    }
                }
                else
                {
                    BindState();

                    //No edit
                    RequiredPassword.Visible = true;
                    RequiredConfirm.Visible  = true;
                    EditPasswordRow.Visible  = false;
                    SaveChangesBtn.Visible   = false;
                    RegisterBtn.Visible      = true;
                }

                string termsOfService = portalSettings.GetTermsOfService;

                //Verify if we have to show conditions
                if (termsOfService.Length != 0)
                {
                    //Shows conditions
                    FieldConditions.Text  = termsOfService;
                    ConditionsRow.Visible = true;
                }
                else
                {
                    //Hides conditions
                    ConditionsRow.Visible = false;
                }
            }
        }
Esempio n. 12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack == false)
            {
                //Remove validation for Windows users
                if (HttpContext.Current != null && Context.User is WindowsPrincipal)
                {
                    ValidEmail.Visible = false;
                    EmailLabel.TextKey = "WINDOWS_USER_NAME";
                    EmailLabel.Text    = "Windows User Name";
                }

                // TODO: Jonathan - need to bring in country functionality from esperantus or new somehow?
                BindCountry();

                // TODO: Fix this
                // More esperanuts country stuff...
                // CountryInfo country = CountryInfo.CurrentCountry;
                //if (country != null && CountryField.Items.FindByValue(country.Name) != null)
                //	CountryField.Items.FindByValue(country.Name).Selected = true;
                BindState();


                // Edit check
                if (EditMode)   // Someone requested edit this record
                {
                    //True is use is editing himself, false if is edited by an admin
                    selfEdit = (userName == PortalSettings.CurrentUser.Identity.UserName);

                    // Removed by Mario Endara <*****@*****.**> (2004/11/04)
                    //					if (PortalSecurity.IsInRoles("Admins") || selfEdit)
                    if (PortalSecurity.HasEditPermissions(ModuleID) || PortalSecurity.HasAddPermissions(ModuleID) || selfEdit)
                    {
                        //We can edit

                        // Hide
                        RequiredPassword.Visible = false;
                        RequiredConfirm.Visible  = false;
                        EditPasswordRow.Visible  = true;
                        SaveChangesBtn.Visible   = true;
                        RegisterBtn.Visible      = false;

                        // Obtain a single row of event information
                        UsersDB accountSystem = new UsersDB();

                        RainbowUser memberUser = accountSystem.GetSingleUser(userName);

                        try {
                            NameField.Text    = memberUser.Name;
                            EmailField.Text   = memberUser.Email;
                            CompanyField.Text = memberUser.Company;
                            AddressField.Text = memberUser.Address;
                            ZipField.Text     = memberUser.Zip;
                            CityField.Text    = memberUser.City;

                            CountryField.ClearSelection();
                            if (CountryField.Items.FindByValue(memberUser.CountryID) != null)
                            {
                                CountryField.Items.FindByValue(memberUser.CountryID).Selected = true;
                            }
                            BindState();
                            StateField.ClearSelection();
                            if (StateField.Items.Count > 0 &&
                                StateField.Items.FindByValue(memberUser.StateID.ToString()) != null)
                            {
                                StateField.Items.FindByValue(memberUser.StateID.ToString()).Selected = true;
                            }

                            FaxField.Text          = memberUser.Fax;
                            PhoneField.Text        = memberUser.Phone;
                            SendNewsletter.Checked = memberUser.SendNewsletter;

                            //stores original password for later check
                            originalPassword = memberUser.GetPassword();
                            originalUserID   = memberUser.ProviderUserKey;
                        }
                        catch (System.ArgumentNullException error) {
                            // user doesn't exist
                        }
                    }
                    else
                    {
                        //We do not have rights to do it!
                        PortalSecurity.AccessDeniedEdit();
                    }
                }
                else
                {
                    BindState();

                    //No edit
                    RequiredPassword.Visible = true;
                    RequiredConfirm.Visible  = true;
                    EditPasswordRow.Visible  = false;
                    SaveChangesBtn.Visible   = false;
                    RegisterBtn.Visible      = true;
                }

                string termsOfService = portalSettings.GetTermsOfService;

                //Verify if we have to show conditions
                if (termsOfService.Length != 0)
                {
                    //Shows conditions
                    FieldConditions.Text  = termsOfService;
                    ConditionsRow.Visible = true;
                }
                else
                {
                    //Hides conditions
                    ConditionsRow.Visible = false;
                }
            }
        }
Esempio n. 13
0
        /// <summary>
        /// The Page_Load server event handler on this page is used
        /// to obtain the ModuleID and ItemID of the discussion list,
        /// and to then display the message contents.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void Page_Load(object sender, System.EventArgs e)
        {
            //Translations on the buttons, it doesn't appear there is a
            //		tra:LinkButton style supported
            submitButton.Text = Esperantus.Localize.GetString("SUBMIT");
            cancelButton.Text = Esperantus.Localize.GetString("CANCEL");

            // Populate message contents if this is the first visit to the page
            if (Page.IsPostBack == false)
            {
                DiscussionDB  discuss;
                SqlDataReader dr;

                switch (GetMode())
                {
                case "REPLY":
                    if (PortalSecurity.HasAddPermissions(ModuleID) == false)
                    {
                        PortalSecurity.AccessDeniedEdit();
                    }

                    DiscussionEditInstructions.Text = Esperantus.Localize.GetString("DS_REPLYTHISMSG");

                    // Load fields for the item that we are replying to
                    discuss = new DiscussionDB();
                    dr      = discuss.GetSingleMessage(ItemID);
                    try
                    {
                        if (dr.Read())
                        {
                            // Update labels with message contents
                            Title.Text         = (string)dr["Title"];
                            Body.Text          = (string)dr["Body"];
                            CreatedByUser.Text = (string)dr["CreatedByUser"];
                            CreatedDate.Text   = string.Format("{0:d}", dr["CreatedDate"]);
                            TitleField.Text    = string.Empty;                                          // don't give users a default subject for their reply
                            // encourage them to title their response
                            // 15/7/2004 added localization by Mario Endara [email protected]
                            if (CreatedByUser.Text == "unknown")
                            {
                                CreatedByUser.Text = Esperantus.Localize.GetString("UNKNOWN", "unknown");
                            }
                        }
                    }
                    finally
                    {
                        dr.Close();
                    }
                    break;

                case "ADD":
                    if (PortalSecurity.HasAddPermissions(ModuleID) == false)
                    {
                        PortalSecurity.AccessDeniedEdit();
                    }

                    // hide the 'previous message' controls
                    OriginalMessagePanel.Visible = false;
                    break;


                case "EDIT":
                {
                    string itemUserEmail = string.Empty;
                    // hide the 'parent message' controls
                    OriginalMessagePanel.Visible    = false;
                    DiscussionEditInstructions.Text = Esperantus.Localize.GetString("EDIT");

                    // Bind the data to the control
                    // Obtain the selected item from the Discussion table
                    discuss = new DiscussionDB();
                    dr      = discuss.GetSingleMessage(ItemID);

                    try
                    {
                        // Load first row from database
                        if (dr.Read())
                        {
                            // Update edit fields with message contents
                            TitleField.Text = (string)dr["Title"];
                            BodyField.Text  = (string)dr["Body"];
                            itemUserEmail   = (string)dr["CreatedByUser"];
                            // 15/7/2004 added localization by Mario Endara [email protected]
                            if (itemUserEmail == "unknown")
                            {
                                itemUserEmail = Esperantus.Localize.GetString("UNKNOWN", "unknown");
                            }
                        }
                    }
                    finally
                    {
                        dr.Close();
                    }

                    if (DiscussionPermissions.HasEditPermissions(ModuleID, itemUserEmail) == false)
                    {
                        PortalSecurity.AccessDeniedEdit();
                    }
                }
                break;

                /* case "DELETE":
                 *      if (PortalSecurity.HasDeletePermissions(ModuleID) == false)
                 *              PortalSecurity.AccessDeniedEdit();
                 *      break;
                 */

                default:
                    // invalid mode specified
                    PortalSecurity.AccessDeniedEdit();
                    break;
                }
            }
        }
Esempio n. 14
0
        /// <summary>
        /// The on load.
        /// </summary>
        /// <param name="e">
        /// Event arguments.
        /// </param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!this.Page.IsPostBack)
            {
                // Edit check
                if (this.EditMode)
                {
                    // Someone requested edit this record
                    // True is use is editing himself, false if is edited by an admin
                    this.SelfEdit = this.UserName == PortalSettings.CurrentUser.Identity.UserName;

                    // Removed by Mario Endara <*****@*****.**> (2004/11/04)
                    // if (PortalSecurity.IsInRoles("Admins") || selfEdit)
                    if (PortalSecurity.HasEditPermissions(this.ModuleID) ||
                        PortalSecurity.HasAddPermissions(this.ModuleID) || this.SelfEdit)
                    {
                        // We can edit

                        // Hide
                        this.RequiredPassword.Visible = false;
                        this.RequiredConfirm.Visible  = false;
                        this.EditPasswordRow.Visible  = true;
                        this.SaveChangesBtn.Visible   = true;
                        this.RegisterBtn.Visible      = false;

                        // Obtain a single row of event information
                        var accountSystem = new UsersDB();

                        var memberUser = accountSystem.GetSingleUser(this.UserName, this.PortalSettings.PortalAlias);

                        try
                        {
                            this.NameField.Text    = memberUser.Name;
                            this.EmailField.Text   = memberUser.Email;
                            this.CompanyField.Text = memberUser.Company;
                            this.AddressField.Text = memberUser.Address;
                            this.ZipField.Text     = memberUser.Zip;
                            this.CityField.Text    = memberUser.City;

                            this.CountryField.ClearSelection();
                            if (this.CountryField.Items.FindByValue(memberUser.CountryID) != null)
                            {
                                this.CountryField.Items.FindByValue(memberUser.CountryID).Selected = true;
                            }

                            this.BindState();
                            this.StateField.ClearSelection();
                            if (this.StateField.Items.Count > 0 &&
                                this.StateField.Items.FindByValue(memberUser.StateID.ToString()) != null)
                            {
                                this.StateField.Items.FindByValue(memberUser.StateID.ToString()).Selected = true;
                            }

                            this.FaxField.Text          = memberUser.Fax;
                            this.PhoneField.Text        = memberUser.Phone;
                            this.SendNewsletter.Checked = memberUser.SendNewsletter;

                            // stores original password for later check
                            this.OriginalPassword = memberUser.GetPassword();
                            this.OriginalUserId   = memberUser.ProviderUserKey;
                        }
                        catch (ArgumentNullException)
                        {
                            // user doesn't exist
                        }
                    }
                    else
                    {
                        // We do not have rights to do it!
                        PortalSecurity.AccessDeniedEdit();
                    }
                }
                else
                {
                    this.BindState();

                    // No edit
                    this.RequiredPassword.Visible = true;
                    this.RequiredConfirm.Visible  = true;
                    this.EditPasswordRow.Visible  = false;
                    this.SaveChangesBtn.Visible   = false;
                    this.RegisterBtn.Visible      = true;
                }
            }
        }