From 2b514659000d58c1f491a9e9425b17f348d779df Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Wed, 27 May 2015 03:07:33 -0700 Subject: [PATCH] Alert (not popup) after checking RDS users --- .../WebsitePanel_SharedResources.ascx.resx | 3 ++ .../RDS/RDSEditCollectionUsers.ascx | 6 ++- .../RDS/RDSEditCollectionUsers.ascx.cs | 10 ++++- .../RDSEditCollectionUsers.ascx.designer.cs | 9 +++++ .../UserControls/RDSCollectionUsers.ascx.cs | 38 ++++++++++--------- 5 files changed, 46 insertions(+), 20 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx index d83c52e3..a666341c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -5850,6 +5850,9 @@ Local admins not added + + Unable to remove the following user(s) since they are local admins or they were granted access to remote applications: + RDS User logging off error diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx index 02015403..e8e5eec2 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx @@ -23,7 +23,11 @@
- + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx.cs index efcc68cb..8d800bfd 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx.cs @@ -48,7 +48,9 @@ namespace WebsitePanel.Portal.RDS users.OnRefreshClicked += OnRefreshClicked; if (!IsPostBack) - { + { + var collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID); + litCollectionName.Text = collection.DisplayName; BindQuota(); users.BindUsers(); } @@ -77,6 +79,12 @@ namespace WebsitePanel.Portal.RDS private void OnRefreshClicked(object sender, EventArgs e) { ((ModalPopupExtender)asyncTasks.FindControl("ModalPopupProperties")).Hide(); + var users = (List)sender; + + if (users.Any()) + { + messageBox.ShowErrorMessage("RDS_USERS_NOT_DELETED", new Exception(string.Join(", ", users))); + } } private bool SaveRdsUsers() diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx.designer.cs index e584e549..ad0a1800 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx.designer.cs @@ -48,6 +48,15 @@ namespace WebsitePanel.Portal.RDS { /// protected global::System.Web.UI.WebControls.Literal litCollectionName; + /// + /// messageUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel messageUpdatePanel; + /// /// messageBox control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx.cs index c735f9c6..3a0c15d3 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx.cs @@ -101,16 +101,26 @@ namespace WebsitePanel.Portal.RDS.UserControls protected void btnDelete_Click(object sender, EventArgs e) { - if (CheckDeletedUsers()) + if (PanelRequest.Ctl == "rds_collection_edit_users") + { + var lockedUsers = CheckDeletedUsers(); + + if (!lockedUsers.Any()) + { + List selectedAccounts = GetGridViewUsers(SelectedState.Unselected); + BindAccounts(selectedAccounts.ToArray(), false); + } + + if (OnRefreshClicked != null) + { + OnRefreshClicked(lockedUsers, new EventArgs()); + } + } + else { List selectedAccounts = GetGridViewUsers(SelectedState.Unselected); BindAccounts(selectedAccounts.ToArray(), false); } - - if (OnRefreshClicked != null) - { - OnRefreshClicked(sender, new EventArgs()); - } } protected void btnAddSelected_Click(object sender, EventArgs e) @@ -142,8 +152,8 @@ namespace WebsitePanel.Portal.RDS.UserControls return GetThemedImage("Exchange/" + imgName); } - public bool CheckDeletedUsers() - { + public List CheckDeletedUsers() + { var rdsUsers = GetGridViewUsers(SelectedState.Selected); var localAdmins = ES.Services.RDS.GetRdsCollectionLocalAdmins(PanelRequest.CollectionID); var organizationUsers = ES.Services.Organizations.GetOrganizationUsersPaged(PanelRequest.ItemID, null, null, null, 0, Int32.MaxValue).PageUsers; @@ -155,17 +165,9 @@ namespace WebsitePanel.Portal.RDS.UserControls deletedUsers.AddRange(rdsUsers.Where(r => localAdmins.Select(l => l.AccountName.ToLower()).Contains(r.AccountName.ToLower()))); remoteAppUsers = remoteAppUsers.Where(r => !localAdmins.Select(l => l.AccountName.ToLower()).Contains(r.AccountName.ToLower())); deletedUsers.AddRange(rdsUsers.Where(r => remoteAppUsers.Select(l => l.AccountName.ToLower()).Contains(r.AccountName.ToLower()))); - deletedUsers = deletedUsers.Distinct().ToList(); + deletedUsers = deletedUsers.Distinct().ToList(); - if (deletedUsers.Any()) - { - ltUsers.Text = string.Join("
", deletedUsers.Select(d => d.DisplayName)); - DeleteWarningModal.Show(); - - return false; - } - - return true; + return deletedUsers.Select(d => d.DisplayName).ToList(); } public void BindUsers()