//*******************************************************
        //
        // The BindData helper method is used to bind the list of
        // security roles for this portal to an asp:datalist server control
        //
        //*******************************************************

        private void BindData()
        {
            // Bind the Email and Password
            UsersDB     users = new UsersDB();
            IDataReader dr    = users.GetSingleUser(userName);

            // Read first row from database
            dr.Read();

            Email.Text    = (String)dr["email"];
            Password.Text = "";

            dr.Close();

            // add the user name to the title
            if (userName != "")
            {
                title.InnerText = "Manage User: "******"PortalSettings"];

            // Get the portal's roles from the database
            AdminDB admin = new AdminDB();

            // bind all portal roles to dropdownlist
            allRoles.DataSource = admin.GetPortalRoles(portalSettings.PortalId);
            allRoles.DataBind();
        }
Esempio n. 2
0
        //*******************************************************
        //
        // The BindData helper method is used to bind the list of
        // security roles for this portal to an asp:datalist server control
        //
        //*******************************************************

        private void BindData()
        {
            // unhide the Windows Authentication UI, if application
            if (User.Identity.AuthenticationType != "Forms")
            {
                windowsUserName.Visible = true;
                addNew.Visible          = true;
            }

            // add the role name to the title
            if (roleName != "")
            {
                title.InnerText = "Role Membership: " + roleName;
            }

            // Get the portal's roles from the database
            AdminDB admin = new AdminDB();

            // bind users in role to DataList
            usersInRole.DataSource = admin.GetRoleMembers(roleId);
            usersInRole.DataBind();

            // bind all portal users to dropdownlist
            allUsers.DataSource = admin.GetUsers();
            allUsers.DataBind();
        }
Esempio n. 3
0
        //*******************************************************
        //
        // The AddUser_Click server event handler is used to add
        // a new user to this security role
        //
        //*******************************************************

        private void AddUser_Click(Object sender, EventArgs e)
        {
            int userId;

            if (((LinkButton)sender).ID == "addNew")
            {
                // add new user to users table
                UsersDB users = new UsersDB();
                if ((userId = users.AddUser(windowsUserName.Text, windowsUserName.Text, "acme")) == -1)
                {
                    Message.Text = "Add New Failed!  There is already an entry for <" + "u" + ">" + windowsUserName.Text + "<" + "/u" + "> in the Users database." + "<" + "br" + ">" + "Please use Add Existing for this user.";
                }
            }
            else
            {
                //get user id from dropdownlist of existing users
                userId = Int32.Parse(allUsers.SelectedItem.Value);
            }

            if (userId != -1)
            {
                // Add a new userRole to the database
                AdminDB admin = new AdminDB();
                admin.AddUserRole(roleId, userId);
            }

            // Rebind list
            BindData();
        }
Esempio n. 4
0
        //*******************************************************
        //
        // The BindData helper method is used to update the tab's
        // layout panes with the current configuration information
        //
        //*******************************************************

        private void BindData()
        {
            // Obtain PortalSettings from Current Context
            PortalSettings portalSettings = (PortalSettings)Context.Items["PortalSettings"];
            TabSettings    tab            = portalSettings.ActiveTab;

            // Populate Tab Names, etc.
            tabName.Text       = tab.TabName;
            mobileTabName.Text = tab.MobileTabName;
            showMobile.Checked = tab.ShowMobile;

            // Populate checkbox list with all security roles for this portal
            // and "check" the ones already configured for this tab
            AdminDB     admin = new AdminDB();
            IDataReader roles = admin.GetPortalRoles(portalSettings.PortalId);

            // Clear existing items in checkboxlist
            authRoles.Items.Clear();

            ListItem allItem = new ListItem();

            allItem.Text = "All Users";

            if (tab.AuthorizedRoles.LastIndexOf("All Users") > -1)
            {
                allItem.Selected = true;
            }

            authRoles.Items.Add(allItem);

            while (roles.Read())
            {
                ListItem item = new ListItem();
                item.Text  = (String)roles["rolename"];
                item.Value = roles["roleid"].ToString();

                if ((tab.AuthorizedRoles.LastIndexOf(item.Text)) > -1)
                {
                    item.Selected = true;
                }

                authRoles.Items.Add(item);
            }

            // Populate the "Add Module" Data
            moduleType.DataSource = admin.GetModuleDefinitions(portalSettings.PortalId);
            moduleType.DataBind();

            // Populate Right Hand Module Data
            rightList = GetModules("RightPane");
            rightPane.DataBind();

            // Populate Content Pane Module Data
            contentList = GetModules("ContentPane");
            contentPane.DataBind();

            // Populate Left Hand Pane Module Data
            leftList = GetModules("LeftPane");
            leftPane.DataBind();
        }
