Allow collections import checkbox location changed

This commit is contained in:
vfedosevich 2015-05-20 07:27:34 -07:00
parent ab1d7fef54
commit 659bf1c990
13 changed files with 133 additions and 48 deletions

View file

@ -141,6 +141,8 @@ namespace WebsitePanel.EnterpriseServer {
private System.Threading.SendOrPostCallback ImportCollectionOperationCompleted; private System.Threading.SendOrPostCallback ImportCollectionOperationCompleted;
private System.Threading.SendOrPostCallback GetRemoteDesktopServiceIdOperationCompleted;
/// <remarks/> /// <remarks/>
public esRemoteDesktopServices() { public esRemoteDesktopServices() {
this.Url = "http://localhost:9002/esRemoteDesktopServices.asmx"; this.Url = "http://localhost:9002/esRemoteDesktopServices.asmx";
@ -311,6 +313,9 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/> /// <remarks/>
public event ImportCollectionCompletedEventHandler ImportCollectionCompleted; public event ImportCollectionCompletedEventHandler ImportCollectionCompleted;
/// <remarks/>
public event GetRemoteDesktopServiceIdCompletedEventHandler GetRemoteDesktopServiceIdCompleted;
/// <remarks/> /// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsCollection", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsCollection", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public RdsCollection GetRdsCollection(int collectionId) { public RdsCollection GetRdsCollection(int collectionId) {
@ -2772,6 +2777,47 @@ namespace WebsitePanel.EnterpriseServer {
} }
} }
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRemoteDesktopServiceId", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int GetRemoteDesktopServiceId(int itemId) {
object[] results = this.Invoke("GetRemoteDesktopServiceId", new object[] {
itemId});
return ((int)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetRemoteDesktopServiceId(int itemId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetRemoteDesktopServiceId", new object[] {
itemId}, callback, asyncState);
}
/// <remarks/>
public int EndGetRemoteDesktopServiceId(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
/// <remarks/>
public void GetRemoteDesktopServiceIdAsync(int itemId) {
this.GetRemoteDesktopServiceIdAsync(itemId, null);
}
/// <remarks/>
public void GetRemoteDesktopServiceIdAsync(int itemId, object userState) {
if ((this.GetRemoteDesktopServiceIdOperationCompleted == null)) {
this.GetRemoteDesktopServiceIdOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetRemoteDesktopServiceIdOperationCompleted);
}
this.InvokeAsync("GetRemoteDesktopServiceId", new object[] {
itemId}, this.GetRemoteDesktopServiceIdOperationCompleted, userState);
}
private void OnGetRemoteDesktopServiceIdOperationCompleted(object arg) {
if ((this.GetRemoteDesktopServiceIdCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetRemoteDesktopServiceIdCompleted(this, new GetRemoteDesktopServiceIdCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/> /// <remarks/>
public new void CancelAsync(object userState) { public new void CancelAsync(object userState) {
base.CancelAsync(userState); base.CancelAsync(userState);
@ -4207,4 +4253,30 @@ namespace WebsitePanel.EnterpriseServer {
} }
} }
} }
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetRemoteDesktopServiceIdCompletedEventHandler(object sender, GetRemoteDesktopServiceIdCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetRemoteDesktopServiceIdCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetRemoteDesktopServiceIdCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public int Result {
get {
this.RaiseExceptionIfNecessary();
return ((int)(this.results[0]));
}
}
}
} }

View file

@ -56,6 +56,11 @@ namespace WebsitePanel.EnterpriseServer
} }
public static int GetRemoteDesktopServiceId(int itemId)
{
return GetRdsServiceId(itemId);
}
public static RdsCollection GetRdsCollection(int collectionId) public static RdsCollection GetRdsCollection(int collectionId)
{ {
return GetRdsCollectionInternal(collectionId); return GetRdsCollectionInternal(collectionId);

View file

@ -392,5 +392,11 @@ namespace WebsitePanel.EnterpriseServer
{ {
return RemoteDesktopServicesController.ImportCollection(itemId, collectionName); return RemoteDesktopServicesController.ImportCollection(itemId, collectionName);
} }
[WebMethod]
public int GetRemoteDesktopServiceId(int itemId)
{
return RemoteDesktopServicesController.GetRemoteDesktopServiceId(itemId);
}
} }
} }

View file

@ -48,7 +48,7 @@ namespace WebsitePanel.EnterpriseServer.Base.RDS
public const string DISABLE_CMD = "DisableCMD"; public const string DISABLE_CMD = "DisableCMD";
public const string DISABLE_CMD_ADMINISTRATORS = "DisableCMDAdministrators"; public const string DISABLE_CMD_ADMINISTRATORS = "DisableCMDAdministrators";
public const string DISABLE_CMD_USERS = "DisableCMDUsers"; public const string DISABLE_CMD_USERS = "DisableCMDUsers";
public const string ALLOWCONNECTIONSIMPORT = "AllowConnectionsImport"; public const string ALLOWCOLLECTIONSIMPORT = "AllowCollectionsImport";
public string SettingsName { get; set; } public string SettingsName { get; set; }
public int ServerId { get; set; } public int ServerId { get; set; }

