diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs index 9371ca1e..f2a3ca42 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs @@ -422,7 +422,7 @@ namespace WebsitePanel.EnterpriseServer private static RdsServersPaged GetOrganizationRdsServersPagedInternal(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { - DataSet ds = DataProvider.GetRDSServersPaged(itemId, null, filterColumn, filterValue, sortColumn, startRow, maximumRows); + DataSet ds = DataProvider.GetRDSServersPaged(itemId, null, filterColumn, filterValue, sortColumn, startRow, maximumRows, ignoreRdsCollectionId: true); RdsServersPaged result = new RdsServersPaged(); result.RecordsCount = (int)ds.Tables[0].Rows[0][0]; diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsPolicyTypes.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsPolicyTypes.cs new file mode 100644 index 00000000..b00fa3a2 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsPolicyTypes.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace WebsitePanel.Providers.RemoteDesktopServices +{ + public enum RdsPolicyTypes + { + RdCap, + RdRap + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj index 2efa81eb..e5fff6ca 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj @@ -125,6 +125,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs index ccc6edea..68de8394 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs @@ -62,7 +62,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices private const string Users = "users"; private const string RdsGroupFormat = "rds-{0}-{1}"; private const string RdsModuleName = "RemoteDesktopServices"; - private const string AddNpsString = "netsh nps add np name=\"\"{0}\"\" policysource=\"1\" processingorder=\"{1}\" conditionid=\"0x3d\" conditiondata=\"^5$\" conditionid=\"0x1fb5\" conditiondata=\"{2}\" conditionid=\"0x1fb4\" conditiondata=\"{3}\" conditionid=\"0x1e\" conditiondata=\"UserAuthType:(PW|CA)\" profileid=\"0x1005\" profiledata=\"TRUE\" profileid=\"0x100f\" profiledata=\"TRUE\" profileid=\"0x1009\" profiledata=\"0x7\" profileid=\"0x1fe6\" profiledata=\"0x40000000\""; + private const string AddNpsString = "netsh nps add np name=\"\"{0}\"\" policysource=\"1\" processingorder=\"{1}\" conditionid=\"0x3d\" conditiondata=\"^5$\" conditionid=\"0x1fb5\" conditiondata=\"{2}\" conditionid=\"0x1e\" conditiondata=\"UserAuthType:(PW|CA)\" profileid=\"0x1005\" profiledata=\"TRUE\" profileid=\"0x100f\" profiledata=\"TRUE\" profileid=\"0x1009\" profiledata=\"0x7\" profileid=\"0x1fe6\" profiledata=\"0x40000000\""; #endregion #region Properties @@ -194,21 +194,22 @@ namespace WebsitePanel.Providers.RemoteDesktopServices ActiveDirectoryUtils.CreateGroup(orgPath, GetUsersGroupName(collection.Name)); } - var policyName = GetPolicyName(organizationId, collection.Name); + var capPolicyName = GetPolicyName(organizationId, collection.Name, RdsPolicyTypes.RdCap); + var rapPolicyName = GetPolicyName(organizationId, collection.Name, RdsPolicyTypes.RdRap); foreach (var gateway in Gateways) { if (!CentralNps) { - CreateRdCapForce(runSpace, gateway, policyName, collection.Name, new List { GetUsersGroupName(collection.Name) }); + CreateRdCapForce(runSpace, gateway, capPolicyName, collection.Name, new List { GetUsersGroupName(collection.Name) }); } - CreateRdRapForce(runSpace, gateway, policyName, collection.Name, new List { GetUsersGroupName(collection.Name) }); + CreateRdRapForce(runSpace, gateway, rapPolicyName, collection.Name, new List { GetUsersGroupName(collection.Name) }); } if (CentralNps) { - CreateCentralNpsPolicy(runSpace, CentralNpsHost, policyName, collection.Name, organizationId); + CreateCentralNpsPolicy(runSpace, CentralNpsHost, capPolicyName, collection.Name, organizationId); } //add user group to collection @@ -280,21 +281,22 @@ namespace WebsitePanel.Providers.RemoteDesktopServices ExecuteShellCommand(runSpace, cmd, false); - var policyName = GetPolicyName(organizationId, collectionName); + var capPolicyName = GetPolicyName(organizationId, collectionName, RdsPolicyTypes.RdCap); + var rapPolicyName = GetPolicyName(organizationId, collectionName, RdsPolicyTypes.RdRap); foreach (var gateway in Gateways) { if (!CentralNps) { - RemoveRdCap(runSpace, gateway, policyName); + RemoveRdCap(runSpace, gateway, capPolicyName); } - RemoveRdRap(runSpace, gateway, policyName); + RemoveRdRap(runSpace, gateway, rapPolicyName); } if (CentralNps) { - RemoveNpsPolicy(runSpace, CentralNpsHost, policyName); + RemoveNpsPolicy(runSpace, CentralNpsHost, capPolicyName); } //Remove security group @@ -553,11 +555,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices var userGroupSid = (byte[])ActiveDirectoryUtils.GetADObjectProperty(userGroupAd, "objectSid"); - var computerGroupAd = ActiveDirectoryUtils.GetADObject(GetComputerGroupPath(organizationId, collectionName)); - - var computerGroupSid = (byte[])ActiveDirectoryUtils.GetADObjectProperty(computerGroupAd, "objectSid"); - - var addCmdString = string.Format(AddNpsString, policyName.Replace(" ", "_"), count, ConvertByteToStringSid(userGroupSid), ConvertByteToStringSid(computerGroupSid)); + var addCmdString = string.Format(AddNpsString, policyName.Replace(" ", "_"), count, ConvertByteToStringSid(userGroupSid)); Command addCmd = new Command(addCmdString); @@ -582,13 +580,11 @@ namespace WebsitePanel.Providers.RemoteDesktopServices } var userGroupParametr = string.Format("@({0})",string.Join(",", groups.Select(x => string.Format("\"{0}@{1}\"", x, RootDomain)).ToArray())); - var computerGroupParameter = string.Format("\"{0}@{1}\"", GetComputersGroupName(collectionName), RootDomain); Command rdCapCommand = new Command("New-Item"); rdCapCommand.Parameters.Add("Path", string.Format("\"{0}\"", CapPath)); rdCapCommand.Parameters.Add("Name", string.Format("\"{0}\"", policyName)); rdCapCommand.Parameters.Add("UserGroups", userGroupParametr); - rdCapCommand.Parameters.Add("ComputerGroups", computerGroupParameter); rdCapCommand.Parameters.Add("AuthMethod", 1); ExecuteRemoteShellCommand(runSpace, gatewayHost, rdCapCommand, RdsModuleName); @@ -936,9 +932,25 @@ namespace WebsitePanel.Providers.RemoteDesktopServices ExecuteRemoteShellCommand(runSpace, hostname, rdRapCommand, imports); } - private string GetPolicyName(string organizationId, string collectionName) + private string GetPolicyName(string organizationId, string collectionName, RdsPolicyTypes policyType) { - return string.Format("rds-{0}-{1}", organizationId, collectionName); + string policyName = string.Format("{0}-{1}-", organizationId, collectionName); + + switch (policyType) + { + case RdsPolicyTypes.RdCap: + { + policyName += "RDCAP"; + break; + } + case RdsPolicyTypes.RdRap: + { + policyName += "RDRAP"; + break; + } + } + + return policyName; } private string GetComputersGroupName(string collectionName) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/RDS_Settings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/RDS_Settings.ascx.resx new file mode 100644 index 00000000..f3221c01 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/RDS_Settings.ascx.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Add + + + No gateway serves have been added yet. + + + Server Name + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx index eb1de52b..879afc47 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx @@ -9,15 +9,6 @@ - - - - - - - - - @@ -52,4 +43,33 @@ + + + + + + +
+ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx.cs index 0eaea7f4..2a5aa27b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx.cs @@ -27,6 +27,8 @@ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using System; +using System.Collections.Generic; +using System.Web.UI.WebControls; using WebsitePanel.EnterpriseServer; using WebsitePanel.Providers.Common; @@ -39,10 +41,26 @@ namespace WebsitePanel.Portal.ProviderControls } + public string GWServers + { + get + { + return ViewState["GWServers"] != null ? ViewState["GWServers"].ToString() : string.Empty; + } + set + { + ViewState["GWServers"] = value; + } + } + public void BindSettings(System.Collections.Specialized.StringDictionary settings) { txtConnectionBroker.Text = settings["ConnectionBroker"]; - txtGateway.Text = settings["GWServrsList"]; + + GWServers = settings["GWServrsList"]; + + UpdateLyncServersGrid(); + txtRootOU.Text = settings["RootOU"]; txtPrimaryDomainController.Text = settings["PrimaryDomainController"]; @@ -63,11 +81,12 @@ namespace WebsitePanel.Portal.ProviderControls public void SaveSettings(System.Collections.Specialized.StringDictionary settings) { settings["ConnectionBroker"] = txtConnectionBroker.Text; - settings["GWServrsList"] = txtGateway.Text; settings["RootOU"] = txtRootOU.Text; settings["PrimaryDomainController"] = txtPrimaryDomainController.Text; settings["UseCentralNPS"] = chkUseCentralNPS.Checked.ToString(); settings["CentralNPS"] = chkUseCentralNPS.Checked ? txtCentralNPS.Text : string.Empty; + + settings["GWServrsList"] = GWServers; } protected void chkUseCentralNPS_CheckedChanged(object sender, EventArgs e) @@ -75,6 +94,61 @@ namespace WebsitePanel.Portal.ProviderControls txtCentralNPS.Enabled = chkUseCentralNPS.Checked; txtCentralNPS.Text = chkUseCentralNPS.Checked ? txtCentralNPS.Text : string.Empty; } - + + protected void btnAddGWServer_Click(object sender, EventArgs e) + { + if (!string.IsNullOrEmpty(GWServers)) + GWServers += ";"; + + GWServers += txtAddGWServer.Text; + + txtAddGWServer.Text = string.Empty; + + UpdateLyncServersGrid(); + } + + public List GetServices(string data) + { + if (string.IsNullOrEmpty(data)) + return null; + List list = new List(); + string[] serversNames = data.Split(';'); + foreach (string current in serversNames) + { + list.Add(new GWServer { ServerName = current }); + } + + return list; + } + + private void UpdateLyncServersGrid() + { + gvGWServers.DataSource = GetServices(GWServers); + gvGWServers.DataBind(); + } + + protected void gvGWServers_RowCommand(object sender, GridViewCommandEventArgs e) + { + if (e.CommandName == "RemoveServer") + { + string str = string.Empty; + List servers = GetServices(GWServers); + foreach (GWServer current in servers) + { + if (current.ServerName == e.CommandArgument.ToString()) + continue; + + str += current.ServerName + ";"; + } + + GWServers = str.TrimEnd(';'); + UpdateLyncServersGrid(); + } + } + } + + public class GWServer + { + public string ServerName { get; set; } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx.designer.cs index e3f1f911..e1c47f7a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx.designer.cs @@ -39,33 +39,6 @@ namespace WebsitePanel.Portal.ProviderControls { /// protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2; - /// - /// lblGateway control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblGateway; - - /// - /// txtGateway control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox txtGateway; - - /// - /// RequiredFieldValidator3 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3; - /// /// lblRootOU control. /// @@ -155,5 +128,41 @@ namespace WebsitePanel.Portal.ProviderControls { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox txtCentralNPS; + + /// + /// locGWServers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locGWServers; + + /// + /// txtAddGWServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtAddGWServer; + + /// + /// btnAddGWServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAddGWServer; + + /// + /// gvGWServers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvGWServers; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AssignedRDSServers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AssignedRDSServers.ascx index eab349e5..c1956968 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AssignedRDSServers.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AssignedRDSServers.ascx @@ -55,9 +55,10 @@ - + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionServers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionServers.ascx.cs index 6fb8d5f8..b3ca3c35 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionServers.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionServers.ascx.cs @@ -131,6 +131,7 @@ namespace WebsitePanel.Portal.RDS.UserControls servers.AddRange(GetGridViewServers(SelectedState.All)); // add new servers + if (newServers != null) { foreach (RdsServer newServer in newServers) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj index 22deb551..9d85192e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -5535,6 +5535,7 @@ + Designer