Esempio n. 5
0
        //*******************************************************
        //
        // The AddModuleToPane_Click server event handler on this page is used
        // to add a new portal module into the tab
        //
        //*******************************************************

        private void AddModuleToPane_Click(Object sender, EventArgs e)
        {
            // All new modules go to the end of the contentpane
            ModuleItem m = new ModuleItem();

            m.ModuleTitle = moduleTitle.Text;
            m.ModuleDefId = Int32.Parse(moduleType.SelectedItem.Value);
            m.ModuleOrder = 999;

            // save to database
            AdminDB admin = new AdminDB();

            m.ModuleId = admin.AddModule(tabId, m.ModuleOrder, "ContentPane", m.ModuleTitle, m.ModuleDefId, 0, "Admins", false);

            // Obtain portalId from Current Context
            PortalSettings portalSettings = (PortalSettings)Context.Items["PortalSettings"];

            // reload the portalSettings from the database
            HttpContext.Current.Items["PortalSettings"] = new PortalSettings(portalSettings.PortalId, tabId);

            // reorder the modules in the content pane
            ArrayList modules = GetModules("ContentPane");

            OrderModules(modules);

            // resave the order
            foreach (ModuleItem item in modules)
            {
                admin.UpdateModuleOrder(item.ModuleId, item.ModuleOrder, "ContentPane");
            }

            // Redirect to the same page to pick up changes
            Response.Redirect(Request.RawUrl);
        }
        //*******************************************************
        //
        // The BindData helper method is used to bind the list of
        // module definitions for this portal to an asp:datalist server control
        //
        //*******************************************************

        void BindData()
        {
            // Obtain PortalSettings from Current Context
            PortalSettings portalSettings = (PortalSettings)Context.Items["PortalSettings"];

            // Get the portal's defs from the database
            AdminDB admin = new AdminDB();

            defsList.DataSource = admin.GetModuleDefinitions(portalSettings.PortalId);
            defsList.DataBind();
        }
Esempio n. 7
0
        //*******************************************************
        //
        // The BindData helper method is used to bind the list of
        // security roles for this portal to an asp:datalist server control
        //
        //*******************************************************

        private void BindData()
        {
            // Obtain PortalSettings from Current Context
            PortalSettings portalSettings = (PortalSettings)Context.Items["PortalSettings"];

            // Get the portal's roles from the database
            AdminDB admin = new AdminDB();

            rolesList.DataSource = admin.GetPortalRoles(portalSettings.PortalId);
            rolesList.DataBind();
        }
        //****************************************************************
        //
        // The UpdateBtn_Click event handler on this Page is used to save
        // the settings to the configuration file.
        //
        //****************************************************************

        void UpdateBtn_Click(Object sender, EventArgs e)
        {
            // Update settings in the database
            AdminDB admin = new AdminDB();

            admin.UpdateModuleSetting(moduleId, "xmlsrc", XmlDataSrc.Text);
            admin.UpdateModuleSetting(moduleId, "xslsrc", XslTransformSrc.Text);

            // Redirect back to the portal home page
            Response.Redirect((String)ViewState["UrlReferrer"]);
        }
        //****************************************************************
        //
        // The UpdateBtn_Click event handler on this Page is used to save
        // the settings to the ModuleSettings database table.  It  uses the
        // ASPNetPortalDB() data component to encapsulate the data
        // access functionality.
        //
        //****************************************************************

        private void UpdateBtn_Click(Object sender, EventArgs e)
        {
            // Update settings in the database
            AdminDB admin = new AdminDB();

            admin.UpdateModuleSetting(moduleId, "src", Src.Text);
            admin.UpdateModuleSetting(moduleId, "height", Height.Text);
            admin.UpdateModuleSetting(moduleId, "width", Width.Text);

            // Redirect back to the portal home page
            Response.Redirect((String)ViewState["UrlReferrer"]);
        }
