Beispiel #1
0
        /// <summary>
        /// event handler that gets called when the delete user button is clicked.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void OnDeleteButton_Click(object source, EventArgs e)
        {
            foreach (string userID in CheckedUsers.Keys)
            {
                // bugbug!! - need a call to delete by user ids.
                try
                {
                    iFolderUser user = web.GetUser(userID);
                    web.DeleteUser(user.UserName);
                }
                catch (Exception ex)
                {
                    string errMsg = String.Format(GetString("ERRORCANNOTDELETEUSER"), userID);
                    TopNav.ShowError(errMsg, ex);
                    return;
                }
            }

            // clear the checked members.
            CheckedUsers.Clear();
            AllUsersCheckBox.Checked = false;

            // set the action buttons.
            SetActionButtons();

            // rebind the data source with the new data.
            GetUsers();
        }
Beispiel #2
0
        /// <summary>
        /// event handler that gets called when the all user check box is checked.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void OnAllUsersChecked(object source, EventArgs e)
        {
            CheckBox checkBox = source as CheckBox;

            foreach (DataGridItem item in Accounts.Items)
            {
                // in order to be checked, the row must not be empty.
                string userID = item.Cells[AccountsIDColumn].Text;
                if (userID != "&nbsp;" && !IsSuperAdmin(userID))
                {
                    if (checkBox.Checked)
                    {
                        CheckedUsers[userID] = item.Cells[AccountsDisabledColumn].Text == Boolean.FalseString;
                    }
                    else
                    {
                        // remove this user from the list.
                        CheckedUsers.Remove(userID);
                    }
                }
            }

            // set the action buttons appropriately.
            SetActionButtons();

            // rebind the data source with the new data.
            GetUsers();
        }
Beispiel #3
0
        /// <summary>
        /// Sets the enabled status on all selected users.
        /// </summary>
        /// <param name="status">If true then all selected users will be enabled.</param>
        private void SetSelectedUserStatus(bool status)
        {
            foreach (string userID in CheckedUsers.Keys)
            {
                // Don't set the status if already set.
                if (( bool )CheckedUsers[userID] != status)
                {
                    /// Check for the policy for the groupadmin...
                    int preference = GetRightsForUser(userID);
                    if (preference != -1 && preference != 0xffff)
                    {
                        UserGroupAdminRights rights = new UserGroupAdminRights((int)preference);
                        if (rights.EnableDisableUserAllowed == false)
                        {
                            continue;
                        }
                    }

                    UserPolicy policy = Utils.GetUserPolicyObject(userID);
                    policy.LoginEnabled = status;
                    try
                    {
                        web.SetUserPolicy(policy);
                    }
                    catch (Exception ex)
                    {
                        string errMsg = String.Format(GetString("ERRORCANNOTSETUSERPOLICY"), userID);
                        TopNav.ShowError(errMsg, ex);
                        return;
                    }
                }
            }

            // Clear the checked members.
            CheckedUsers.Clear();
            AllUsersCheckBox.Checked = false;

            // Set the action buttons.
            SetActionButtons();

            // Rebind the data source with the new data.
            GetUsers();
        }
Beispiel #4
0
        /// <summary>
        /// Event handler that gets called when the user check box is checked.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void OnUserChecked(object source, EventArgs e)
        {
            // Get the data grid row for this member.
            CheckBox     checkBox = source as CheckBox;
            DataGridItem item     = checkBox.Parent.Parent as DataGridItem;
            string       userID   = item.Cells[AccountsIDColumn].Text;

            if (userID != "&nbsp;")
            {
                // User is being added.
                if (checkBox.Checked)
                {
                    CheckedUsers[userID] = item.Cells[AccountsDisabledColumn].Text == Boolean.FalseString;
                }
                else
                {
                    // Remove this ifolder from the list.
                    CheckedUsers.Remove(userID);
                }
            }

            // Set the user action buttons.
            SetActionButtons();
        }
Beispiel #5
0
 /// <summary>
 /// Returns the checked state for the specified member.
 /// </summary>
 /// <param name="id">ID of the ifolder</param>
 /// <returns>True if ifolder is checked.</returns>
 protected bool GetMemberCheckedState(Object id)
 {
     return(CheckedUsers.ContainsKey(id) ? true : false);
 }