View file

@ -147,4 +147,7 @@
<data name="lblComputersRootOU.Text" xml:space="preserve"> <data name="lblComputersRootOU.Text" xml:space="preserve">
<value>Computers Root OU:</value> <value>Computers Root OU:</value>
</data> </data>
<data name="cbCollectionsImport.Text" xml:space="preserve">
<value>Allow Collections Import</value>
</data>
</root> </root>

View file

@ -58,6 +58,11 @@
</fieldset> </fieldset>
<fieldset> <fieldset>
<table> <table>
<tr>
<td colspan="2">
<asp:CheckBox runat="server" Text="Allow Collections Import" ID="cbCollectionsImport" meta:resourcekey="cbCollectionsImport" Checked="false" />
</td>
</tr>
<tr> <tr>
<td class="SubHead" width="200" nowrap> <td class="SubHead" width="200" nowrap>
<asp:Label runat="server" ID="lblConnectionBroker" meta:resourcekey="lblConnectionBroker" Text="Connection Broker:"/> <asp:Label runat="server" ID="lblConnectionBroker" meta:resourcekey="lblConnectionBroker" Text="Connection Broker:"/>

View file

@ -32,6 +32,7 @@ using System.Collections.Generic;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
using System.Web.UI.WebControls; using System.Web.UI.WebControls;
using WebsitePanel.EnterpriseServer; using WebsitePanel.EnterpriseServer;
using WebsitePanel.EnterpriseServer.Base.RDS;
using WebsitePanel.Providers.Common; using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.RemoteDesktopServices; using WebsitePanel.Providers.RemoteDesktopServices;
@ -98,6 +99,11 @@ namespace WebsitePanel.Portal.ProviderControls
txtCentralNPS.Enabled = false; txtCentralNPS.Enabled = false;
txtCentralNPS.Text = string.Empty; txtCentralNPS.Text = string.Empty;
} }
if (!string.IsNullOrEmpty(settings[RdsServerSettings.ALLOWCOLLECTIONSIMPORT]))
{
cbCollectionsImport.Checked = Convert.ToBoolean(settings[RdsServerSettings.ALLOWCOLLECTIONSIMPORT]);
}
} }
public void SaveSettings(System.Collections.Specialized.StringDictionary settings) public void SaveSettings(System.Collections.Specialized.StringDictionary settings)
@ -108,6 +114,7 @@ namespace WebsitePanel.Portal.ProviderControls
settings["PrimaryDomainController"] = txtPrimaryDomainController.Text; settings["PrimaryDomainController"] = txtPrimaryDomainController.Text;
settings["UseCentralNPS"] = chkUseCentralNPS.Checked.ToString(); settings["UseCentralNPS"] = chkUseCentralNPS.Checked.ToString();
settings["CentralNPS"] = chkUseCentralNPS.Checked ? txtCentralNPS.Text : string.Empty; settings["CentralNPS"] = chkUseCentralNPS.Checked ? txtCentralNPS.Text : string.Empty;
settings[RdsServerSettings.ALLOWCOLLECTIONSIMPORT] = cbCollectionsImport.Checked.ToString();
settings["GWServrsList"] = GWServers; settings["GWServrsList"] = GWServers;

View file

