Esempio n. 1
0
        /// <summary>
        /// The save_ click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void Save_Click([NotNull] object sender, [NotNull] EventArgs e)
        {
            // retrieve access mask ID from parameter (if applicable)
            if (this.Request.QueryString.GetFirstOrDefault("u") != null)
            {
                object userId = this.Request.QueryString.GetFirstOrDefault("u");

                foreach (RepeaterItem ri in this.AccessList.Items)
                {
                    bool   readAccess = ((CheckBox)ri.FindControl("ReadAccess")).Checked;
                    string pageName   = ((Label)ri.FindControl("PageName")).Text.Trim();
                    if (readAccess || "admin_admin".ToLowerInvariant() == pageName.ToLowerInvariant())
                    {
                        // save it
                        LegacyDb.adminpageaccess_save(
                            userId,
                            pageName);
                    }
                    else
                    {
                        LegacyDb.adminpageaccess_delete(userId, pageName);
                    }
                }

                YafBuildLink.Redirect(ForumPages.admin_pageaccesslist);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Grants all click.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void GrantAllClick([NotNull] object sender, [NotNull] EventArgs e)
        {
            // save permissions to table -  checked only
            if (this.Request.QueryString.GetFirstOrDefault("u") != null)
            {
                object userId = this.Request.QueryString.GetFirstOrDefault("u");
                foreach (RepeaterItem ri in this.AccessList.Items)
                {
                    // save it
                    LegacyDb.adminpageaccess_save(userId, ((Label)ri.FindControl("PageName")).Text.Trim());
                }
            }

            YafBuildLink.Redirect(ForumPages.admin_pageaccesslist);
        }