Esempio n. 10
0
        //*******************************************************
        //
        // The RightLeft_Click server event handler on this page is
        // used to move a portal module between layout panes on
        // the tab page
        //
        //*******************************************************

        private void RightLeft_Click(Object sender, ImageClickEventArgs e)
        {
            String  sourcePane = ((ImageButton)sender).Attributes["sourcepane"];
            String  targetPane = ((ImageButton)sender).Attributes["targetpane"];
            ListBox sourceBox  = (ListBox)Page.FindControl(sourcePane);
            ListBox targetBox  = (ListBox)Page.FindControl(targetPane);

            if (sourceBox.SelectedIndex != -1)
            {
                // get source arraylist
                ArrayList sourceList = GetModules(sourcePane);

                // get a reference to the module to move
                // and assign a high order number to send it to the end of the target list
                ModuleItem m = (ModuleItem)sourceList[sourceBox.SelectedIndex];

                // add it to the database
                AdminDB admin = new AdminDB();
                admin.UpdateModuleOrder(m.ModuleId, 998, targetPane);

                // delete it from the source list
                sourceList.RemoveAt(sourceBox.SelectedIndex);

                // Obtain portalId from Current Context
                PortalSettings portalSettings = (PortalSettings)Context.Items["PortalSettings"];

                // reload the portalSettings from the database
                HttpContext.Current.Items["PortalSettings"] = new PortalSettings(portalSettings.PortalId, tabId);

                // reorder the modules in the source pane
                sourceList = GetModules(sourcePane);
                OrderModules(sourceList);

                // resave the order
                foreach (ModuleItem item in sourceList)
                {
                    admin.UpdateModuleOrder(item.ModuleId, item.ModuleOrder, sourcePane);
                }

                // reorder the modules in the target pane
                ArrayList targetList = GetModules(targetPane);
                OrderModules(targetList);

                // resave the order
                foreach (ModuleItem item in targetList)
                {
                    admin.UpdateModuleOrder(item.ModuleId, item.ModuleOrder, targetPane);
                }

                // Redirect to the same page to pick up changes
                Response.Redirect(Request.RawUrl);
            }
        }
        //*******************************************************
        //
        // The Apply_Click server event handler is used
        // to update the Site Name within the Portal Config System
        //
        //*******************************************************

        private void Apply_Click(Object sender, EventArgs e)
        {
            // Obtain PortalSettings from Current Context
            PortalSettings portalSettings = (PortalSettings)Context.Items["PortalSettings"];

            // update Tab info in the database
            AdminDB admin = new AdminDB();

            admin.UpdatePortalInfo(portalSettings.PortalId, siteName.Text, showEdit.Checked);

            // Redirect to this site to refresh
            Response.Redirect(Request.RawUrl);
        }
Esempio n. 12
0
        //*******************************************************
        //
        // The UpDown_Click server event handler on this page is
        // used to move a portal module up or down on a tab's layout pane
        //
        //*******************************************************

        private void UpDown_Click(Object sender, ImageClickEventArgs e)
        {
            String  cmd      = ((ImageButton)sender).CommandName;
            String  pane     = ((ImageButton)sender).CommandArgument;
            ListBox _listbox = (ListBox)Page.FindControl(pane);

            ArrayList modules = GetModules(pane);

            if (_listbox.SelectedIndex != -1)
            {
                int delta;
                int selection = -1;

                // Determine the delta to apply in the order number for the module
                // within the list.  +3 moves down one item; -3 moves up one item

                if (cmd == "down")
                {
                    delta = 3;
                    if (_listbox.SelectedIndex < _listbox.Items.Count - 1)
                    {
                        selection = _listbox.SelectedIndex + 1;
                    }
                }
                else
                {
                    delta = -3;
                    if (_listbox.SelectedIndex > 0)
                    {
                        selection = _listbox.SelectedIndex - 1;
                    }
                }

                ModuleItem m;
                m              = (ModuleItem)modules[_listbox.SelectedIndex];
                m.ModuleOrder += delta;

                // reorder the modules in the content pane
                OrderModules(modules);

                // resave the order
                AdminDB admin = new AdminDB();
                foreach (ModuleItem item in modules)
                {
                    admin.UpdateModuleOrder(item.ModuleId, item.ModuleOrder, pane);
                }
            }

            // Redirect to the same page to pick up changes
            Response.Redirect(Request.RawUrl);
        }
        //*******************************************************
        //
        // The UserRoles_ItemCommand server event handler on this page
        // is used to handle deleting the user from roles
        // from the userRoles asp:datalist control
        //
        //*******************************************************

        private void UserRoles_ItemCommand(object sender, DataListCommandEventArgs e)
        {
            AdminDB admin  = new AdminDB();
            int     roleId = (int)userRoles.DataKeys[e.Item.ItemIndex];

            // update database
            admin.DeleteUserRole(roleId, userId);

            // Ensure that item is not editable
            userRoles.EditItemIndex = -1;

            // Repopulate list
            BindData();
        }