@ -84,6 +84,15 @@ namespace WebsitePanel.Portal.ProviderControls {
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.Label lblExpiryDate; protected global::System.Web.UI.WebControls.Label lblExpiryDate;
/// <summary>
/// cbCollectionsImport control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox cbCollectionsImport;
/// <summary> /// <summary>
/// lblConnectionBroker control. /// lblConnectionBroker control.
/// </summary> /// </summary>

View file

@ -27,6 +27,7 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System; using System;
using System.Collections.Specialized;
using System.Linq; using System.Linq;
using System.Web.UI.WebControls; using System.Web.UI.WebControls;
using WebsitePanel.EnterpriseServer; using WebsitePanel.EnterpriseServer;
@ -55,8 +56,10 @@ namespace WebsitePanel.Portal.RDS
btnAddCollection.Enabled = (!(cntx.Quotas[Quotas.RDS_COLLECTIONS].QuotaAllocatedValue <= gvRDSCollections.Rows.Count) || (cntx.Quotas[Quotas.RDS_COLLECTIONS].QuotaAllocatedValue == -1)); btnAddCollection.Enabled = (!(cntx.Quotas[Quotas.RDS_COLLECTIONS].QuotaAllocatedValue <= gvRDSCollections.Rows.Count) || (cntx.Quotas[Quotas.RDS_COLLECTIONS].QuotaAllocatedValue == -1));
} }
var defaultSettings = ES.Services.Users.GetUserSettings(PanelSecurity.EffectiveUserId, UserSettings.RDS_POLICY); var serviceId = ES.Services.RDS.GetRemoteDesktopServiceId(PanelRequest.ItemID);
var allowImport = Convert.ToBoolean(defaultSettings[RdsServerSettings.ALLOWCONNECTIONSIMPORT]); var settings = ConvertArrayToDictionary(ES.Services.Servers.GetServiceSettings(serviceId));
var allowImport = Convert.ToBoolean(settings[RdsServerSettings.ALLOWCOLLECTIONSIMPORT]);
if (!allowImport) if (!allowImport)
{ {
@ -64,6 +67,8 @@ namespace WebsitePanel.Portal.RDS
} }
} }
private void BindQuota(PackageContext cntx) private void BindQuota(PackageContext cntx)
{ {
OrganizationStatistics stats = ES.Services.Organizations.GetOrganizationStatisticsByOrganization(PanelRequest.ItemID); OrganizationStatistics stats = ES.Services.Organizations.GetOrganizationStatisticsByOrganization(PanelRequest.ItemID);
@ -142,5 +147,16 @@ namespace WebsitePanel.Portal.RDS
{ {
return EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "rds_edit_collection", "CollectionId=" + collectionId, "ItemID=" + PanelRequest.ItemID); return EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "rds_edit_collection", "CollectionId=" + collectionId, "ItemID=" + PanelRequest.ItemID);
} }
private StringDictionary ConvertArrayToDictionary(string[] settings)
{
StringDictionary r = new StringDictionary();
foreach (string setting in settings)
{
int idx = setting.IndexOf('=');
r.Add(setting.Substring(0, idx), setting.Substring(idx + 1));
}
return r;
}
} }
} }

View file

@ -181,14 +181,3 @@
</table> </table>
<br /> <br />
</asp:Panel> </asp:Panel>
<wsp:CollapsiblePanel id="secAllowImport" runat="server" TargetControlID="allowImportPanel" meta:resourcekey="secAllowImport" Text="Connections Import"/>
<asp:Panel ID="allowImportPanel" runat="server" Height="0" style="overflow:hidden;">
<table>
<tr>
<td>
<asp:CheckBox runat="server" Text="Users" ID="cbAllowImport" meta:resourcekey="cbAllowImport" Checked="false" />
</td>
</tr>
</table>
<br />
</asp:Panel>

View file

@ -53,7 +53,6 @@ namespace WebsitePanel.Portal
cbDisableCmdUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.DISABLE_CMD_USERS]); cbDisableCmdUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.DISABLE_CMD_USERS]);
ddTreshold.SelectedValue = settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE]; ddTreshold.SelectedValue = settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE];
cbAllowImport.Checked = Convert.ToBoolean(settings[RdsServerSettings.ALLOWCONNECTIONSIMPORT]);
} }
public void SaveSettings(UserSettings settings) public void SaveSettings(UserSettings settings)
@ -82,7 +81,6 @@ namespace WebsitePanel.Portal
settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_Users] = cbControlSessionUsers.Checked.ToString(); settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_Users] = cbControlSessionUsers.Checked.ToString();
settings[RdsServerSettings.DISABLE_CMD_ADMINISTRATORS] = cbDisableCmdAdministrators.Checked.ToString(); settings[RdsServerSettings.DISABLE_CMD_ADMINISTRATORS] = cbDisableCmdAdministrators.Checked.ToString();
settings[RdsServerSettings.DISABLE_CMD_USERS] = cbDisableCmdUsers.Checked.ToString(); settings[RdsServerSettings.DISABLE_CMD_USERS] = cbDisableCmdUsers.Checked.ToString();
settings[RdsServerSettings.ALLOWCONNECTIONSIMPORT] = cbAllowImport.Checked.ToString();
} }
} }
} }

View file

@ -443,32 +443,5 @@ namespace WebsitePanel.Portal {
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.CheckBox cbDisableCmdAdministrators; protected global::System.Web.UI.WebControls.CheckBox cbDisableCmdAdministrators;
/// <summary>
/// secAllowImport control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secAllowImport;
/// <summary>
/// allowImportPanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel allowImportPanel;
/// <summary>
/// cbAllowImport control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox cbAllowImport;
} }
} }

View file

@ -6538,7 +6538,9 @@
<Content Include="RDS\UserControls\App_LocalResources\RDSCollectionApps.ascx.resx"> <Content Include="RDS\UserControls\App_LocalResources\RDSCollectionApps.ascx.resx">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Content> </Content>
<Content Include="ProviderControls\App_LocalResources\RDS_Settings.ascx.resx" /> <Content Include="ProviderControls\App_LocalResources\RDS_Settings.ascx.resx">
<SubType>Designer</SubType>
</Content>
<Content Include="UserControls\App_LocalResources\DomainControl.ascx.resx"> <Content Include="UserControls\App_LocalResources\DomainControl.ascx.resx">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Content> </Content>