/// <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(); }
/// <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(); }