Esempio n. 14
0
        //*******************************************************
        //
        // The BindData helper method is used to populate a asp:datalist
        // server control with the current "edit access" permissions
        // set within the portal configuration system
        //
        //*******************************************************

        private void BindData()
        {
            // Obtain PortalSettings from Current Context
            PortalSettings portalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"];

            object value = GetModule();

            if (value != null)
            {
                ModuleSettings m = (ModuleSettings)value;

                // Update Textbox Settings
                moduleTitle.Text   = m.ModuleTitle;
                cacheTime.Text     = m.CacheTime.ToString();
                showMobile.Checked = m.ShowMobile;

                // Populate checkbox list with all security roles for this portal
                // and "check" the ones already configured for this module
                AdminDB     admin = new AdminDB();
                IDataReader roles = admin.GetPortalRoles(portalSettings.PortalId);

                // Clear existing items in checkboxlist
                authEditRoles.Items.Clear();

                ListItem allItem = new ListItem();
                allItem.Text = "All Users";

                if (m.AuthorizedEditRoles.LastIndexOf("All Users") > -1)
                {
                    allItem.Selected = true;
                }

                authEditRoles.Items.Add(allItem);

                while (roles.Read())
                {
                    ListItem item = new ListItem();
                    item.Text  = (String)roles["rolename"];
                    item.Value = roles["roleid"].ToString();

                    if ((m.AuthorizedEditRoles.LastIndexOf(item.Text)) > -1)
                    {
                        item.Selected = true;
                    }

                    authEditRoles.Items.Add(item);
                }
            }
        }
        //*******************************************************
        //
        // The AddRole_Click server event handler is used to add
        // the user to this security role
        //
        //*******************************************************

        private void AddRole_Click(Object sender, EventArgs e)
        {
            int roleId;

            //get user id from dropdownlist of existing users
            roleId = Int32.Parse(allRoles.SelectedItem.Value);

            // Add a new userRole to the database
            AdminDB admin = new AdminDB();

            admin.AddUserRole(roleId, userId);

            // Rebind list
            BindData();
        }
Esempio n. 16
0
        //*******************************************************
        //
        // The RolesList_ItemCommand server event handler on this page
        // is used to handle the user editing and deleting roles
        // from the RolesList asp:datalist control
        //
        //*******************************************************

        private void RolesList_ItemCommand(object sender, DataListCommandEventArgs e)
        {
            AdminDB admin  = new AdminDB();
            int     roleId = (int)rolesList.DataKeys[e.Item.ItemIndex];

            if (e.CommandName == "edit")
            {
                // Set editable list item index if "edit" button clicked next to the item
                rolesList.EditItemIndex = e.Item.ItemIndex;

                // Repopulate the datalist control
                BindData();
            }
            else if (e.CommandName == "apply")
            {
                // Apply changes
                String _roleName = ((TextBox)e.Item.FindControl("roleName")).Text;

                // update database
                admin.UpdateRole(roleId, _roleName);

                // Disable editable list item access
                rolesList.EditItemIndex = -1;

                // Repopulate the datalist control
                BindData();
            }
            else if (e.CommandName == "delete")
            {
                // update database
                admin.DeleteRole(roleId);

                // Ensure that item is not editable
                rolesList.EditItemIndex = -1;

                // Repopulate list
                BindData();
            }
            else if (e.CommandName == "members")
            {
                // Save role name changes first
                String _roleName = ((TextBox)e.Item.FindControl("roleName")).Text;
                admin.UpdateRole(roleId, _roleName);

                // redirect to edit page
                Response.Redirect("~/Admin/SecurityRoles.aspx?roleId=" + roleId + "&rolename=" + _roleName + "&tabindex=" + tabIndex + "&tabid=" + tabId);
            }
        }
Esempio n. 17
0
        //*******************************************************
        //
        // The AddRole_Click server event handler is used to add
        // a new security role for this portal
        //
        //*******************************************************

        private void AddRole_Click(Object Sender, EventArgs e)
        {
            // Obtain PortalSettings from Current Context
            PortalSettings portalSettings = (PortalSettings)Context.Items["PortalSettings"];

            // Add a new role to the database
            AdminDB admin = new AdminDB();

            admin.AddRole(portalSettings.PortalId, "New Role");

            // set the edit item index to the last item
            rolesList.EditItemIndex = rolesList.Items.Count;

            // Rebind list
            BindData();
        }
        //*******************************************************
        //
        // The BindData helper method is used to bind the list of
        // users for this portal to an asp:DropDownList server control
        //
        //*******************************************************

        private void BindData()
        {
            // change the message between Windows and Forms authentication
            if (Context.User.Identity.AuthenticationType != "Forms")
            {
                Message.Text = "Users must be registered to view secure content.  Users may add themselves using the Register form, and Administrators may add users to specific roles using the Security Roles function above.  This section permits Administrators to manage users and their security roles directly.";
            }
            else
            {
                Message.Text = "Domain users do not need to be registered to access portal content that is available to \"All Users\".  Administrators may add domain users to specific roles using the Security Roles function above.  This section permits Administrators to manage users and their security roles directly.";
            }

            // Get the list of registered users from the database
            AdminDB admin = new AdminDB();

            // bind all portal users to dropdownlist
            allUsers.DataSource = admin.GetUsers();
            allUsers.DataBind();
        }
        //*******************************************************
        //
        // The DeleteBtn_Click server event handler is used to delete
        // the selected tab from the portal
        //
        //*******************************************************

        private void DeleteBtn_Click(Object sender, ImageClickEventArgs e)
        {
            if (tabList.SelectedIndex != -1)
            {
                // must delete from database too
                TabItem t     = (TabItem)portalTabs[tabList.SelectedIndex];
                AdminDB admin = new AdminDB();
                admin.DeleteTab(t.TabId);

                // remove item from list
                portalTabs.RemoveAt(tabList.SelectedIndex);

                // reorder list
                OrderTabs();

                // Redirect to this site to refresh
                Response.Redirect("~/DesktopDefault.aspx?tabindex=" + tabIndex + "&tabid=" + tabId);
            }
        }
Esempio n. 20
0
        //*******************************************************
        //
        // The DeleteBtn_Click server event handler on this page is
        // used to delete an portal module from the page
        //
        //*******************************************************

        private void DeleteBtn_Click(Object sender, ImageClickEventArgs e)
        {
            String    pane     = ((ImageButton)sender).CommandArgument;
            ListBox   _listbox = (ListBox)Page.FindControl(pane);
            ArrayList modules  = GetModules(pane);

            if (_listbox.SelectedIndex != -1)
            {
                ModuleItem m = (ModuleItem)modules[_listbox.SelectedIndex];
                if (m.ModuleId > -1)
                {
                    // must delete from database too
                    AdminDB admin = new AdminDB();
                    admin.DeleteModule(m.ModuleId);
                }
            }

            // Redirect to the same page to pick up changes
            Response.Redirect(Request.RawUrl);
        }
        //*******************************************************
        //
        // The OrderTabs helper method is used to reset the display
        // order for tabs within the portal
        //
        //*******************************************************

        private void OrderTabs()
        {
            int i = 1;

            // sort the arraylist
            portalTabs.Sort();

            // renumber the order and save to database
            foreach (TabItem t in portalTabs)
            {
                // number the items 1, 3, 5, etc. to provide an empty order
                // number when moving items up and down in the list.
                t.TabOrder = i;
                i         += 2;

                // rewrite tab to database
                AdminDB admin = new AdminDB();
                admin.UpdateTabOrder(t.TabId, t.TabOrder);
            }
        }
Esempio n. 22
0
        //*******************************************************
        //
        // The SaveTabData helper method is used to persist the
        // current tab settings to the database.
        //
        //*******************************************************

        private void SaveTabData()
        {
            // Construct Authorized User Roles String
            String authorizedRoles = "";

            foreach (ListItem item in authRoles.Items)
            {
                if (item.Selected == true)
                {
                    authorizedRoles = authorizedRoles + item.Text + ";";
                }
            }

            // Obtain PortalSettings from Current Context
            PortalSettings portalSettings = (PortalSettings)Context.Items["PortalSettings"];

            // update Tab info in the database
            AdminDB admin = new AdminDB();

            admin.UpdateTab(portalSettings.PortalId, tabId, tabName.Text, portalSettings.ActiveTab.TabOrder, authorizedRoles, mobileTabName.Text, showMobile.Checked);
        }
        //*******************************************************
        //
        // The AddTab_Click server event handler is used to add
        // a new security tab for this portal
        //
        //*******************************************************

        private void AddTab_Click(Object Sender, EventArgs e)
        {
            // Obtain PortalSettings from Current Context
            PortalSettings portalSettings = (PortalSettings)Context.Items["PortalSettings"];

            // New tabs go to the end of the list
            TabItem t = new TabItem();

            t.TabName  = "New Tab";
            t.TabId    = -1;
            t.TabOrder = 999;
            portalTabs.Add(t);

            // write tab to database
            AdminDB admin = new AdminDB();

            t.TabId = admin.AddTab(portalSettings.PortalId, t.TabName, t.TabOrder);

            // Reset the order numbers for the tabs within the list
            OrderTabs();

            // Redirect to edit page
            Response.Redirect("~/Admin/TabLayout.aspx?tabid=" + t.TabId);
        }
        //****************************************************************
        //
        // The UpdateBtn_Click event handler on this Page is used to either
        // create or update a link.  It  uses the ASPNetPortal.LinkDB()
        // data component to encapsulate all data functionality.
        //
        //****************************************************************

        private void UpdateBtn_Click(Object sender, EventArgs e)
        {
            if (Page.IsValid == true)
            {
                AdminDB admin = new AdminDB();

                if (defId == -1)
                {
                    // Obtain PortalSettings from Current Context
                    PortalSettings portalSettings = (PortalSettings)Context.Items["PortalSettings"];

                    // Add a new module definition to the database
                    admin.AddModuleDefinition(portalSettings.PortalId, FriendlyName.Text, DesktopSrc.Text, MobileSrc.Text);
                }
                else
                {
                    // update the module definition
                    admin.UpdateModuleDefinition(defId, FriendlyName.Text, DesktopSrc.Text, MobileSrc.Text);
                }

                // Redirect back to the portal admin page
                Response.Redirect("~/DesktopDefault.aspx?tabindex=" + tabIndex + "&tabid=" + tabId);
            }
        }
Esempio n. 25
0
        //*******************************************************
        //
        // The ApplyChanges_Click server event handler on this page is used
        // to save the module settings into the portal configuration system
        //
        //*******************************************************

        private void ApplyChanges_Click(Object Sender, EventArgs e)
        {
            // Obtain PortalSettings from Current Context
            PortalSettings portalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"];

            object value = GetModule();

            if (value != null)
            {
                ModuleSettings m = (ModuleSettings)value;

                // Construct Authorized User Roles String
                String editRoles = "";

                foreach (ListItem item in authEditRoles.Items)
                {
                    if (item.Selected == true)
                    {
                        editRoles = editRoles + item.Text + ";";
                    }
                }

                // update module
                AdminDB admin = new AdminDB();
                admin.UpdateModule(moduleId, m.ModuleOrder, m.PaneName, moduleTitle.Text, Int32.Parse(cacheTime.Text), editRoles, showMobile.Checked);

                // Update Textbox Settings
                moduleTitle.Text = m.ModuleTitle;
                cacheTime.Text   = m.CacheTime.ToString();

                // Populate checkbox list with all security roles for this portal
                // and "check" the ones already configured for this module
                IDataReader roles = admin.GetPortalRoles(portalSettings.PortalId);

                // Clear existing items in checkboxlist
                authEditRoles.Items.Clear();

                ListItem allItem = new ListItem();
                allItem.Text = "All Users";

                if (m.AuthorizedEditRoles.LastIndexOf("All Users") > -1)
                {
                    allItem.Selected = true;
                }

                authEditRoles.Items.Add(allItem);

                while (roles.Read())
                {
                    ListItem item = new ListItem();
                    item.Text  = (String)roles["rolename"];
                    item.Value = roles["roleid"].ToString();

                    if ((m.AuthorizedEditRoles.LastIndexOf(item.Text)) > -1)
                    {
                        item.Selected = true;
                    }

                    authEditRoles.Items.Add(item);
                }
            }

            // Navigate back to admin page
            Response.Redirect("TabLayout.aspx?tabid=" + tabId);
        }