diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 8ae258b7..665ab7f5 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -5508,6 +5508,46 @@ CREATE TABLE [dbo].[RDSCollectionSettings]( GO +IF NOT EXISTS(SELECT * FROM sys.columns + WHERE [name] = N'SecurityLayer' AND [object_id] = OBJECT_ID(N'RDSCollectionSettings')) +BEGIN + ALTER TABLE [dbo].[RDSCollectionSettings] ADD SecurityLayer NVARCHAR(20) null; +END +GO + +IF NOT EXISTS(SELECT * FROM sys.columns + WHERE [name] = N'EncryptionLevel' AND [object_id] = OBJECT_ID(N'RDSCollectionSettings')) +BEGIN + ALTER TABLE [dbo].[RDSCollectionSettings] ADD EncryptionLevel NVARCHAR(20) null; +END +GO + +IF NOT EXISTS(SELECT * FROM sys.columns + WHERE [name] = N'AuthenticateUsingNLA' AND [object_id] = OBJECT_ID(N'RDSCollectionSettings')) +BEGIN + ALTER TABLE [dbo].[RDSCollectionSettings] ADD AuthenticateUsingNLA BIT null; +END +GO + + + +IF NOT EXISTS(SELECT * FROM SYS.TABLES WHERE name = 'RDSCertificates') +CREATE TABLE [dbo].[RDSCertificates]( + [ID] [int] IDENTITY(1,1) NOT NULL, + [ServiceId] [int] NOT NULL, + [Content] [ntext] NOT NULL, + [Hash] [nvarchar](255) NOT NULL, + [FileName] [nvarchar](255) NOT NULL, + [ValidFrom] [datetime] NULL, + [ExpiryDate] [datetime] NULL + CONSTRAINT [PK_RDSCertificates] PRIMARY KEY CLUSTERED +( + [ID] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +) ON [PRIMARY] + +GO + ALTER TABLE [dbo].[RDSCollectionUsers] DROP CONSTRAINT [FK_RDSCollectionUsers_RDSCollectionId] @@ -5548,6 +5588,66 @@ GO /*Remote Desktop Services Procedures*/ +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddRDSCertificate') +DROP PROCEDURE AddRDSCertificate +GO +CREATE PROCEDURE [dbo].[AddRDSCertificate] +( + @RDSCertificateId INT OUTPUT, + @ServiceId INT, + @Content NTEXT, + @Hash NVARCHAR(255), + @FileName NVARCHAR(255), + @ValidFrom DATETIME, + @ExpiryDate DATETIME +) +AS +INSERT INTO RDSCertificates +( + ServiceId, + Content, + Hash, + FileName, + ValidFrom, + ExpiryDate +) +VALUES +( + @ServiceId, + @Content, + @Hash, + @FileName, + @ValidFrom, + @ExpiryDate +) + +SET @RDSCertificateId = SCOPE_IDENTITY() + +RETURN +GO + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSCertificateByServiceId') +DROP PROCEDURE GetRDSCertificateByServiceId +GO +CREATE PROCEDURE [dbo].[GetRDSCertificateByServiceId] +( + @ServiceId INT +) +AS +SELECT TOP 1 + Id, + ServiceId, + Content, + Hash, + FileName, + ValidFrom, + ExpiryDate + FROM RDSCertificates + WHERE ServiceId = @ServiceId + ORDER BY Id DESC +GO + IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddRDSServer') DROP PROCEDURE AddRDSServer GO @@ -8751,4 +8851,147 @@ IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [ProviderName] = 'HyperV201 BEGIN INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (350, 30, N'HyperV2012R2', N'Microsoft Hyper-V 2012 R2', N'WebsitePanel.Providers.Virtualization.HyperV2012R2, WebsitePanel.Providers.Virtualization.HyperV2012R2', N'HyperV', 1) END +GO + +--ES OWA Editing +IF NOT EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'EnterpriseFoldersOwaPermissions') +CREATE TABLE EnterpriseFoldersOwaPermissions +( + ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY, + ItemID INT NOT NULL, + FolderID INT NOT NULL, + AccountID INT NOT NULL +) +GO + +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS WHERE CONSTRAINT_NAME ='FK_EnterpriseFoldersOwaPermissions_AccountId') +ALTER TABLE [dbo].[EnterpriseFoldersOwaPermissions] +DROP CONSTRAINT [FK_EnterpriseFoldersOwaPermissions_AccountId] +GO + +ALTER TABLE [dbo].[EnterpriseFoldersOwaPermissions] WITH CHECK ADD CONSTRAINT [FK_EnterpriseFoldersOwaPermissions_AccountId] FOREIGN KEY([AccountID]) +REFERENCES [dbo].[ExchangeAccounts] ([AccountID]) +ON DELETE CASCADE +GO + +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS WHERE CONSTRAINT_NAME ='FK_EnterpriseFoldersOwaPermissions_FolderId') +ALTER TABLE [dbo].[EnterpriseFoldersOwaPermissions] +DROP CONSTRAINT [FK_EnterpriseFoldersOwaPermissions_FolderId] +GO + +ALTER TABLE [dbo].[EnterpriseFoldersOwaPermissions] WITH CHECK ADD CONSTRAINT [FK_EnterpriseFoldersOwaPermissions_FolderId] FOREIGN KEY([FolderID]) +REFERENCES [dbo].[EnterpriseFolders] ([EnterpriseFolderID]) +ON DELETE CASCADE +GO + + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'DeleteAllEnterpriseFolderOwaUsers') +DROP PROCEDURE DeleteAllEnterpriseFolderOwaUsers +GO +CREATE PROCEDURE [dbo].[DeleteAllEnterpriseFolderOwaUsers] +( + @ItemID int, + @FolderID int +) +AS +DELETE FROM EnterpriseFoldersOwaPermissions +WHERE ItemId = @ItemID AND FolderID = @FolderID +GO + + + + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddEnterpriseFolderOwaUser') +DROP PROCEDURE AddEnterpriseFolderOwaUser +GO +CREATE PROCEDURE [dbo].[AddEnterpriseFolderOwaUser] +( + @ESOwsaUserId INT OUTPUT, + @ItemID INT, + @FolderID INT, + @AccountID INT +) +AS +INSERT INTO EnterpriseFoldersOwaPermissions +( + ItemID , + FolderID, + AccountID +) +VALUES +( + @ItemID, + @FolderID, + @AccountID +) + +SET @ESOwsaUserId = SCOPE_IDENTITY() + +RETURN +GO + + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetEnterpriseFolderOwaUsers') +DROP PROCEDURE GetEnterpriseFolderOwaUsers +GO +CREATE PROCEDURE [dbo].[GetEnterpriseFolderOwaUsers] +( + @ItemID INT, + @FolderID INT +) +AS +SELECT + EA.AccountID, + EA.ItemID, + EA.AccountType, + EA.AccountName, + EA.DisplayName, + EA.PrimaryEmailAddress, + EA.MailEnabledPublicFolder, + EA.MailboxPlanId, + EA.SubscriberNumber, + EA.UserPrincipalName + FROM EnterpriseFoldersOwaPermissions AS EFOP + LEFT JOIN ExchangeAccounts AS EA ON EA.AccountID = EFOP.AccountID + WHERE EFOP.ItemID = @ItemID AND EFOP.FolderID = @FolderID +GO + + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetEnterpriseFolderId') +DROP PROCEDURE GetEnterpriseFolderId +GO +CREATE PROCEDURE [dbo].[GetEnterpriseFolderId] +( + @ItemID INT, + @FolderName varchar(max) +) +AS +SELECT TOP 1 + EnterpriseFolderID + FROM EnterpriseFolders + WHERE ItemId = @ItemID AND FolderName = @FolderName +GO + + + + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetUserEnterpriseFolderWithOwaEditPermission') +DROP PROCEDURE GetUserEnterpriseFolderWithOwaEditPermission +GO +CREATE PROCEDURE [dbo].[GetUserEnterpriseFolderWithOwaEditPermission] +( + @ItemID INT, + @AccountID INT +) +AS +SELECT + EF.FolderName + FROM EnterpriseFoldersOwaPermissions AS EFOP + LEFT JOIN [dbo].[EnterpriseFolders] AS EF ON EF.EnterpriseFolderID = EFOP.FolderID + WHERE EFOP.ItemID = @ItemID AND EFOP.AccountID = @AccountID GO \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/System/SystemSettings.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/System/SystemSettings.cs index 90b12d96..542a611c 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/System/SystemSettings.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/System/SystemSettings.cs @@ -44,6 +44,7 @@ namespace WebsitePanel.EnterpriseServer public const string WPI_SETTINGS = "WpiSettings"; public const string FILEMANAGER_SETTINGS = "FileManagerSettings"; public const string PACKAGE_DISPLAY_SETTINGS = "PackageDisplaySettings"; + public const string RDS_SETTINGS = "RdsSettings"; // key to access to wpi main & custom feed in wpi settings public const string WPI_MAIN_FEED_KEY = "WpiMainFeedUrl"; diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/EnterpriseStorageProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/EnterpriseStorageProxy.cs index 87682b0f..ef29192f 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/EnterpriseStorageProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/EnterpriseStorageProxy.cs @@ -81,6 +81,16 @@ namespace WebsitePanel.EnterpriseServer { private System.Threading.SendOrPostCallback SetEnterpriseFolderSettingsOperationCompleted; + private System.Threading.SendOrPostCallback SetEnterpriseFolderGeneralSettingsOperationCompleted; + + private System.Threading.SendOrPostCallback SetEnterpriseFolderPermissionSettingsOperationCompleted; + + private System.Threading.SendOrPostCallback GetFolderOwaAccountsOperationCompleted; + + private System.Threading.SendOrPostCallback SetFolderOwaAccountsOperationCompleted; + + private System.Threading.SendOrPostCallback GetUserEnterpriseFolderWithOwaEditPermissionOperationCompleted; + private System.Threading.SendOrPostCallback GetStatisticsOperationCompleted; private System.Threading.SendOrPostCallback GetStatisticsByOrganizationOperationCompleted; @@ -169,6 +179,21 @@ namespace WebsitePanel.EnterpriseServer { /// public event SetEnterpriseFolderSettingsCompletedEventHandler SetEnterpriseFolderSettingsCompleted; + /// + public event SetEnterpriseFolderGeneralSettingsCompletedEventHandler SetEnterpriseFolderGeneralSettingsCompleted; + + /// + public event SetEnterpriseFolderPermissionSettingsCompletedEventHandler SetEnterpriseFolderPermissionSettingsCompleted; + + /// + public event GetFolderOwaAccountsCompletedEventHandler GetFolderOwaAccountsCompleted; + + /// + public event SetFolderOwaAccountsCompletedEventHandler SetFolderOwaAccountsCompleted; + + /// + public event GetUserEnterpriseFolderWithOwaEditPermissionCompletedEventHandler GetUserEnterpriseFolderWithOwaEditPermissionCompleted; + /// public event GetStatisticsCompletedEventHandler GetStatisticsCompleted; @@ -1223,6 +1248,237 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetEnterpriseFolderGeneralSettings", 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 void SetEnterpriseFolderGeneralSettings(int itemId, SystemFile folder, bool directoyBrowsingEnabled, int quota, QuotaType quotaType) { + this.Invoke("SetEnterpriseFolderGeneralSettings", new object[] { + itemId, + folder, + directoyBrowsingEnabled, + quota, + quotaType}); + } + + /// + public System.IAsyncResult BeginSetEnterpriseFolderGeneralSettings(int itemId, SystemFile folder, bool directoyBrowsingEnabled, int quota, QuotaType quotaType, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("SetEnterpriseFolderGeneralSettings", new object[] { + itemId, + folder, + directoyBrowsingEnabled, + quota, + quotaType}, callback, asyncState); + } + + /// + public void EndSetEnterpriseFolderGeneralSettings(System.IAsyncResult asyncResult) { + this.EndInvoke(asyncResult); + } + + /// + public void SetEnterpriseFolderGeneralSettingsAsync(int itemId, SystemFile folder, bool directoyBrowsingEnabled, int quota, QuotaType quotaType) { + this.SetEnterpriseFolderGeneralSettingsAsync(itemId, folder, directoyBrowsingEnabled, quota, quotaType, null); + } + + /// + public void SetEnterpriseFolderGeneralSettingsAsync(int itemId, SystemFile folder, bool directoyBrowsingEnabled, int quota, QuotaType quotaType, object userState) { + if ((this.SetEnterpriseFolderGeneralSettingsOperationCompleted == null)) { + this.SetEnterpriseFolderGeneralSettingsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetEnterpriseFolderGeneralSettingsOperationCompleted); + } + this.InvokeAsync("SetEnterpriseFolderGeneralSettings", new object[] { + itemId, + folder, + directoyBrowsingEnabled, + quota, + quotaType}, this.SetEnterpriseFolderGeneralSettingsOperationCompleted, userState); + } + + private void OnSetEnterpriseFolderGeneralSettingsOperationCompleted(object arg) { + if ((this.SetEnterpriseFolderGeneralSettingsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SetEnterpriseFolderGeneralSettingsCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetEnterpriseFolderPermissionSetting" + + "s", 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 void SetEnterpriseFolderPermissionSettings(int itemId, SystemFile folder, ESPermission[] permissions) { + this.Invoke("SetEnterpriseFolderPermissionSettings", new object[] { + itemId, + folder, + permissions}); + } + + /// + public System.IAsyncResult BeginSetEnterpriseFolderPermissionSettings(int itemId, SystemFile folder, ESPermission[] permissions, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("SetEnterpriseFolderPermissionSettings", new object[] { + itemId, + folder, + permissions}, callback, asyncState); + } + + /// + public void EndSetEnterpriseFolderPermissionSettings(System.IAsyncResult asyncResult) { + this.EndInvoke(asyncResult); + } + + /// + public void SetEnterpriseFolderPermissionSettingsAsync(int itemId, SystemFile folder, ESPermission[] permissions) { + this.SetEnterpriseFolderPermissionSettingsAsync(itemId, folder, permissions, null); + } + + /// + public void SetEnterpriseFolderPermissionSettingsAsync(int itemId, SystemFile folder, ESPermission[] permissions, object userState) { + if ((this.SetEnterpriseFolderPermissionSettingsOperationCompleted == null)) { + this.SetEnterpriseFolderPermissionSettingsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetEnterpriseFolderPermissionSettingsOperationCompleted); + } + this.InvokeAsync("SetEnterpriseFolderPermissionSettings", new object[] { + itemId, + folder, + permissions}, this.SetEnterpriseFolderPermissionSettingsOperationCompleted, userState); + } + + private void OnSetEnterpriseFolderPermissionSettingsOperationCompleted(object arg) { + if ((this.SetEnterpriseFolderPermissionSettingsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SetEnterpriseFolderPermissionSettingsCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetFolderOwaAccounts", 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 OrganizationUser[] GetFolderOwaAccounts(int itemId, SystemFile folder) { + object[] results = this.Invoke("GetFolderOwaAccounts", new object[] { + itemId, + folder}); + return ((OrganizationUser[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetFolderOwaAccounts(int itemId, SystemFile folder, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetFolderOwaAccounts", new object[] { + itemId, + folder}, callback, asyncState); + } + + /// + public OrganizationUser[] EndGetFolderOwaAccounts(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((OrganizationUser[])(results[0])); + } + + /// + public void GetFolderOwaAccountsAsync(int itemId, SystemFile folder) { + this.GetFolderOwaAccountsAsync(itemId, folder, null); + } + + /// + public void GetFolderOwaAccountsAsync(int itemId, SystemFile folder, object userState) { + if ((this.GetFolderOwaAccountsOperationCompleted == null)) { + this.GetFolderOwaAccountsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetFolderOwaAccountsOperationCompleted); + } + this.InvokeAsync("GetFolderOwaAccounts", new object[] { + itemId, + folder}, this.GetFolderOwaAccountsOperationCompleted, userState); + } + + private void OnGetFolderOwaAccountsOperationCompleted(object arg) { + if ((this.GetFolderOwaAccountsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetFolderOwaAccountsCompleted(this, new GetFolderOwaAccountsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetFolderOwaAccounts", 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 void SetFolderOwaAccounts(int itemId, SystemFile folder, OrganizationUser[] users) { + this.Invoke("SetFolderOwaAccounts", new object[] { + itemId, + folder, + users}); + } + + /// + public System.IAsyncResult BeginSetFolderOwaAccounts(int itemId, SystemFile folder, OrganizationUser[] users, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("SetFolderOwaAccounts", new object[] { + itemId, + folder, + users}, callback, asyncState); + } + + /// + public void EndSetFolderOwaAccounts(System.IAsyncResult asyncResult) { + this.EndInvoke(asyncResult); + } + + /// + public void SetFolderOwaAccountsAsync(int itemId, SystemFile folder, OrganizationUser[] users) { + this.SetFolderOwaAccountsAsync(itemId, folder, users, null); + } + + /// + public void SetFolderOwaAccountsAsync(int itemId, SystemFile folder, OrganizationUser[] users, object userState) { + if ((this.SetFolderOwaAccountsOperationCompleted == null)) { + this.SetFolderOwaAccountsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetFolderOwaAccountsOperationCompleted); + } + this.InvokeAsync("SetFolderOwaAccounts", new object[] { + itemId, + folder, + users}, this.SetFolderOwaAccountsOperationCompleted, userState); + } + + private void OnSetFolderOwaAccountsOperationCompleted(object arg) { + if ((this.SetFolderOwaAccountsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SetFolderOwaAccountsCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetUserEnterpriseFolderWithOwaEditPe" + + "rmission", 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 string[] GetUserEnterpriseFolderWithOwaEditPermission(int itemId, int[] accountIds) { + object[] results = this.Invoke("GetUserEnterpriseFolderWithOwaEditPermission", new object[] { + itemId, + accountIds}); + return ((string[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetUserEnterpriseFolderWithOwaEditPermission(int itemId, int[] accountIds, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetUserEnterpriseFolderWithOwaEditPermission", new object[] { + itemId, + accountIds}, callback, asyncState); + } + + /// + public string[] EndGetUserEnterpriseFolderWithOwaEditPermission(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((string[])(results[0])); + } + + /// + public void GetUserEnterpriseFolderWithOwaEditPermissionAsync(int itemId, int[] accountIds) { + this.GetUserEnterpriseFolderWithOwaEditPermissionAsync(itemId, accountIds, null); + } + + /// + public void GetUserEnterpriseFolderWithOwaEditPermissionAsync(int itemId, int[] accountIds, object userState) { + if ((this.GetUserEnterpriseFolderWithOwaEditPermissionOperationCompleted == null)) { + this.GetUserEnterpriseFolderWithOwaEditPermissionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetUserEnterpriseFolderWithOwaEditPermissionOperationCompleted); + } + this.InvokeAsync("GetUserEnterpriseFolderWithOwaEditPermission", new object[] { + itemId, + accountIds}, this.GetUserEnterpriseFolderWithOwaEditPermissionOperationCompleted, userState); + } + + private void OnGetUserEnterpriseFolderWithOwaEditPermissionOperationCompleted(object arg) { + if ((this.GetUserEnterpriseFolderWithOwaEditPermissionCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetUserEnterpriseFolderWithOwaEditPermissionCompleted(this, new GetUserEnterpriseFolderWithOwaEditPermissionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetStatistics", 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 OrganizationStatistics GetStatistics(int itemId) { @@ -2053,6 +2309,70 @@ namespace WebsitePanel.EnterpriseServer { [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void SetEnterpriseFolderSettingsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void SetEnterpriseFolderGeneralSettingsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void SetEnterpriseFolderPermissionSettingsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetFolderOwaAccountsCompletedEventHandler(object sender, GetFolderOwaAccountsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetFolderOwaAccountsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetFolderOwaAccountsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public OrganizationUser[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((OrganizationUser[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void SetFolderOwaAccountsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetUserEnterpriseFolderWithOwaEditPermissionCompletedEventHandler(object sender, GetUserEnterpriseFolderWithOwaEditPermissionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetUserEnterpriseFolderWithOwaEditPermissionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetUserEnterpriseFolderWithOwaEditPermissionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public string[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((string[])(this.results[0])); + } + } + } + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void GetStatisticsCompletedEventHandler(object sender, GetStatisticsCompletedEventArgs e); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs index 3214d80d..057bbe31 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs @@ -18,9 +18,9 @@ namespace WebsitePanel.EnterpriseServer { using System.Web.Services.Protocols; using System; using System.Diagnostics; + using WebsitePanel.Providers.HostedSolution; using WebsitePanel.Providers.RemoteDesktopServices; using WebsitePanel.Providers.Common; - using WebsitePanel.Providers.HostedSolution; /// @@ -120,6 +120,14 @@ namespace WebsitePanel.EnterpriseServer { private System.Threading.SendOrPostCallback InstallSessionHostsCertificateOperationCompleted; + private System.Threading.SendOrPostCallback GetRdsCertificateByServiceIdOperationCompleted; + + private System.Threading.SendOrPostCallback GetRdsCertificateByItemIdOperationCompleted; + + private System.Threading.SendOrPostCallback AddRdsCertificateOperationCompleted; + + private System.Threading.SendOrPostCallback GetRdsServicesOperationCompleted; + /// public esRemoteDesktopServices() { this.Url = "http://localhost:9002/esRemoteDesktopServices.asmx"; @@ -260,6 +268,18 @@ namespace WebsitePanel.EnterpriseServer { /// public event InstallSessionHostsCertificateCompletedEventHandler InstallSessionHostsCertificateCompleted; + /// + public event GetRdsCertificateByServiceIdCompletedEventHandler GetRdsCertificateByServiceIdCompleted; + + /// + public event GetRdsCertificateByItemIdCompletedEventHandler GetRdsCertificateByItemIdCompleted; + + /// + public event AddRdsCertificateCompletedEventHandler AddRdsCertificateCompleted; + + /// + public event GetRdsServicesCompletedEventHandler GetRdsServicesCompleted; + /// [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) { @@ -1984,7 +2004,7 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsServerInfo", 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 RdsServerInfo GetRdsServerInfo(int itemId, string fqdnName) { + public RdsServerInfo GetRdsServerInfo([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] System.Nullable itemId, string fqdnName) { object[] results = this.Invoke("GetRdsServerInfo", new object[] { itemId, fqdnName}); @@ -1992,7 +2012,7 @@ namespace WebsitePanel.EnterpriseServer { } /// - public System.IAsyncResult BeginGetRdsServerInfo(int itemId, string fqdnName, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginGetRdsServerInfo(System.Nullable itemId, string fqdnName, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetRdsServerInfo", new object[] { itemId, fqdnName}, callback, asyncState); @@ -2005,12 +2025,12 @@ namespace WebsitePanel.EnterpriseServer { } /// - public void GetRdsServerInfoAsync(int itemId, string fqdnName) { + public void GetRdsServerInfoAsync(System.Nullable itemId, string fqdnName) { this.GetRdsServerInfoAsync(itemId, fqdnName, null); } /// - public void GetRdsServerInfoAsync(int itemId, string fqdnName, object userState) { + public void GetRdsServerInfoAsync(System.Nullable itemId, string fqdnName, object userState) { if ((this.GetRdsServerInfoOperationCompleted == null)) { this.GetRdsServerInfoOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetRdsServerInfoOperationCompleted); } @@ -2028,7 +2048,7 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsServerStatus", 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 string GetRdsServerStatus(int itemId, string fqdnName) { + public string GetRdsServerStatus([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] System.Nullable itemId, string fqdnName) { object[] results = this.Invoke("GetRdsServerStatus", new object[] { itemId, fqdnName}); @@ -2036,7 +2056,7 @@ namespace WebsitePanel.EnterpriseServer { } /// - public System.IAsyncResult BeginGetRdsServerStatus(int itemId, string fqdnName, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginGetRdsServerStatus(System.Nullable itemId, string fqdnName, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetRdsServerStatus", new object[] { itemId, fqdnName}, callback, asyncState); @@ -2049,12 +2069,12 @@ namespace WebsitePanel.EnterpriseServer { } /// - public void GetRdsServerStatusAsync(int itemId, string fqdnName) { + public void GetRdsServerStatusAsync(System.Nullable itemId, string fqdnName) { this.GetRdsServerStatusAsync(itemId, fqdnName, null); } /// - public void GetRdsServerStatusAsync(int itemId, string fqdnName, object userState) { + public void GetRdsServerStatusAsync(System.Nullable itemId, string fqdnName, object userState) { if ((this.GetRdsServerStatusOperationCompleted == null)) { this.GetRdsServerStatusOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetRdsServerStatusOperationCompleted); } @@ -2072,7 +2092,7 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/ShutDownRdsServer", 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 ResultObject ShutDownRdsServer(int itemId, string fqdnName) { + public ResultObject ShutDownRdsServer([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] System.Nullable itemId, string fqdnName) { object[] results = this.Invoke("ShutDownRdsServer", new object[] { itemId, fqdnName}); @@ -2080,7 +2100,7 @@ namespace WebsitePanel.EnterpriseServer { } /// - public System.IAsyncResult BeginShutDownRdsServer(int itemId, string fqdnName, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginShutDownRdsServer(System.Nullable itemId, string fqdnName, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("ShutDownRdsServer", new object[] { itemId, fqdnName}, callback, asyncState); @@ -2093,12 +2113,12 @@ namespace WebsitePanel.EnterpriseServer { } /// - public void ShutDownRdsServerAsync(int itemId, string fqdnName) { + public void ShutDownRdsServerAsync(System.Nullable itemId, string fqdnName) { this.ShutDownRdsServerAsync(itemId, fqdnName, null); } /// - public void ShutDownRdsServerAsync(int itemId, string fqdnName, object userState) { + public void ShutDownRdsServerAsync(System.Nullable itemId, string fqdnName, object userState) { if ((this.ShutDownRdsServerOperationCompleted == null)) { this.ShutDownRdsServerOperationCompleted = new System.Threading.SendOrPostCallback(this.OnShutDownRdsServerOperationCompleted); } @@ -2116,7 +2136,7 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/RestartRdsServer", 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 ResultObject RestartRdsServer(int itemId, string fqdnName) { + public ResultObject RestartRdsServer([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] System.Nullable itemId, string fqdnName) { object[] results = this.Invoke("RestartRdsServer", new object[] { itemId, fqdnName}); @@ -2124,7 +2144,7 @@ namespace WebsitePanel.EnterpriseServer { } /// - public System.IAsyncResult BeginRestartRdsServer(int itemId, string fqdnName, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginRestartRdsServer(System.Nullable itemId, string fqdnName, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("RestartRdsServer", new object[] { itemId, fqdnName}, callback, asyncState); @@ -2137,12 +2157,12 @@ namespace WebsitePanel.EnterpriseServer { } /// - public void RestartRdsServerAsync(int itemId, string fqdnName) { + public void RestartRdsServerAsync(System.Nullable itemId, string fqdnName) { this.RestartRdsServerAsync(itemId, fqdnName, null); } /// - public void RestartRdsServerAsync(int itemId, string fqdnName, object userState) { + public void RestartRdsServerAsync(System.Nullable itemId, string fqdnName, object userState) { if ((this.RestartRdsServerOperationCompleted == null)) { this.RestartRdsServerOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRestartRdsServerOperationCompleted); } @@ -2245,20 +2265,16 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/InstallSessionHostsCertificate", 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 ResultObject InstallSessionHostsCertificate(int collectionId, [System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")] byte[] certificate, string password) { + public ResultObject InstallSessionHostsCertificate(RdsServer rdsServer) { object[] results = this.Invoke("InstallSessionHostsCertificate", new object[] { - collectionId, - certificate, - password}); + rdsServer}); return ((ResultObject)(results[0])); } /// - public System.IAsyncResult BeginInstallSessionHostsCertificate(int collectionId, byte[] certificate, string password, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginInstallSessionHostsCertificate(RdsServer rdsServer, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("InstallSessionHostsCertificate", new object[] { - collectionId, - certificate, - password}, callback, asyncState); + rdsServer}, callback, asyncState); } /// @@ -2268,19 +2284,17 @@ namespace WebsitePanel.EnterpriseServer { } /// - public void InstallSessionHostsCertificateAsync(int collectionId, byte[] certificate, string password) { - this.InstallSessionHostsCertificateAsync(collectionId, certificate, password, null); + public void InstallSessionHostsCertificateAsync(RdsServer rdsServer) { + this.InstallSessionHostsCertificateAsync(rdsServer, null); } /// - public void InstallSessionHostsCertificateAsync(int collectionId, byte[] certificate, string password, object userState) { + public void InstallSessionHostsCertificateAsync(RdsServer rdsServer, object userState) { if ((this.InstallSessionHostsCertificateOperationCompleted == null)) { this.InstallSessionHostsCertificateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnInstallSessionHostsCertificateOperationCompleted); } this.InvokeAsync("InstallSessionHostsCertificate", new object[] { - collectionId, - certificate, - password}, this.InstallSessionHostsCertificateOperationCompleted, userState); + rdsServer}, this.InstallSessionHostsCertificateOperationCompleted, userState); } private void OnInstallSessionHostsCertificateOperationCompleted(object arg) { @@ -2290,6 +2304,167 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsCertificateByServiceId", 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 RdsCertificate GetRdsCertificateByServiceId(int serviceId) { + object[] results = this.Invoke("GetRdsCertificateByServiceId", new object[] { + serviceId}); + return ((RdsCertificate)(results[0])); + } + + /// + public System.IAsyncResult BeginGetRdsCertificateByServiceId(int serviceId, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetRdsCertificateByServiceId", new object[] { + serviceId}, callback, asyncState); + } + + /// + public RdsCertificate EndGetRdsCertificateByServiceId(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((RdsCertificate)(results[0])); + } + + /// + public void GetRdsCertificateByServiceIdAsync(int serviceId) { + this.GetRdsCertificateByServiceIdAsync(serviceId, null); + } + + /// + public void GetRdsCertificateByServiceIdAsync(int serviceId, object userState) { + if ((this.GetRdsCertificateByServiceIdOperationCompleted == null)) { + this.GetRdsCertificateByServiceIdOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetRdsCertificateByServiceIdOperationCompleted); + } + this.InvokeAsync("GetRdsCertificateByServiceId", new object[] { + serviceId}, this.GetRdsCertificateByServiceIdOperationCompleted, userState); + } + + private void OnGetRdsCertificateByServiceIdOperationCompleted(object arg) { + if ((this.GetRdsCertificateByServiceIdCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetRdsCertificateByServiceIdCompleted(this, new GetRdsCertificateByServiceIdCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsCertificateByItemId", 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 RdsCertificate GetRdsCertificateByItemId([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] System.Nullable itemId) { + object[] results = this.Invoke("GetRdsCertificateByItemId", new object[] { + itemId}); + return ((RdsCertificate)(results[0])); + } + + /// + public System.IAsyncResult BeginGetRdsCertificateByItemId(System.Nullable itemId, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetRdsCertificateByItemId", new object[] { + itemId}, callback, asyncState); + } + + /// + public RdsCertificate EndGetRdsCertificateByItemId(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((RdsCertificate)(results[0])); + } + + /// + public void GetRdsCertificateByItemIdAsync(System.Nullable itemId) { + this.GetRdsCertificateByItemIdAsync(itemId, null); + } + + /// + public void GetRdsCertificateByItemIdAsync(System.Nullable itemId, object userState) { + if ((this.GetRdsCertificateByItemIdOperationCompleted == null)) { + this.GetRdsCertificateByItemIdOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetRdsCertificateByItemIdOperationCompleted); + } + this.InvokeAsync("GetRdsCertificateByItemId", new object[] { + itemId}, this.GetRdsCertificateByItemIdOperationCompleted, userState); + } + + private void OnGetRdsCertificateByItemIdOperationCompleted(object arg) { + if ((this.GetRdsCertificateByItemIdCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetRdsCertificateByItemIdCompleted(this, new GetRdsCertificateByItemIdCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddRdsCertificate", 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 ResultObject AddRdsCertificate(RdsCertificate certificate) { + object[] results = this.Invoke("AddRdsCertificate", new object[] { + certificate}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginAddRdsCertificate(RdsCertificate certificate, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("AddRdsCertificate", new object[] { + certificate}, callback, asyncState); + } + + /// + public ResultObject EndAddRdsCertificate(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void AddRdsCertificateAsync(RdsCertificate certificate) { + this.AddRdsCertificateAsync(certificate, null); + } + + /// + public void AddRdsCertificateAsync(RdsCertificate certificate, object userState) { + if ((this.AddRdsCertificateOperationCompleted == null)) { + this.AddRdsCertificateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddRdsCertificateOperationCompleted); + } + this.InvokeAsync("AddRdsCertificate", new object[] { + certificate}, this.AddRdsCertificateOperationCompleted, userState); + } + + private void OnAddRdsCertificateOperationCompleted(object arg) { + if ((this.AddRdsCertificateCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AddRdsCertificateCompleted(this, new AddRdsCertificateCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsServices", 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 ServiceInfo[] GetRdsServices() { + object[] results = this.Invoke("GetRdsServices", new object[0]); + return ((ServiceInfo[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetRdsServices(System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetRdsServices", new object[0], callback, asyncState); + } + + /// + public ServiceInfo[] EndGetRdsServices(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((ServiceInfo[])(results[0])); + } + + /// + public void GetRdsServicesAsync() { + this.GetRdsServicesAsync(null); + } + + /// + public void GetRdsServicesAsync(object userState) { + if ((this.GetRdsServicesOperationCompleted == null)) { + this.GetRdsServicesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetRdsServicesOperationCompleted); + } + this.InvokeAsync("GetRdsServices", new object[0], this.GetRdsServicesOperationCompleted, userState); + } + + private void OnGetRdsServicesOperationCompleted(object arg) { + if ((this.GetRdsServicesCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetRdsServicesCompleted(this, new GetRdsServicesCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// public new void CancelAsync(object userState) { base.CancelAsync(userState); @@ -3465,4 +3640,108 @@ namespace WebsitePanel.EnterpriseServer { } } } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetRdsCertificateByServiceIdCompletedEventHandler(object sender, GetRdsCertificateByServiceIdCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetRdsCertificateByServiceIdCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetRdsCertificateByServiceIdCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public RdsCertificate Result { + get { + this.RaiseExceptionIfNecessary(); + return ((RdsCertificate)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetRdsCertificateByItemIdCompletedEventHandler(object sender, GetRdsCertificateByItemIdCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetRdsCertificateByItemIdCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetRdsCertificateByItemIdCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public RdsCertificate Result { + get { + this.RaiseExceptionIfNecessary(); + return ((RdsCertificate)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void AddRdsCertificateCompletedEventHandler(object sender, AddRdsCertificateCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AddRdsCertificateCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal AddRdsCertificateCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public ResultObject Result { + get { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetRdsServicesCompletedEventHandler(object sender, GetRdsServicesCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetRdsServicesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetRdsServicesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public ServiceInfo[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((ServiceInfo[])(this.results[0])); + } + } + } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs index 1d903a9c..d83c4684 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs @@ -4543,6 +4543,69 @@ namespace WebsitePanel.EnterpriseServer ); } + public static void DeleteAllEnterpriseFolderOwaUsers(int itemId, int folderId) + { + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "DeleteAllEnterpriseFolderOwaUsers", + new SqlParameter("@ItemID", itemId), + new SqlParameter("@FolderID", folderId) + ); + } + + public static int AddEnterpriseFolderOwaUser(int itemId, int folderId, int accountId) + { + SqlParameter id = new SqlParameter("@ESOwsaUserId", SqlDbType.Int); + id.Direction = ParameterDirection.Output; + + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "AddEnterpriseFolderOwaUser", + id, + new SqlParameter("@ItemID", itemId), + new SqlParameter("@FolderID", folderId), + new SqlParameter("@AccountId", accountId) + ); + + // read identity + return Convert.ToInt32(id.Value); + } + + public static IDataReader GetEnterpriseFolderOwaUsers(int itemId, int folderId) + { + return SqlHelper.ExecuteReader( + ConnectionString, + CommandType.StoredProcedure, + "GetEnterpriseFolderOwaUsers", + new SqlParameter("@ItemID", itemId), + new SqlParameter("@FolderID", folderId) + ); + } + + public static IDataReader GetEnterpriseFolderId(int itemId, string folderName) + { + return SqlHelper.ExecuteReader( + ConnectionString, + CommandType.StoredProcedure, + "GetEnterpriseFolderId", + new SqlParameter("@ItemID", itemId), + new SqlParameter("@FolderName", folderName) + ); + } + + public static IDataReader GetUserEnterpriseFolderWithOwaEditPermission(int itemId, int accountId) + { + return SqlHelper.ExecuteReader( + ConnectionString, + CommandType.StoredProcedure, + "GetUserEnterpriseFolderWithOwaEditPermission", + new SqlParameter("@ItemID", itemId), + new SqlParameter("@AccountID", accountId) + ); + } + #endregion #region Support Service Levels @@ -4613,6 +4676,37 @@ namespace WebsitePanel.EnterpriseServer #region RDS + public static int AddRdsCertificate(int serviceId, string content, byte[] hash, string fileName, DateTime? validFrom, DateTime? expiryDate) + { + SqlParameter rdsCertificateId = new SqlParameter("@RDSCertificateID", SqlDbType.Int); + rdsCertificateId.Direction = ParameterDirection.Output; + + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "AddRDSCertificate", + rdsCertificateId, + new SqlParameter("@ServiceId", serviceId), + new SqlParameter("@Content", content), + new SqlParameter("@Hash", Convert.ToBase64String(hash)), + new SqlParameter("@FileName", fileName), + new SqlParameter("@ValidFrom", validFrom), + new SqlParameter("@ExpiryDate", expiryDate) + ); + + return Convert.ToInt32(rdsCertificateId.Value); + } + + public static IDataReader GetRdsCertificateByServiceId(int serviceId) + { + return SqlHelper.ExecuteReader( + ConnectionString, + CommandType.StoredProcedure, + "GetRDSCertificateByServiceId", + new SqlParameter("@ServiceId", serviceId) + ); + } + public static IDataReader GetRdsCollectionSettingsByCollectionId(int collectionId) { return SqlHelper.ExecuteReader( diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/DnsServers/DnsServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/DnsServers/DnsServerController.cs index d659f9aa..bab622ac 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/DnsServers/DnsServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/DnsServers/DnsServerController.cs @@ -32,6 +32,7 @@ using System.Collections.Specialized; using System.Globalization; using System.Linq; using System.Xml; +using System.Text; using System.Xml.Serialization; using WebsitePanel.Providers; using WebsitePanel.Providers.DNS; @@ -385,7 +386,9 @@ namespace WebsitePanel.EnterpriseServer var idn = new IdnMapping(); if (itemType == typeof(DnsZone)) - items.AddRange(dns.GetZones().Select(z => idn.GetUnicode(z))); + items.AddRange(dns.GetZones().Select(z => + Encoding.UTF8.GetByteCount(z) == z.Length ? // IsASCII + idn.GetUnicode(z) : z )); return items; } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs index d7fbc832..6402a7b0 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs @@ -152,6 +152,16 @@ namespace WebsitePanel.EnterpriseServer StartESBackgroundTaskInternal("SET_ENTERPRISE_FOLDER_SETTINGS", itemId, folder, permissions, directoyBrowsingEnabled, quota, quotaType); } + public static void SetESGeneralSettings(int itemId, SystemFile folder, bool directoyBrowsingEnabled, int quota, QuotaType quotaType) + { + SetESGeneralSettingsInternal("SET_ENTERPRISE_FOLDER_GENERAL_SETTINGS", itemId, folder, directoyBrowsingEnabled, quota, quotaType); + } + + public static void SetESFolderPermissionSettings(int itemId, SystemFile folder, ESPermission[] permissions) + { + SetESFolderPermissionSettingsInternal("SET_ENTERPRISE_FOLDER_GENERAL_SETTINGS", itemId, folder, permissions); + } + public static int AddWebDavAccessToken(WebDavAccessToken accessToken) { return DataProvider.AddWebDavAccessToken(accessToken); @@ -257,6 +267,69 @@ namespace WebsitePanel.EnterpriseServer return rootFolders; } + protected static void SetESGeneralSettingsInternal(string taskName, int itemId, SystemFile folder, bool directoyBrowsingEnabled, int quota, QuotaType quotaType) + { + // load organization + var org = OrganizationController.GetOrganization(itemId); + + try + { + TaskManager.StartTask("ENTERPRISE_STORAGE", taskName, org.PackageId); + + EnterpriseStorageController.SetFRSMQuotaOnFolder(itemId, folder.Name, quota, quotaType); + EnterpriseStorageController.SetDirectoryBrowseEnabled(itemId, folder.Url, directoyBrowsingEnabled); + } + catch (Exception ex) + { + // log error + TaskManager.WriteError(ex, "Error executing enterprise storage background task"); + } + finally + { + // complete task + try + { + TaskManager.CompleteTask(); + } + catch (Exception) + { + } + } + } + + protected static void SetESFolderPermissionSettingsInternal(string taskName, int itemId, SystemFile folder, ESPermission[] permissions) + { + // load organization + var org = OrganizationController.GetOrganization(itemId); + + new Thread(() => + { + try + { + TaskManager.StartTask("ENTERPRISE_STORAGE", taskName, org.PackageId); + + EnterpriseStorageController.SetFolderPermission(itemId, folder.Name, permissions); + } + catch (Exception ex) + { + // log error + TaskManager.WriteError(ex, "Error executing enterprise storage background task"); + } + finally + { + // complete task + try + { + TaskManager.CompleteTask(); + } + catch (Exception) + { + } + } + + }).Start(); + } + protected static void StartESBackgroundTaskInternal(string taskName, int itemId, SystemFile folder, ESPermission[] permissions, bool directoyBrowsingEnabled, int quota, QuotaType quotaType) { // load organization @@ -1265,6 +1338,87 @@ namespace WebsitePanel.EnterpriseServer return null; } + public static OrganizationUser[] GetFolderOwaAccounts(int itemId, string folderName) + { + try + { + var folderId = GetFolderId(itemId, folderName); + + var users = ObjectUtils.CreateListFromDataReader(DataProvider.GetEnterpriseFolderOwaUsers(itemId, folderId)); + + return users.ToArray(); + } + catch (Exception ex) + { + throw ex; + } + } + + public static void SetFolderOwaAccounts(int itemId, string folderName, OrganizationUser[] users) + { + try + { + var folderId = GetFolderId(itemId, folderName); + + DataProvider.DeleteAllEnterpriseFolderOwaUsers(itemId, folderId); + + foreach (var user in users) + { + DataProvider.AddEnterpriseFolderOwaUser(itemId, folderId, user.AccountId); + } + } + catch (Exception ex) + { + throw ex; + } + } + + protected static int GetFolderId(int itemId, string folderName) + { + try + { + GetFolder(itemId, folderName); + + var dataReader = DataProvider.GetEnterpriseFolderId(itemId, folderName); + + while (dataReader.Read()) + { + return (int)dataReader[0]; + } + + return -1; + } + catch (Exception ex) + { + throw ex; + } + } + + public static List GetUserEnterpriseFolderWithOwaEditPermission(int itemId, List accountIds) + { + try + { + var result = new List(); + + + foreach (var accountId in accountIds) + { + var reader = DataProvider.GetUserEnterpriseFolderWithOwaEditPermission(itemId, accountId); + + while (reader.Read()) + { + result.Add(Convert.ToString(reader["FolderName"])); + } + } + + return result.Distinct().ToList(); + } + catch (Exception ex) + { + throw ex; + } + } + #region WebDav portal public static string GetWebDavPortalUserSettingsByAccountId(int accountId) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs index 269add07..e9da405c 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs @@ -248,22 +248,22 @@ namespace WebsitePanel.EnterpriseServer return GetRdsCollectionSessionHostsInternal(collectionId); } - public static RdsServerInfo GetRdsServerInfo(int itemId, string fqdnName) + public static RdsServerInfo GetRdsServerInfo(int? itemId, string fqdnName) { return GetRdsServerInfoInternal(itemId, fqdnName); } - public static string GetRdsServerStatus(int itemId, string fqdnName) + public static string GetRdsServerStatus(int? itemId, string fqdnName) { return GetRdsServerStatusInternal(itemId, fqdnName); } - public static ResultObject ShutDownRdsServer(int itemId, string fqdnName) + public static ResultObject ShutDownRdsServer(int? itemId, string fqdnName) { return ShutDownRdsServerInternal(itemId, fqdnName); } - public static ResultObject RestartRdsServer(int itemId, string fqdnName) + public static ResultObject RestartRdsServer(int? itemId, string fqdnName) { return RestartRdsServerInternal(itemId, fqdnName); } @@ -278,31 +278,53 @@ namespace WebsitePanel.EnterpriseServer return SaveRdsCollectionLocalAdminsInternal(users, collectionId); } - public static ResultObject InstallSessionHostsCertificate(int collectionId, byte[] certificate, string password) + public static ResultObject InstallSessionHostsCertificate(RdsServer rdsServer) { - return InstallSessionHostsCertificateInternal(collectionId, certificate, password); + return InstallSessionHostsCertificateInternal(rdsServer); } - private static ResultObject InstallSessionHostsCertificateInternal(int collectionId, byte[] certificate, string password) + public static RdsCertificate GetRdsCertificateByServiceId(int serviceId) + { + return GetRdsCertificateByServiceIdInternal(serviceId); + } + + public static RdsCertificate GetRdsCertificateByItemId(int? itemId) + { + return GetRdsCertificateByItemIdInternal(itemId); + } + + public static ResultObject AddRdsCertificate(RdsCertificate certificate) + { + return AddRdsCertificateInternal(certificate); + } + + public static List GetRdsServices() + { + return GetRdsServicesInternal(); + } + + private static List GetRdsServicesInternal() + { + return ObjectUtils.CreateListFromDataSet(DataProvider.GetServicesByGroupName(SecurityContext.User.UserId, ResourceGroups.RDS)); + } + + private static ResultObject InstallSessionHostsCertificateInternal(RdsServer rdsServer) { var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "INSTALL_CERTIFICATE"); try - { - var collection = ObjectUtils.FillObjectFromDataReader(DataProvider.GetRDSCollectionById(collectionId)); - Organization org = OrganizationController.GetOrganization(collection.ItemId); + { + int serviceId = GetRdsServiceId(rdsServer.ItemId); + var rds = GetRemoteDesktopServices(serviceId); + var certificate = GetRdsCertificateByServiceIdInternal(serviceId); + + var array = Convert.FromBase64String(certificate.Hash); + char[] chars = new char[array.Length / sizeof(char)]; + System.Buffer.BlockCopy(array, 0, chars, 0, array.Length); + string password = new string(chars); + byte[] content = Convert.FromBase64String(certificate.Content); - if (org == null) - { - result.IsSuccess = false; - result.AddError("", new NullReferenceException("Organization not found")); - return result; - } - - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); - var servers = ObjectUtils.CreateListFromDataReader(DataProvider.GetRDSServersByCollectionId(collection.Id)).ToList(); - - rds.InstallCertificate(certificate, password, servers.Select(s => s.FqdName).ToArray()); + rds.InstallCertificate(content, password, new string[] {rdsServer.FqdName}); } catch (Exception ex) { @@ -323,6 +345,57 @@ namespace WebsitePanel.EnterpriseServer return result; } + private static RdsCertificate GetRdsCertificateByServiceIdInternal(int serviceId) + { + var result = ObjectUtils.FillObjectFromDataReader(DataProvider.GetRdsCertificateByServiceId(serviceId)); + + return result; + } + + private static RdsCertificate GetRdsCertificateByItemIdInternal(int? itemId) + { + int serviceId = GetRdsServiceId(itemId); + var result = ObjectUtils.FillObjectFromDataReader(DataProvider.GetRdsCertificateByServiceId(serviceId)); + + return result; + } + + private static ResultObject AddRdsCertificateInternal(RdsCertificate certificate) + { + var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "ADD_RDS_SERVER"); + + try + { + byte[] hash = new byte[certificate.Hash.Length * sizeof(char)]; + System.Buffer.BlockCopy(certificate.Hash.ToCharArray(), 0, hash, 0, hash.Length); + certificate.Id = DataProvider.AddRdsCertificate(certificate.ServiceId, certificate.Content, hash, certificate.FileName, certificate.ValidFrom, certificate.ExpiryDate); + } + catch (Exception ex) + { + if (ex.InnerException != null) + { + result.AddError("Unable to add RDS Certificate", ex.InnerException); + } + else + { + result.AddError("Unable to add RDS Certificate", ex); + } + } + finally + { + if (!result.IsSuccess) + { + TaskManager.CompleteResultTask(result); + } + else + { + TaskManager.CompleteResultTask(); + } + } + + return result; + } + private static RdsCollection GetRdsCollectionInternal(int collectionId) { var collection = ObjectUtils.FillObjectFromDataReader(DataProvider.GetRDSCollectionById(collectionId)); @@ -370,9 +443,9 @@ namespace WebsitePanel.EnterpriseServer var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); var organizationUsers = OrganizationController.GetOrganizationUsersPaged(collection.ItemId, null, null, null, 0, Int32.MaxValue).PageUsers; - var organizationAdmins = rds.GetRdsCollectionLocalAdmins(servers.First().FqdName); + var organizationAdmins = rds.GetRdsCollectionLocalAdmins(org.OrganizationId, collection.Name); - return organizationUsers.Where(o => organizationAdmins.Select(a => a.ToLower()).Contains(o.DomainUserName.ToLower())).ToList(); + return organizationUsers.Where(o => organizationAdmins.Select(a => a.ToLower()).Contains(o.SamAccountName.ToLower())).ToList(); } private static ResultObject SaveRdsCollectionLocalAdminsInternal(OrganizationUser[] users, int collectionId) @@ -394,7 +467,7 @@ namespace WebsitePanel.EnterpriseServer var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); var servers = ObjectUtils.CreateListFromDataReader(DataProvider.GetRDSServersByCollectionId(collection.Id)).ToList(); - rds.SaveRdsCollectionLocalAdmins(users, servers.Select(s => s.FqdName).ToArray()); + rds.SaveRdsCollectionLocalAdmins(users.Select(u => u.AccountName).ToArray(), servers.Select(s => s.FqdName).ToArray(), org.OrganizationId, collection.Name); } catch (Exception ex) { @@ -420,19 +493,22 @@ namespace WebsitePanel.EnterpriseServer var collection = ObjectUtils.FillObjectFromDataReader(DataProvider.GetRDSCollectionById(collectionId)); var settings = ObjectUtils.FillObjectFromDataReader(DataProvider.GetRdsCollectionSettingsByCollectionId(collectionId)); - if (settings.SecurityLayer == null) + if (settings != null) { - settings.SecurityLayer = SecurityLayerValues.Negotiate.ToString(); - } + if (settings.SecurityLayer == null) + { + settings.SecurityLayer = SecurityLayerValues.Negotiate.ToString(); + } - if (settings.EncryptionLevel == null) - { - settings.EncryptionLevel = EncryptionLevel.ClientCompatible.ToString(); - } + if (settings.EncryptionLevel == null) + { + settings.EncryptionLevel = EncryptionLevel.ClientCompatible.ToString(); + } - if (settings.AuthenticateUsingNLA == null) - { - settings.AuthenticateUsingNLA = true; + if (settings.AuthenticateUsingNLA == null) + { + settings.AuthenticateUsingNLA = true; + } } return settings; @@ -453,17 +529,31 @@ namespace WebsitePanel.EnterpriseServer private static int AddRdsCollectionInternal(int itemId, RdsCollection collection) { var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "ADD_RDS_COLLECTION"); + var domainName = IPGlobalProperties.GetIPGlobalProperties().DomainName; try { - // load organization Organization org = OrganizationController.GetOrganization(itemId); if (org == null) - { + { return -1; } var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + + foreach(var server in collection.Servers) + { + if (!server.FqdName.EndsWith(domainName, StringComparison.CurrentCultureIgnoreCase)) + { + throw TaskManager.WriteError(new Exception("Fully Qualified Domain Name not valid.")); + } + + if (!rds.CheckRDSServerAvaliable(server.FqdName)) + { + throw TaskManager.WriteError(new Exception(string.Format("Unable to connect to {0} server.", server.FqdName))); + } + } + collection.Name = GetFormattedCollectionName(collection.DisplayName, org.OrganizationId); collection.Settings = new RdsCollectionSettings @@ -743,7 +833,7 @@ namespace WebsitePanel.EnterpriseServer FillRdsServerData(tmpServer); } - result.Servers = tmpServers.ToArray(); + result.Servers = tmpServers.ToArray(); return result; } @@ -935,27 +1025,29 @@ namespace WebsitePanel.EnterpriseServer try { - if (CheckRDSServerAvaliable(rdsServer.FqdName)) + int serviceId = GetRdsMainServiceId(); + var rds = GetRemoteDesktopServices(serviceId); + + if (rds.CheckRDSServerAvaliable(rdsServer.FqdName)) { - rdsServer.Id = DataProvider.AddRDSServer(rdsServer.Name, rdsServer.FqdName, rdsServer.Description); + var domainName = IPGlobalProperties.GetIPGlobalProperties().DomainName; + + if (rdsServer.FqdName.EndsWith(domainName, StringComparison.CurrentCultureIgnoreCase)) + { + rds.AddSessionHostFeatureToServer(rdsServer.FqdName); + rds.MoveSessionHostToRdsOU(rdsServer.Name); + rdsServer.Id = DataProvider.AddRDSServer(rdsServer.Name, rdsServer.FqdName, rdsServer.Description); + } + else + { + throw TaskManager.WriteError(new Exception("Fully Qualified Domain Name not valid.")); + } } else { - result.AddError("REMOTE_DESKTOP_SERVICES_ADD_RDS_SERVER", new Exception("The server that you are adding, is not available")); - return result; + throw TaskManager.WriteError(new Exception(string.Format("Unable to connect to {0} server. Please double check Server Full Name setting and retry.", rdsServer.FqdName))); } - } - catch (Exception ex) - { - if (ex.InnerException != null) - { - result.AddError("Unable to add RDS Server", ex.InnerException); - } - else - { - result.AddError("Unable to add RDS Server", ex); - } - } + } finally { if (!result.IsSuccess) @@ -1101,12 +1193,6 @@ namespace WebsitePanel.EnterpriseServer var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); RdsServer rdsServer = GetRdsServer(serverId); - - //if (!rds.CheckSessionHostFeatureInstallation(rdsServer.FqdName)) - { - rds.AddSessionHostFeatureToServer(rdsServer.FqdName); - } - rds.MoveRdsServerToTenantOU(rdsServer.FqdName, org.OrganizationId); DataProvider.AddRDSServerToOrganization(itemId, serverId); } @@ -1415,36 +1501,32 @@ namespace WebsitePanel.EnterpriseServer return result; } - private static RdsServerInfo GetRdsServerInfoInternal(int itemId, string fqdnName) + private static RdsServerInfo GetRdsServerInfoInternal(int? itemId, string fqdnName) { - Organization org = OrganizationController.GetOrganization(itemId); + int serviceId = GetRdsServiceId(itemId); + var result = new RdsServerInfo(); - if (org == null) + if (serviceId != -1) { - return new RdsServerInfo(); + var rds = GetRemoteDesktopServices(serviceId); + result = rds.GetRdsServerInfo(fqdnName); } - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); - var result = rds.GetRdsServerInfo(fqdnName); - return result; } - private static string GetRdsServerStatusInternal(int itemId, string fqdnName) - { - Organization org = OrganizationController.GetOrganization(itemId); + private static string GetRdsServerStatusInternal(int? itemId, string fqdnName) + { var result = "Unavailable"; - - if (org == null) - { - return result; - } - - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var serviceId = GetRdsServiceId(itemId); try { - result = rds.GetRdsServerStatus(fqdnName); + if (serviceId != -1) + { + var rds = GetRemoteDesktopServices(serviceId); + result = rds.GetRdsServerStatus(fqdnName); + } } catch { @@ -1453,23 +1535,19 @@ namespace WebsitePanel.EnterpriseServer return result; } - private static ResultObject ShutDownRdsServerInternal(int itemId, string fqdnName) + private static ResultObject ShutDownRdsServerInternal(int? itemId, string fqdnName) { var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "SHUTDOWN_RDS_SERVER"); try - { - Organization org = OrganizationController.GetOrganization(itemId); + { + int serviceId = GetRdsServiceId(itemId); - if (org == null) + if (serviceId != -1) { - result.IsSuccess = false; - result.AddError("", new NullReferenceException("Organization not found")); - return result; + var rds = GetRemoteDesktopServices(serviceId); + rds.ShutDownRdsServer(fqdnName); } - - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); - rds.ShutDownRdsServer(fqdnName); } catch (Exception ex) { @@ -1490,23 +1568,19 @@ namespace WebsitePanel.EnterpriseServer return result; } - private static ResultObject RestartRdsServerInternal(int itemId, string fqdnName) + private static ResultObject RestartRdsServerInternal(int? itemId, string fqdnName) { - var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "RESTART_RDS_SERVER"); + var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "RESTART_RDS_SERVER"); try { - Organization org = OrganizationController.GetOrganization(itemId); + int serviceId = GetRdsServiceId(itemId); - if (org == null) + if (serviceId != -1) { - result.IsSuccess = false; - result.AddError("", new NullReferenceException("Organization not found")); - return result; + var rds = GetRemoteDesktopServices(serviceId); + rds.RestartRdsServer(fqdnName); } - - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); - rds.RestartRdsServer(fqdnName); } catch (Exception ex) { @@ -1668,22 +1742,7 @@ namespace WebsitePanel.EnterpriseServer var address = Dns.GetHostAddresses(hostname); return address; - } - - private static bool CheckRDSServerAvaliable(string hostname) - { - bool result = false; - var ping = new Ping(); - var reply = ping.Send(hostname, 1000); - - if (reply.Status == IPStatus.Success) - { - result = true; - } - - return result; - } - + } private static ResultObject DeleteRemoteDesktopServiceInternal(int itemId) { @@ -1727,16 +1786,58 @@ namespace WebsitePanel.EnterpriseServer private static int GetRemoteDesktopServiceID(int packageId) { return PackageController.GetPackageServiceId(packageId, ResourceGroups.RDS); + } + + private static int GetRdsServiceId(int? itemId) + { + int serviceId = -1; + + if (itemId.HasValue) + { + Organization org = OrganizationController.GetOrganization(itemId.Value); + + if (org == null) + { + return serviceId; + } + + serviceId = GetRemoteDesktopServiceID(org.PackageId); + } + else + { + serviceId = GetRdsMainServiceId(); + } + + return serviceId; } private static RemoteDesktopServices GetRemoteDesktopServices(int serviceId) { var rds = new RemoteDesktopServices(); - ServiceProviderProxy.Init(rds, serviceId); + ServiceProviderProxy.Init(rds, serviceId); return rds; } + private static int GetRdsMainServiceId() + { + var settings = SystemController.GetSystemSettings(WebsitePanel.EnterpriseServer.SystemSettings.RDS_SETTINGS); + + if (!string.IsNullOrEmpty(settings["RdsMainController"])) + { + return Convert.ToInt32(settings["RdsMainController"]); + } + + var rdsServices = GetRdsServicesInternal(); + + if (rdsServices.Any()) + { + return rdsServices.First().ServiceId; + } + + return -1; + } + private static string GetFormattedCollectionName(string displayName, string organizationId) { return string.Format("{0}-{1}", organizationId, displayName.Replace(" ", "_")); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs index 6668b40b..f5ba338b 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs @@ -196,6 +196,36 @@ namespace WebsitePanel.EnterpriseServer EnterpriseStorageController.StartSetEnterpriseFolderSettingsBackgroundTask(itemId, folder, permissions, directoyBrowsingEnabled, quota, quotaType); } + [WebMethod] + public void SetEnterpriseFolderGeneralSettings(int itemId, SystemFile folder, bool directoyBrowsingEnabled, int quota, QuotaType quotaType) + { + EnterpriseStorageController.SetESGeneralSettings(itemId, folder, directoyBrowsingEnabled, quota, quotaType); + } + + [WebMethod] + public void SetEnterpriseFolderPermissionSettings(int itemId, SystemFile folder, ESPermission[] permissions) + { + EnterpriseStorageController.SetESFolderPermissionSettings(itemId, folder, permissions); + } + + [WebMethod] + public OrganizationUser[] GetFolderOwaAccounts(int itemId, SystemFile folder) + { + return EnterpriseStorageController.GetFolderOwaAccounts(itemId, folder.Name); + } + + [WebMethod] + public void SetFolderOwaAccounts(int itemId, SystemFile folder, OrganizationUser[] users) + { + EnterpriseStorageController.SetFolderOwaAccounts(itemId, folder.Name, users); + } + + [WebMethod] + public List GetUserEnterpriseFolderWithOwaEditPermission(int itemId, List accountIds) + { + return EnterpriseStorageController.GetUserEnterpriseFolderWithOwaEditPermission(itemId, accountIds); + } + #endregion #region Statistics diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs index 8cd3ecdb..4b5a69ef 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs @@ -291,25 +291,25 @@ namespace WebsitePanel.EnterpriseServer } [WebMethod] - public RdsServerInfo GetRdsServerInfo(int itemId, string fqdnName) + public RdsServerInfo GetRdsServerInfo(int? itemId, string fqdnName) { return RemoteDesktopServicesController.GetRdsServerInfo(itemId, fqdnName); } [WebMethod] - public string GetRdsServerStatus(int itemId, string fqdnName) + public string GetRdsServerStatus(int? itemId, string fqdnName) { return RemoteDesktopServicesController.GetRdsServerStatus(itemId, fqdnName); } [WebMethod] - public ResultObject ShutDownRdsServer(int itemId, string fqdnName) + public ResultObject ShutDownRdsServer(int? itemId, string fqdnName) { return RemoteDesktopServicesController.ShutDownRdsServer(itemId, fqdnName); } [WebMethod] - public ResultObject RestartRdsServer(int itemId, string fqdnName) + public ResultObject RestartRdsServer(int? itemId, string fqdnName) { return RemoteDesktopServicesController.RestartRdsServer(itemId, fqdnName); } @@ -327,9 +327,33 @@ namespace WebsitePanel.EnterpriseServer } [WebMethod] - public ResultObject InstallSessionHostsCertificate(int collectionId, byte[] certificate, string password) + public ResultObject InstallSessionHostsCertificate(RdsServer rdsServer) { - return RemoteDesktopServicesController.InstallSessionHostsCertificate(collectionId, certificate, password); + return RemoteDesktopServicesController.InstallSessionHostsCertificate(rdsServer); + } + + [WebMethod] + public RdsCertificate GetRdsCertificateByServiceId(int serviceId) + { + return RemoteDesktopServicesController.GetRdsCertificateByServiceId(serviceId); + } + + [WebMethod] + public RdsCertificate GetRdsCertificateByItemId(int? itemId) + { + return RemoteDesktopServicesController.GetRdsCertificateByItemId(itemId); + } + + [WebMethod] + public ResultObject AddRdsCertificate(RdsCertificate certificate) + { + return RemoteDesktopServicesController.AddRdsCertificate(certificate); + } + + [WebMethod] + public List GetRdsServices() + { + return RemoteDesktopServicesController.GetRdsServices(); } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/OS/SystemFile.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/OS/SystemFile.cs index 830bccab..83d68d90 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/OS/SystemFile.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/OS/SystemFile.cs @@ -145,6 +145,7 @@ namespace WebsitePanel.Providers.OS } public string RelativeUrl { get; set; } + public string Summary { get; set; } public string DriveLetter { diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs index a176c00f..01038055 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs @@ -74,10 +74,11 @@ namespace WebsitePanel.Providers.RemoteDesktopServices string GetRdsServerStatus(string serverName); void ShutDownRdsServer(string serverName); void RestartRdsServer(string serverName); - void SaveRdsCollectionLocalAdmins(List users, List hosts); - List GetRdsCollectionLocalAdmins(string hostName); + void SaveRdsCollectionLocalAdmins(List users, List hosts, string collectionName, string organizationId); + List GetRdsCollectionLocalAdmins(string organizationId, string collectionName); void MoveRdsServerToTenantOU(string hostName, string organizationId); void RemoveRdsServerFromTenantOU(string hostName, string organizationId); void InstallCertificate(byte[] certificate, string password, List hostNames); + void MoveSessionHostToRdsOU(string hostName); } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsCertificate.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsCertificate.cs new file mode 100644 index 00000000..9d8e0e3e --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsCertificate.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace WebsitePanel.Providers.RemoteDesktopServices +{ + public class RdsCertificate + { + public int Id { get; set; } + public int ServiceId { get; set; } + public string FileName { get; set; } + public string Content { get; set; } + public string Hash { get; set; } + public DateTime? ValidFrom { get; set; } + public DateTime? ExpiryDate { get; set; } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServer.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServer.cs index aa181ba7..f1485912 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServer.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServer.cs @@ -48,5 +48,6 @@ namespace WebsitePanel.Providers.RemoteDesktopServices public int? RdsCollectionId { get; set; } public bool ConnectionEnabled { get; set; } public string Status { get; set; } + public bool SslAvailable { get; set; } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServersPaged.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServersPaged.cs index db523c2d..199ab34f 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServersPaged.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServersPaged.cs @@ -26,11 +26,12 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + namespace WebsitePanel.Providers.RemoteDesktopServices { public class RdsServersPaged { public int RecordsCount { get; set; } - public RdsServer[] Servers { get; set; } + public RdsServer[] Servers { get; set; } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj index f60340ee..5a7ebe5b 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj @@ -129,6 +129,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/Windows2012.cs index e5ff425c..f0a8caf3 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/Windows2012.cs @@ -304,7 +304,7 @@ namespace WebsitePanel.Providers.EnterpriseStorage var rootFolder = Path.Combine(settings.LocationDrive + ":\\", settings.HomeFolder); rootFolder = Path.Combine(rootFolder, organizationId); - var wsSql = string.Format(@"SELECT System.FileName, System.DateModified, System.Size, System.Kind, System.ItemPathDisplay, System.ItemType FROM SYSTEMINDEX WHERE System.FileName LIKE '%{0}%' AND ({1})", + var wsSql = string.Format(@"SELECT System.FileName, System.DateModified, System.Size, System.Kind, System.ItemPathDisplay, System.ItemType, System.Search.AutoSummary FROM SYSTEMINDEX WHERE System.FileName LIKE '%{0}%' AND ({1})", searchText, string.Join(" OR ", searchPaths.Select(x => string.Format("{0} = '{1}'", recursive ? "SCOPE" : "DIRECTORY", Path.Combine(rootFolder, x))).ToArray())); conn.Open(); @@ -318,7 +318,7 @@ namespace WebsitePanel.Providers.EnterpriseStorage var file = new SystemFile {Name = reader[0] as string}; file.Changed = file.CreatedDate = reader[1] is DateTime ? (DateTime)reader[1] : new DateTime(); - file.Size = reader[2] is long ? (long) reader[2] : 0; + file.Size = reader[2] is Decimal ? Convert.ToInt64((Decimal) reader[2]) : 0; var kind = reader[3] is IEnumerable ? ((IEnumerable)reader[3]).Cast().ToList() : null; var itemType = reader[5] as string ?? string.Empty; @@ -342,6 +342,8 @@ namespace WebsitePanel.Providers.EnterpriseStorage } } + file.Summary = SanitizeXmlString(reader[6] as string); + result.Add(file); } } @@ -352,6 +354,36 @@ namespace WebsitePanel.Providers.EnterpriseStorage } + public string SanitizeXmlString(string xml) + { + if (xml == null) + { + return null; + } + + var buffer = new StringBuilder(xml.Length); + + foreach (char c in xml.Where(c => IsLegalXmlChar(c))) + { + buffer.Append(c); + } + + return buffer.ToString(); + } + + public bool IsLegalXmlChar(int character) + { + return + ( + character == 0x9 /* == '\t' == 9 */ || + character == 0xA /* == '\n' == 10 */ || + character == 0xD /* == '\r' == 13 */ || + (character >= 0x20 && character <= 0xD7FF) || + (character >= 0xE000 && character <= 0xFFFD) || + (character >= 0x10000 && character <= 0x10FFFF) + ); + } + #region HostingServiceProvider methods public override string[] Install() diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs index a0015101..013e0cdb 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs @@ -64,15 +64,19 @@ namespace WebsitePanel.Providers.RemoteDesktopServices private const string Computers = "Computers"; private const string AdDcComputers = "Domain Controllers"; private const string Users = "users"; + private const string Admins = "Admins"; 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=\"0x1e\" conditiondata=\"UserAuthType:(PW|CA)\" profileid=\"0x1005\" profiledata=\"TRUE\" profileid=\"0x100f\" profiledata=\"TRUE\" profileid=\"0x1009\" profiledata=\"0x7\" profileid=\"0x1fe6\" profiledata=\"0x40000000\""; - private const string WspAdministratorsGroupName = "WSP-Org-Administrators"; - private const string WspAdministratorsGroupDescription = "WSP Org Administrators"; - private const string RdsServersOU = "RDSServers"; - private const string RDSHelpDeskComputerGroup = "Websitepanel-RDSHelpDesk-Computer"; + private const string WspAdministratorsGroupDescription = "WSP RDS Collection Adminstrators"; + private const string RdsCollectionUsersGroupDescription = "WSP RDS Collection Users"; + private const string RdsCollectionComputersGroupDescription = "WSP RDS Collection Computers"; + private const string RdsServersOU = "RDSServersOU"; + private const string RdsServersRootOU = "RDSRootServersOU"; + private const string RDSHelpDeskComputerGroup = "Websitepanel-RDSHelpDesk-Computer"; private const string RDSHelpDeskGroup = "WSP-HelpDeskAdministrators"; - private const string RDSHelpDeskGroupDescription = "WSP Help Desk Administrators"; + private const string RDSHelpDeskGroupDescription = "WSP Help Desk Administrators"; + private const string LocalAdministratorsGroupName = "Administrators"; #endregion @@ -94,6 +98,14 @@ namespace WebsitePanel.Providers.RemoteDesktopServices } } + private string ComputersRootOU + { + get + { + return ProviderSettings["ComputersRootOU"]; + } + } + private string CentralNpsHost { get @@ -300,23 +312,13 @@ namespace WebsitePanel.Providers.RemoteDesktopServices EditRdsCollectionSettingsInternal(collection, runSpace); var orgPath = GetOrganizationPath(organizationId); - - if (!ActiveDirectoryUtils.AdObjectExists(GetComputerGroupPath(organizationId, collection.Name))) - { - //Create computer group - ActiveDirectoryUtils.CreateGroup(orgPath, GetComputersGroupName(collection.Name)); - - //todo Connection broker server must be added by default ??? - //ActiveDirectoryUtils.AddObjectToGroup(GetComputerPath(ConnectionBroker), GetComputerGroupPath(organizationId, collection.Name)); - } - - CheckOrCreateHelpDeskComputerGroup(); - - if (!ActiveDirectoryUtils.AdObjectExists(GetUsersGroupPath(organizationId, collection.Name))) - { - //Create user group - ActiveDirectoryUtils.CreateGroup(orgPath, GetUsersGroupName(collection.Name)); - } + CheckOrCreateAdGroup(GetComputerGroupPath(organizationId, collection.Name), orgPath, GetComputersGroupName(collection.Name), RdsCollectionComputersGroupDescription); + CheckOrCreateHelpDeskComputerGroup(); + string helpDeskGroupSamAccountName = CheckOrCreateAdGroup(GetHelpDeskGroupPath(RDSHelpDeskGroup), GetRootOUPath(), RDSHelpDeskGroup, RDSHelpDeskGroupDescription); + string groupName = GetLocalAdminsGroupName(collection.Name); + string groupPath = GetGroupPath(organizationId, collection.Name, groupName); + string localAdminsGroupSamAccountName = CheckOrCreateAdGroup(groupPath, GetOrganizationPath(organizationId), groupName, WspAdministratorsGroupDescription); + CheckOrCreateAdGroup(GetUsersGroupPath(organizationId, collection.Name), orgPath, GetUsersGroupName(collection.Name), RdsCollectionUsersGroupDescription); var capPolicyName = GetPolicyName(organizationId, collection.Name, RdsPolicyTypes.RdCap); var rapPolicyName = GetPolicyName(organizationId, collection.Name, RdsPolicyTypes.RdRap); @@ -337,17 +339,14 @@ namespace WebsitePanel.Providers.RemoteDesktopServices } //add user group to collection - AddUserGroupsToCollection(runSpace, collection.Name, new List { GetUsersGroupName(collection.Name) }); + AddUserGroupsToCollection(runSpace, collection.Name, new List { GetUsersGroupName(collection.Name) }); //add session servers to group foreach (var rdsServer in collection.Servers) - { - if (!CheckLocalAdminsGroupExists(rdsServer.FqdName, runSpace)) - { - CreateLocalAdministratorsGroup(rdsServer.FqdName, runSpace); - } - - AddHelpDeskAdminsGroupToLocalAdmins(runSpace, rdsServer.FqdName); + { + MoveRdsServerToTenantOU(rdsServer.Name, organizationId); + AddAdGroupToLocalAdmins(runSpace, rdsServer.FqdName, helpDeskGroupSamAccountName); + AddAdGroupToLocalAdmins(runSpace, rdsServer.FqdName, localAdminsGroupSamAccountName); AddComputerToCollectionAdComputerGroup(organizationId, collection.Name, rdsServer); } } @@ -513,11 +512,13 @@ namespace WebsitePanel.Providers.RemoteDesktopServices foreach(var server in servers) { + RemoveGroupFromLocalAdmin(server.FqdName, server.Name, GetLocalAdminsGroupName(collectionName), runSpace); RemoveComputerFromCollectionAdComputerGroup(organizationId, collectionName, server); } ActiveDirectoryUtils.DeleteADObject(GetComputerGroupPath(organizationId, collectionName)); - ActiveDirectoryUtils.DeleteADObject(GetUsersGroupPath(organizationId, collectionName)); + ActiveDirectoryUtils.DeleteADObject(GetUsersGroupPath(organizationId, collectionName)); + ActiveDirectoryUtils.DeleteADObject(GetGroupPath(organizationId, collectionName, GetLocalAdminsGroupName(collectionName))); } catch (Exception e) { @@ -529,12 +530,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices } return result; - } - - public List GetCollectionUsers(string collectionName) - { - return GetUsersToCollectionAdGroup(collectionName); - } + } public bool SetUsersInCollection(string organizationId, string collectionName, List users) { @@ -542,7 +538,9 @@ namespace WebsitePanel.Providers.RemoteDesktopServices try { - SetUsersToCollectionAdGroup(collectionName, organizationId, users); + var usersGroupName = GetUsersGroupName(collectionName); + var usersGroupPath = GetUsersGroupPath(organizationId, collectionName); + SetUsersToCollectionAdGroup(collectionName, organizationId, users, usersGroupName, usersGroupPath); } catch (Exception e) { @@ -573,20 +571,16 @@ namespace WebsitePanel.Providers.RemoteDesktopServices ExecuteShellCommand(runSpace, cmd, false); - CheckOrCreateHelpDeskComputerGroup(); + CheckOrCreateHelpDeskComputerGroup(); + string helpDeskGroupSamAccountName = CheckOrCreateAdGroup(GetHelpDeskGroupPath(RDSHelpDeskGroup), GetRootOUPath(), RDSHelpDeskGroup, RDSHelpDeskGroupDescription); + string groupName = GetLocalAdminsGroupName(collectionName); + string groupPath = GetGroupPath(organizationId, collectionName, groupName); + string localAdminsGroupSamAccountName = CheckOrCreateAdGroup(groupPath, GetOrganizationPath(organizationId), groupName, WspAdministratorsGroupDescription); - if (!CheckLocalAdminsGroupExists(server.FqdName, runSpace)) - { - CreateLocalAdministratorsGroup(server.FqdName, runSpace); - } - - AddHelpDeskAdminsGroupToLocalAdmins(runSpace, server.FqdName); + AddAdGroupToLocalAdmins(runSpace, server.FqdName, LocalAdministratorsGroupName); + AddAdGroupToLocalAdmins(runSpace, server.FqdName, helpDeskGroupSamAccountName); AddComputerToCollectionAdComputerGroup(organizationId, collectionName, server); - } - catch (Exception e) - { - - } + } finally { CloseRunspace(runSpace); @@ -616,6 +610,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices ExecuteShellCommand(runSpace, cmd, false); + RemoveGroupFromLocalAdmin(server.FqdName, server.Name, GetLocalAdminsGroupName(collectionName), runSpace); RemoveComputerFromCollectionAdComputerGroup(organizationId, collectionName, server); } finally @@ -978,7 +973,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices #region Local Admins - public void SaveRdsCollectionLocalAdmins(List users, List hosts) + public void SaveRdsCollectionLocalAdmins(List users, List hosts, string collectionName, string organizationId) { Runspace runspace = null; @@ -987,6 +982,10 @@ namespace WebsitePanel.Providers.RemoteDesktopServices runspace = OpenRunspace(); var index = ServerSettings.ADRootDomain.LastIndexOf("."); var domainName = ServerSettings.ADRootDomain; + string groupName = GetLocalAdminsGroupName(collectionName); + string groupPath = GetGroupPath(organizationId, collectionName, groupName); + string helpDeskGroupSamAccountName = CheckOrCreateAdGroup(GetHelpDeskGroupPath(RDSHelpDeskGroup), GetRootOUPath(), RDSHelpDeskGroup, RDSHelpDeskGroupDescription); + string localAdminsGroupSamAccountName = CheckOrCreateAdGroup(groupPath, GetOrganizationPath(organizationId), groupName, WspAdministratorsGroupDescription); if (index > 0) { @@ -994,34 +993,11 @@ namespace WebsitePanel.Providers.RemoteDesktopServices } foreach (var hostName in hosts) - { - if (!CheckLocalAdminsGroupExists(hostName, runspace)) - { - var errors = CreateLocalAdministratorsGroup(hostName, runspace); - - if (errors.Any()) - { - Log.WriteWarning(string.Join("\r\n", errors.Select(e => e.ToString()).ToArray())); - throw new Exception(string.Join("\r\n", errors.Select(e => e.ToString()).ToArray())); - } - } - - var existingAdmins = GetExistingLocalAdmins(hostName, runspace).Select(e => e.ToLower()); - var formUsers = users.Select(u => string.Format("{0}\\{1}", domainName, u.SamAccountName).ToLower()); - var newUsers = users.Where(u => !existingAdmins.Contains(string.Format("{0}\\{1}", domainName, u.SamAccountName).ToLower())); - var removedUsers = existingAdmins.Where(e => !formUsers.Contains(e)); + { + AddAdGroupToLocalAdmins(runspace, hostName, helpDeskGroupSamAccountName); + AddAdGroupToLocalAdmins(runspace, hostName, localAdminsGroupSamAccountName); - foreach (var user in newUsers) - { - AddNewLocalAdmin(hostName, user.SamAccountName, runspace); - } - - foreach (var user in removedUsers) - { - RemoveLocalAdmin(hostName, user, runspace); - } - - AddHelpDeskAdminsGroupToLocalAdmins(runspace, hostName); + SetUsersToCollectionAdGroup(collectionName, organizationId, users, GetLocalAdminsGroupName(collectionName), groupPath); } } finally @@ -1030,126 +1006,23 @@ namespace WebsitePanel.Providers.RemoteDesktopServices } } - public List GetRdsCollectionLocalAdmins(string hostName) + public List GetRdsCollectionLocalAdmins(string organizationId, string collectionName) + { + string groupName = GetLocalAdminsGroupName(collectionName); + return GetUsersToCollectionAdGroup(collectionName, groupName, organizationId); + } + + private void RemoveGroupFromLocalAdmin(string fqdnName, string hostName, string groupName, Runspace runspace) { - Runspace runspace = null; - var result = new List(); - - try - { - runspace = OpenRunspace(); - - if (CheckLocalAdminsGroupExists(hostName, runspace)) - { - result = GetExistingLocalAdmins(hostName, runspace); - } - } - finally - { - CloseRunspace(runspace); - } - - return result; - } - - private bool CheckLocalAdminsGroupExists(string hostName, Runspace runspace) - { var scripts = new List { - string.Format("net localgroup {0}", WspAdministratorsGroupName) + string.Format("$GroupObj = [ADSI]\"WinNT://{0}/{1}\"", hostName, LocalAdministratorsGroupName), + string.Format("$GroupObj.Remove(\"WinNT://{0}/{1}\")", ServerSettings.ADRootDomain, RDSHelpDeskGroup), + string.Format("$GroupObj.Remove(\"WinNT://{0}/{1}\")", ServerSettings.ADRootDomain, groupName) }; object[] errors = null; - var result = ExecuteRemoteShellCommand(runspace, hostName, scripts, out errors); - - if (!errors.Any()) - { - return true; - } - - return false; - } - - private object[] CreateLocalAdministratorsGroup(string hostName, Runspace runspace) - { - var scripts = new List - { - string.Format("$cn = [ADSI]\"WinNT://{0}\"", hostName), - string.Format("$group = $cn.Create(\"Group\", \"{0}\")", WspAdministratorsGroupName), - "$group.setinfo()", - string.Format("$group.description = \"{0}\"", WspAdministratorsGroupDescription), - "$group.setinfo()" - }; - - object[] errors = null; - ExecuteRemoteShellCommand(runspace, hostName, scripts, out errors); - - if (!errors.Any()) - { - scripts = new List - { - string.Format("$GroupObj = [ADSI]\"WinNT://{0}/Administrators\"", hostName), - string.Format("$GroupObj.Add(\"WinNT://{0}/{1}\")", hostName.ToLower().Replace(string.Format(".{0}", ServerSettings.ADRootDomain.ToLower()), ""), WspAdministratorsGroupName) - }; - - errors = null; - ExecuteRemoteShellCommand(runspace, hostName, scripts, out errors); - } - - return errors; - } - - private List GetExistingLocalAdmins(string hostName, Runspace runspace) - { - var result = new List(); - - var scripts = new List - { - string.Format("net localgroup {0} | select -skip 6", WspAdministratorsGroupName) - }; - - object[] errors = null; - var exitingAdmins = ExecuteRemoteShellCommand(runspace, hostName, scripts, out errors); - - if (!errors.Any()) - { - foreach(var user in exitingAdmins.Take(exitingAdmins.Count - 2)) - { - result.Add(user.ToString()); - } - } - - return result; - } - - private object[] AddNewLocalAdmin(string hostName, string samAccountName, Runspace runspace) - { - var scripts = new List - { - string.Format("$GroupObj = [ADSI]\"WinNT://{0}/{1}\"", hostName, WspAdministratorsGroupName), - string.Format("$GroupObj.Add(\"WinNT://{0}/{1}\")", ServerSettings.ADRootDomain, samAccountName) - }; - - object[] errors = null; - ExecuteRemoteShellCommand(runspace, hostName, scripts, out errors); - - return errors; - } - - private object[] RemoveLocalAdmin(string hostName, string user, Runspace runspace) - { - var userObject = user.Split('\\'); - - var scripts = new List - { - string.Format("$GroupObj = [ADSI]\"WinNT://{0}/{1}\"", hostName, WspAdministratorsGroupName), - string.Format("$GroupObj.Remove(\"WinNT://{0}/{1}\")", userObject[0], userObject[1]) - }; - - object[] errors = null; - ExecuteRemoteShellCommand(runspace, hostName, scripts, out errors); - - return errors; + ExecuteRemoteShellCommand(runspace, fqdnName, scripts, out errors); } #endregion @@ -1177,23 +1050,22 @@ namespace WebsitePanel.Providers.RemoteDesktopServices } } - private void AddHelpDeskAdminsGroupToLocalAdmins(Runspace runspace, string hostName) - { - var helpDeskAdminsGroupPath = GetHelpDeskGroupPath(RDSHelpDeskGroup); + private string CheckOrCreateAdGroup(string groupPath, string rootPath, string groupName, string description) + { DirectoryEntry groupEntry = null; - if (!ActiveDirectoryUtils.AdObjectExists(helpDeskAdminsGroupPath)) + if (!ActiveDirectoryUtils.AdObjectExists(groupPath)) { - ActiveDirectoryUtils.CreateGroup(GetRootOUPath(), RDSHelpDeskGroup); - groupEntry = ActiveDirectoryUtils.GetADObject(helpDeskAdminsGroupPath); + ActiveDirectoryUtils.CreateGroup(rootPath, groupName); + groupEntry = ActiveDirectoryUtils.GetADObject(groupPath); if (groupEntry.Properties.Contains("Description")) { - groupEntry.Properties["Description"][0] = RDSHelpDeskGroupDescription; + groupEntry.Properties["Description"][0] = description; } else { - groupEntry.Properties["Description"].Add(RDSHelpDeskGroupDescription); + groupEntry.Properties["Description"].Add(description); } groupEntry.CommitChanges(); @@ -1201,14 +1073,17 @@ namespace WebsitePanel.Providers.RemoteDesktopServices if (groupEntry == null) { - groupEntry = ActiveDirectoryUtils.GetADObject(helpDeskAdminsGroupPath); + groupEntry = ActiveDirectoryUtils.GetADObject(groupPath); } - var samAccountName = ActiveDirectoryUtils.GetADObjectProperty(groupEntry, "sAMAccountName"); - + return ActiveDirectoryUtils.GetADObjectProperty(groupEntry, "sAMAccountName").ToString(); + } + + private void AddAdGroupToLocalAdmins(Runspace runspace, string hostName, string samAccountName) + { var scripts = new List { - string.Format("$GroupObj = [ADSI]\"WinNT://{0}/{1}\"", hostName, WspAdministratorsGroupName), + string.Format("$GroupObj = [ADSI]\"WinNT://{0}/{1}\"", hostName, LocalAdministratorsGroupName), string.Format("$GroupObj.Add(\"WinNT://{0}/{1}\")", ServerSettings.ADRootDomain, samAccountName) }; @@ -1227,8 +1102,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices try { var guid = Guid.NewGuid(); - var x509Cert = new X509Certificate2(certificate, password, X509KeyStorageFlags.Exportable); - //var content = x509Cert.Export(X509ContentType.Pfx); + var x509Cert = new X509Certificate2(certificate, password, X509KeyStorageFlags.Exportable); var filePath = SaveCertificate(certificate, guid); runspace = OpenRunspace(); @@ -1239,6 +1113,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices if (!errors.Any()) { + RemoveCertificate(runspace, hostName, x509Cert.Thumbprint); errors = ImportCertificate(runspace, hostName, password, string.Format("c:\\{0}.pfx", guid), x509Cert.Thumbprint); } @@ -1260,12 +1135,23 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { CloseRunspace(runspace); } - } + } + + private void RemoveCertificate(Runspace runspace, string hostName, string thumbprint) + { + var scripts = new List + { + string.Format("Remove-Item -Path cert:\\LocalMachine\\My\\{0}", thumbprint) + }; + + object[] errors = null; + ExecuteRemoteShellCommand(runspace, hostName, scripts, out errors); + } private object[] ImportCertificate(Runspace runspace, string hostName, string password, string certificatePath, string thumbprint) { var scripts = new List - { + { string.Format("$mypwd = ConvertTo-SecureString -String {0} -Force –AsPlainText", password), string.Format("Import-PfxCertificate –FilePath \"{0}\" cert:\\localMachine\\my -Password $mypwd", certificatePath), string.Format("$cert = Get-Item cert:\\LocalMachine\\My\\{0}", thumbprint), @@ -1355,21 +1241,17 @@ namespace WebsitePanel.Providers.RemoteDesktopServices return false; } - private void SetUsersToCollectionAdGroup(string collectionName, string organizationId, IEnumerable users) - { - var usersGroupName = GetUsersGroupName(collectionName); - var usersGroupPath = GetUsersGroupPath(organizationId, collectionName); + private void SetUsersToCollectionAdGroup(string collectionName, string organizationId, IEnumerable users, string groupName, string groupPath) + { var orgPath = GetOrganizationPath(organizationId); var orgEntry = ActiveDirectoryUtils.GetADObject(orgPath); - var groupUsers = ActiveDirectoryUtils.GetGroupObjects(usersGroupName, "user", orgEntry); - - //remove all users from group + var groupUsers = ActiveDirectoryUtils.GetGroupObjects(groupName, "user", orgEntry); + foreach (string userPath in groupUsers) { - ActiveDirectoryUtils.RemoveObjectFromGroup(userPath, usersGroupPath); + ActiveDirectoryUtils.RemoveObjectFromGroup(userPath, groupPath); } - - //adding users to group + foreach (var user in users) { var userPath = GetUserPath(organizationId, user); @@ -1377,20 +1259,19 @@ namespace WebsitePanel.Providers.RemoteDesktopServices if (ActiveDirectoryUtils.AdObjectExists(userPath)) { var userObject = ActiveDirectoryUtils.GetADObject(userPath); - var samName = (string)ActiveDirectoryUtils.GetADObjectProperty(userObject, "sAMAccountName"); - var userGroupsPath = GetUsersGroupPath(organizationId, collectionName); - ActiveDirectoryUtils.AddObjectToGroup(userPath, userGroupsPath); + var samName = (string)ActiveDirectoryUtils.GetADObjectProperty(userObject, "sAMAccountName"); + ActiveDirectoryUtils.AddObjectToGroup(userPath, groupPath); } } } - private List GetUsersToCollectionAdGroup(string collectionName) + private List GetUsersToCollectionAdGroup(string collectionName, string groupName, string organizationId) { - var users = new List(); + var users = new List(); + var orgPath = GetOrganizationPath(organizationId); + var orgEntry = ActiveDirectoryUtils.GetADObject(orgPath); - var usersGroupName = GetUsersGroupName(collectionName); - - foreach (string userPath in ActiveDirectoryUtils.GetGroupObjects(usersGroupName, "user")) + foreach (string userPath in ActiveDirectoryUtils.GetGroupObjects(groupName, "user", orgEntry)) { var userObject = ActiveDirectoryUtils.GetADObject(userPath); var samName = (string)ActiveDirectoryUtils.GetADObjectProperty(userObject, "sAMAccountName"); @@ -1412,28 +1293,22 @@ namespace WebsitePanel.Providers.RemoteDesktopServices } private void AddComputerToCollectionAdComputerGroup(string organizationId, string collectionName, RdsServer server) - { - var computerPath = GetComputerPath(server.Name, false); - var computerGroupName = GetComputersGroupName( collectionName); + { + var computerGroupName = GetComputersGroupName( collectionName); + var computerObject = GetComputerObject(server.Name); - if (!ActiveDirectoryUtils.AdObjectExists(computerPath)) - { - computerPath = GetComputerPath(server.Name, true); - } - - if (ActiveDirectoryUtils.AdObjectExists(computerPath)) - { - var computerObject = ActiveDirectoryUtils.GetADObject(computerPath); + if (computerObject != null) + { var samName = (string)ActiveDirectoryUtils.GetADObjectProperty(computerObject, "sAMAccountName"); if (!ActiveDirectoryUtils.IsComputerInGroup(samName, computerGroupName)) { - ActiveDirectoryUtils.AddObjectToGroup(computerPath, GetComputerGroupPath(organizationId, collectionName)); + ActiveDirectoryUtils.AddObjectToGroup(computerObject.Path, GetComputerGroupPath(organizationId, collectionName)); } if (!ActiveDirectoryUtils.IsComputerInGroup(samName, RDSHelpDeskComputerGroup)) { - ActiveDirectoryUtils.AddObjectToGroup(computerPath, GetHelpDeskGroupPath(RDSHelpDeskComputerGroup)); + ActiveDirectoryUtils.AddObjectToGroup(computerObject.Path, GetHelpDeskGroupPath(RDSHelpDeskComputerGroup)); } } @@ -1441,30 +1316,24 @@ namespace WebsitePanel.Providers.RemoteDesktopServices } private void RemoveComputerFromCollectionAdComputerGroup(string organizationId, string collectionName, RdsServer server) - { - var computerPath = GetComputerPath(server.Name, false); + { var computerGroupName = GetComputersGroupName(collectionName); + var computerObject = GetComputerObject(server.Name); - if (!ActiveDirectoryUtils.AdObjectExists(computerPath)) - { - computerPath = GetComputerPath(server.Name, true); - } - - if (ActiveDirectoryUtils.AdObjectExists(computerPath)) - { - var computerObject = ActiveDirectoryUtils.GetADObject(computerPath); + if (computerObject != null) + { var samName = (string)ActiveDirectoryUtils.GetADObjectProperty(computerObject, "sAMAccountName"); if (ActiveDirectoryUtils.IsComputerInGroup(samName, computerGroupName)) { - ActiveDirectoryUtils.RemoveObjectFromGroup(computerPath, GetComputerGroupPath(organizationId, collectionName)); + ActiveDirectoryUtils.RemoveObjectFromGroup(computerObject.Path, GetComputerGroupPath(organizationId, collectionName)); } if (ActiveDirectoryUtils.AdObjectExists(GetHelpDeskGroupPath(RDSHelpDeskComputerGroup))) { if (ActiveDirectoryUtils.IsComputerInGroup(samName, RDSHelpDeskComputerGroup)) { - ActiveDirectoryUtils.RemoveObjectFromGroup(computerPath, GetHelpDeskGroupPath(RDSHelpDeskComputerGroup)); + ActiveDirectoryUtils.RemoveObjectFromGroup(computerObject.Path, GetHelpDeskGroupPath(RDSHelpDeskComputerGroup)); } } } @@ -1479,7 +1348,17 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { runSpace = OpenRunspace(); var feature = AddFeature(runSpace, hostName, "RDS-RD-Server", true, true); - installationResult = (bool)GetPSObjectProperty(feature, "Success"); + installationResult = (bool)GetPSObjectProperty(feature, "Success"); + + if (!IsFeatureInstalled(hostName, "Desktop-Experience", runSpace)) + { + feature = AddFeature(runSpace, hostName, "Desktop-Experience", true, false); + } + + if (!IsFeatureInstalled(hostName, "NET-Framework-Core", runSpace)) + { + feature = AddFeature(runSpace, hostName, "NET-Framework-Core", true, false); + } } finally { @@ -1489,59 +1368,93 @@ namespace WebsitePanel.Providers.RemoteDesktopServices return installationResult; } + private void CheckOrCreateComputersRoot(string computersRootPath) + { + if (ActiveDirectoryUtils.AdObjectExists(computersRootPath) && !ActiveDirectoryUtils.AdObjectExists(GetRdsServersGroupPath())) + { + //ActiveDirectoryUtils.CreateGroup(computersRootPath, RdsServersRootOU); + ActiveDirectoryUtils.CreateOrganizationalUnit(RdsServersRootOU, computersRootPath); + } + } + + public void MoveSessionHostToRdsOU(string hostName) + { + if (!string.IsNullOrEmpty(ComputersRootOU)) + { + CheckOrCreateComputersRoot(GetComputersRootPath()); + } + + var computerObject = GetComputerObject(hostName); + + if (computerObject != null) + { + var samName = (string)ActiveDirectoryUtils.GetADObjectProperty(computerObject, "sAMAccountName"); + + if (!ActiveDirectoryUtils.IsComputerInGroup(samName, RdsServersRootOU)) + { + DirectoryEntry group = new DirectoryEntry(GetRdsServersGroupPath()); + computerObject.MoveTo(group); + } + } + } + public void MoveRdsServerToTenantOU(string hostName, string organizationId) { var tenantComputerGroupPath = GetTenantComputerGroupPath(organizationId); if (!ActiveDirectoryUtils.AdObjectExists(tenantComputerGroupPath)) { - ActiveDirectoryUtils.CreateGroup(GetOrganizationPath(organizationId), RdsServersOU); + ActiveDirectoryUtils.CreateOrganizationalUnit(RdsServersOU, GetOrganizationPath(organizationId)); } - hostName = hostName.ToLower().Replace(string.Format(".{0}", ServerSettings.ADRootDomain.ToLower()), ""); - var computerPath = GetComputerPath(hostName, true); + hostName = hostName.ToLower().Replace(string.Format(".{0}", ServerSettings.ADRootDomain.ToLower()), ""); + var rootComputerPath = GetRdsServerPath(hostName); + var tenantComputerPath = GetTenantComputerPath(hostName, organizationId); - if(!ActiveDirectoryUtils.AdObjectExists(computerPath)) - { - computerPath = GetComputerPath(hostName, false); - } + if (!string.IsNullOrEmpty(ComputersRootOU)) + { + CheckOrCreateComputersRoot(GetComputersRootPath()); + } + + var computerObject = GetComputerObject(hostName); - if (ActiveDirectoryUtils.AdObjectExists(computerPath)) + if (computerObject != null) { - var computerObject = ActiveDirectoryUtils.GetADObject(computerPath); var samName = (string)ActiveDirectoryUtils.GetADObjectProperty(computerObject, "sAMAccountName"); if (!ActiveDirectoryUtils.IsComputerInGroup(samName, RdsServersOU)) - { + { DirectoryEntry group = new DirectoryEntry(tenantComputerGroupPath); - group.Invoke("Add", computerObject.Path); - - group.CommitChanges(); + computerObject.MoveTo(group); } - } + } } public void RemoveRdsServerFromTenantOU(string hostName, string organizationId) { var tenantComputerGroupPath = GetTenantComputerGroupPath(organizationId); - hostName = hostName.ToLower().Replace(string.Format(".{0}", ServerSettings.ADRootDomain.ToLower()), ""); - var tenantComputerPath = GetTenantComputerPath(hostName, organizationId); + hostName = hostName.ToLower().Replace(string.Format(".{0}", ServerSettings.ADRootDomain.ToLower()), ""); - var computerPath = GetComputerPath(hostName, true); - - if (!ActiveDirectoryUtils.AdObjectExists(computerPath)) + if (!string.IsNullOrEmpty(ComputersRootOU)) { - computerPath = GetComputerPath(hostName, false); + CheckOrCreateComputersRoot(GetComputersRootPath()); + } + + if (!ActiveDirectoryUtils.AdObjectExists(tenantComputerGroupPath)) + { + ActiveDirectoryUtils.CreateOrganizationalUnit(RdsServersOU, GetOrganizationPath(organizationId)); } - - if (ActiveDirectoryUtils.AdObjectExists(computerPath)) + + var computerObject = GetComputerObject(hostName); + + if (computerObject != null) { - var computerObject = ActiveDirectoryUtils.GetADObject(computerPath); var samName = (string)ActiveDirectoryUtils.GetADObjectProperty(computerObject, "sAMAccountName"); - - if (ActiveDirectoryUtils.IsComputerInGroup(samName, RdsServersOU)) + + if (ActiveDirectoryUtils.AdObjectExists(GetComputersRootPath()) && !string.IsNullOrEmpty(ComputersRootOU) && !ActiveDirectoryUtils.IsComputerInGroup(samName, RdsServersRootOU)) { - ActiveDirectoryUtils.RemoveObjectFromGroup(computerPath, tenantComputerGroupPath); + DirectoryEntry group = new DirectoryEntry(GetRdsServersGroupPath()); + computerObject.MoveTo(group); } } } @@ -1669,6 +1582,10 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { remoteApp.Users = users; } + else + { + remoteApp.Users = null; + } return remoteApp; } @@ -1738,6 +1655,11 @@ namespace WebsitePanel.Providers.RemoteDesktopServices return string.Format(RdsGroupFormat, collectionName, Users.ToLowerInvariant()); } + private string GetLocalAdminsGroupName(string collectionName) + { + return string.Format(RdsGroupFormat, collectionName, Admins.ToLowerInvariant()); + } + internal string GetComputerGroupPath(string organizationId, string collection) { StringBuilder sb = new StringBuilder(); @@ -1766,6 +1688,20 @@ namespace WebsitePanel.Providers.RemoteDesktopServices return sb.ToString(); } + private string GetGroupPath(string organizationId, string collectionName, string groupName) + { + StringBuilder sb = new StringBuilder(); + + AppendProtocol(sb); + AppendDomainController(sb); + AppendCNPath(sb, groupName); + AppendOUPath(sb, organizationId); + AppendOUPath(sb, RootOU); + AppendDomainPath(sb, RootDomain); + + return sb.ToString(); + } + private string GetUserPath(string organizationId, string loginName) { StringBuilder sb = new StringBuilder(); @@ -1805,26 +1741,17 @@ namespace WebsitePanel.Providers.RemoteDesktopServices return sb.ToString(); } - private string GetComputerPath(string objName, bool domainController) + private DirectoryEntry GetComputerObject(string computerName) { - StringBuilder sb = new StringBuilder(); - // append provider - AppendProtocol(sb); - AppendDomainController(sb); - AppendCNPath(sb, objName); - if (domainController) + DirectorySearcher deSearch = new DirectorySearcher { - AppendOUPath(sb, AdDcComputers); - } - else - { - AppendCNPath(sb, Computers); - - } - AppendDomainPath(sb, RootDomain); - - return sb.ToString(); - } + Filter = string.Format("(&(objectCategory=computer)(name={0}))", computerName) + }; + + SearchResult results = deSearch.FindOne(); + + return results.GetDirectoryEntry(); + } private string GetTenantComputerPath(string objName, string organizationId) { @@ -1833,7 +1760,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices AppendProtocol(sb); AppendDomainController(sb); AppendCNPath(sb, objName); - AppendCNPath(sb, RdsServersOU); + AppendOUPath(sb, RdsServersOU); AppendOUPath(sb, organizationId); AppendOUPath(sb, RootOU); AppendDomainPath(sb, RootDomain); @@ -1841,13 +1768,63 @@ namespace WebsitePanel.Providers.RemoteDesktopServices return sb.ToString(); } + private string GetComputersRootPath() + { + StringBuilder sb = new StringBuilder(); + + AppendProtocol(sb); + AppendDomainController(sb); + AppendOUPath(sb, ComputersRootOU); + AppendDomainPath(sb, RootDomain); + + return sb.ToString(); + } + + private string GetRdsServersGroupPath() + { + StringBuilder sb = new StringBuilder(); + + AppendProtocol(sb); + AppendDomainController(sb); + AppendOUPath(sb, RdsServersRootOU); + AppendOUPath(sb, ComputersRootOU); + AppendDomainPath(sb, RootDomain); + + return sb.ToString(); + } + + private string GetRdsServerPath(string name) + { + StringBuilder sb = new StringBuilder(); + + AppendProtocol(sb); + AppendDomainController(sb); + AppendCNPath(sb, name); + AppendOUPath(sb, RdsServersRootOU); + AppendOUPath(sb, ComputersRootOU); + AppendDomainPath(sb, RootDomain); + + return sb.ToString(); + } + + private string GetRootPath() + { + StringBuilder sb = new StringBuilder(); + + AppendProtocol(sb); + AppendDomainController(sb); + AppendDomainPath(sb, RootDomain); + + return sb.ToString(); + } + internal string GetTenantComputerGroupPath(string organizationId) { StringBuilder sb = new StringBuilder(); AppendProtocol(sb); AppendDomainController(sb); - AppendCNPath(sb, RdsServersOU); + AppendOUPath(sb, RdsServersOU); AppendOUPath(sb, organizationId); AppendOUPath(sb, RootOU); AppendDomainPath(sb, RootDomain); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIs80/SSL/SSLModuleService80.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIs80/SSL/SSLModuleService80.cs index 58b731a6..01b8ab73 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIs80/SSL/SSLModuleService80.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIs80/SSL/SSLModuleService80.cs @@ -84,7 +84,7 @@ namespace WebsitePanel.Providers.Web.Iis X509CertificateCollection existCerts2 = storeMy.Certificates.Find(X509FindType.FindBySerialNumber, servercert.SerialNumber, false); var certData = existCerts2[0].Export(X509ContentType.Pfx); storeMy.Close(); - var x509Cert = new X509Certificate2(certData); + var x509Cert = new X509Certificate2(certData, string.Empty, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet); if (UseCCS) { @@ -176,10 +176,10 @@ namespace WebsitePanel.Providers.Web.Iis if (UseCCS) { // We need to use this constructor or we won't be able to export this certificate - x509Cert = new X509Certificate2(certificate, password, X509KeyStorageFlags.Exportable); + x509Cert = new X509Certificate2(certificate, password, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet); var certData = x509Cert.Export(X509ContentType.Pfx); - var convertedCert = new X509Certificate2(certData, string.Empty, X509KeyStorageFlags.Exportable); + var convertedCert = new X509Certificate2(certData, string.Empty, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet); // Attempts to move certificate to CCS UNC path try @@ -205,7 +205,7 @@ namespace WebsitePanel.Providers.Web.Iis } else { - x509Cert = new X509Certificate2(certificate, password); + x509Cert = new X509Certificate2(certificate, password, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet); // Step 1: Register X.509 certificate in the store // Trying to keep X.509 store open as less as possible @@ -278,7 +278,7 @@ namespace WebsitePanel.Providers.Web.Iis // Read certificate data from file var certData = new byte[fileStream.Length]; fileStream.Read(certData, 0, (int) fileStream.Length); - var convertedCert = new X509Certificate2(certData, CCSCommonPassword, X509KeyStorageFlags.Exportable); + var convertedCert = new X509Certificate2(certData, CCSCommonPassword, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet); fileStream.Close(); @@ -311,7 +311,7 @@ namespace WebsitePanel.Providers.Web.Iis { hostNames.AddRange(certificate.Extensions.Cast() .Where(e => e.Oid.Value == "2.5.29.17") // Subject Alternative Names - .SelectMany(e => e.Format(true).Split(new[] {"\r\n", "\n", "\n"}, StringSplitOptions.RemoveEmptyEntries).Select(s => s.Split('=')[1]))); + .SelectMany(e => e.Format(true).Split(new[] {"\r\n", "\n", "\n"}, StringSplitOptions.RemoveEmptyEntries).Where(s => s.Contains("=")).Select(s => s.Split('=')[1])).Where(s => !s.Contains(" "))); } var simpleName = certificate.GetNameInfo(X509NameType.SimpleName, false); @@ -320,7 +320,20 @@ namespace WebsitePanel.Providers.Web.Iis hostNames.Add(simpleName); } - // For every hostname (only one if using old school dedicated IP binding) + var wildcardHostName = hostNames.SingleOrDefault(h => h.StartsWith("*.")); + + // If a wildcard certificate is used + if (wildcardHostName != null) + { + if (!dedicatedIp) + { + // If using a wildcard ssl and not a dedicated IP, we take all the matching bindings on the site and use it to bind to SSL also. + hostNames.Remove(wildcardHostName); + hostNames.AddRange(website.Bindings.Where(b => !string.IsNullOrEmpty(b.Host) && b.Host.EndsWith(wildcardHostName.Substring(2))).Select(b => b.Host)); + } + } + + // For every hostname foreach (var hostName in hostNames) { var bindingInformation = string.Format("{0}:443:{1}", website.SiteIPAddress ?? "*", dedicatedIp ? "" : hostName); diff --git a/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs b/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs index 7d50298d..40b2e4a8 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs @@ -18,7 +18,6 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { using System.Web.Services.Protocols; using System; using System.Diagnostics; - using WebsitePanel.Providers.HostedSolution; /// @@ -100,6 +99,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { private System.Threading.SendOrPostCallback InstallCertificateOperationCompleted; + private System.Threading.SendOrPostCallback MoveSessionHostToRdsOUOperationCompleted; + /// public RemoteDesktopServices() { this.Url = "http://localhost:9003/RemoteDesktopServices.asmx"; @@ -210,6 +211,9 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { /// public event InstallCertificateCompletedEventHandler InstallCertificateCompleted; + /// + public event MoveSessionHostToRdsOUCompletedEventHandler MoveSessionHostToRdsOUCompleted; + /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/CreateCollection", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] @@ -1515,17 +1519,21 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/SaveRdsCollectionLocalAdmins", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public void SaveRdsCollectionLocalAdmins(OrganizationUser[] users, string[] hosts) { + public void SaveRdsCollectionLocalAdmins(string[] users, string[] hosts, string organizationId, string collectionName) { this.Invoke("SaveRdsCollectionLocalAdmins", new object[] { users, - hosts}); + hosts, + organizationId, + collectionName}); } /// - public System.IAsyncResult BeginSaveRdsCollectionLocalAdmins(OrganizationUser[] users, string[] hosts, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginSaveRdsCollectionLocalAdmins(string[] users, string[] hosts, string organizationId, string collectionName, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("SaveRdsCollectionLocalAdmins", new object[] { users, - hosts}, callback, asyncState); + hosts, + organizationId, + collectionName}, callback, asyncState); } /// @@ -1534,18 +1542,20 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { } /// - public void SaveRdsCollectionLocalAdminsAsync(OrganizationUser[] users, string[] hosts) { - this.SaveRdsCollectionLocalAdminsAsync(users, hosts, null); + public void SaveRdsCollectionLocalAdminsAsync(string[] users, string[] hosts, string organizationId, string collectionName) { + this.SaveRdsCollectionLocalAdminsAsync(users, hosts, organizationId, collectionName, null); } /// - public void SaveRdsCollectionLocalAdminsAsync(OrganizationUser[] users, string[] hosts, object userState) { + public void SaveRdsCollectionLocalAdminsAsync(string[] users, string[] hosts, string organizationId, string collectionName, object userState) { if ((this.SaveRdsCollectionLocalAdminsOperationCompleted == null)) { this.SaveRdsCollectionLocalAdminsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSaveRdsCollectionLocalAdminsOperationCompleted); } this.InvokeAsync("SaveRdsCollectionLocalAdmins", new object[] { users, - hosts}, this.SaveRdsCollectionLocalAdminsOperationCompleted, userState); + hosts, + organizationId, + collectionName}, this.SaveRdsCollectionLocalAdminsOperationCompleted, userState); } private void OnSaveRdsCollectionLocalAdminsOperationCompleted(object arg) { @@ -1558,16 +1568,18 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetRdsCollectionLocalAdmins", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public string[] GetRdsCollectionLocalAdmins(string hostName) { + public string[] GetRdsCollectionLocalAdmins(string organizationId, string collectionName) { object[] results = this.Invoke("GetRdsCollectionLocalAdmins", new object[] { - hostName}); + organizationId, + collectionName}); return ((string[])(results[0])); } /// - public System.IAsyncResult BeginGetRdsCollectionLocalAdmins(string hostName, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginGetRdsCollectionLocalAdmins(string organizationId, string collectionName, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetRdsCollectionLocalAdmins", new object[] { - hostName}, callback, asyncState); + organizationId, + collectionName}, callback, asyncState); } /// @@ -1577,17 +1589,18 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { } /// - public void GetRdsCollectionLocalAdminsAsync(string hostName) { - this.GetRdsCollectionLocalAdminsAsync(hostName, null); + public void GetRdsCollectionLocalAdminsAsync(string organizationId, string collectionName) { + this.GetRdsCollectionLocalAdminsAsync(organizationId, collectionName, null); } /// - public void GetRdsCollectionLocalAdminsAsync(string hostName, object userState) { + public void GetRdsCollectionLocalAdminsAsync(string organizationId, string collectionName, object userState) { if ((this.GetRdsCollectionLocalAdminsOperationCompleted == null)) { this.GetRdsCollectionLocalAdminsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetRdsCollectionLocalAdminsOperationCompleted); } this.InvokeAsync("GetRdsCollectionLocalAdmins", new object[] { - hostName}, this.GetRdsCollectionLocalAdminsOperationCompleted, userState); + organizationId, + collectionName}, this.GetRdsCollectionLocalAdminsOperationCompleted, userState); } private void OnGetRdsCollectionLocalAdminsOperationCompleted(object arg) { @@ -1729,6 +1742,46 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { } } + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/MoveSessionHostToRdsOU", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public void MoveSessionHostToRdsOU(string hostName) { + this.Invoke("MoveSessionHostToRdsOU", new object[] { + hostName}); + } + + /// + public System.IAsyncResult BeginMoveSessionHostToRdsOU(string hostName, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("MoveSessionHostToRdsOU", new object[] { + hostName}, callback, asyncState); + } + + /// + public void EndMoveSessionHostToRdsOU(System.IAsyncResult asyncResult) { + this.EndInvoke(asyncResult); + } + + /// + public void MoveSessionHostToRdsOUAsync(string hostName) { + this.MoveSessionHostToRdsOUAsync(hostName, null); + } + + /// + public void MoveSessionHostToRdsOUAsync(string hostName, object userState) { + if ((this.MoveSessionHostToRdsOUOperationCompleted == null)) { + this.MoveSessionHostToRdsOUOperationCompleted = new System.Threading.SendOrPostCallback(this.OnMoveSessionHostToRdsOUOperationCompleted); + } + this.InvokeAsync("MoveSessionHostToRdsOU", new object[] { + hostName}, this.MoveSessionHostToRdsOUOperationCompleted, userState); + } + + private void OnMoveSessionHostToRdsOUOperationCompleted(object arg) { + if ((this.MoveSessionHostToRdsOUCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.MoveSessionHostToRdsOUCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// public new void CancelAsync(object userState) { base.CancelAsync(userState); @@ -2358,4 +2411,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void InstallCertificateCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void MoveSessionHostToRdsOUCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); } diff --git a/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs b/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs index 038cc907..7a47e54b 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs @@ -566,12 +566,12 @@ namespace WebsitePanel.Server } [WebMethod, SoapHeader("settings")] - public void SaveRdsCollectionLocalAdmins(List users, List hosts) + public void SaveRdsCollectionLocalAdmins(List users, List hosts, string organizationId, string collectionName) { try { Log.WriteStart("'{0}' SaveRdsCollectionLocalAdmins", ProviderSettings.ProviderName); - RDSProvider.SaveRdsCollectionLocalAdmins(users, hosts); + RDSProvider.SaveRdsCollectionLocalAdmins(users, hosts, collectionName, organizationId); Log.WriteEnd("'{0}' SaveRdsCollectionLocalAdmins", ProviderSettings.ProviderName); } catch (Exception ex) @@ -582,12 +582,12 @@ namespace WebsitePanel.Server } [WebMethod, SoapHeader("settings")] - public List GetRdsCollectionLocalAdmins(string hostName) + public List GetRdsCollectionLocalAdmins(string organizationId, string collectionName) { try { Log.WriteStart("'{0}' GetRdsCollectionLocalAdmins", ProviderSettings.ProviderName); - var result = RDSProvider.GetRdsCollectionLocalAdmins(hostName); + var result = RDSProvider.GetRdsCollectionLocalAdmins(organizationId, collectionName); Log.WriteEnd("'{0}' GetRdsCollectionLocalAdmins", ProviderSettings.ProviderName); return result; @@ -646,5 +646,21 @@ namespace WebsitePanel.Server throw; } } + + [WebMethod, SoapHeader("settings")] + public void MoveSessionHostToRdsOU(string hostName) + { + try + { + Log.WriteStart("'{0}' MoveSessionHostToRdsOU", ProviderSettings.ProviderName); + RDSProvider.MoveSessionHostToRdsOU(hostName); + Log.WriteEnd("'{0}' MoveSessionHostToRdsOU", ProviderSettings.ProviderName); + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' MoveSessionHostToRdsOU", ProviderSettings.ProviderName), ex); + throw; + } + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Server/Web.config b/WebsitePanel/Sources/WebsitePanel.Server/Web.config index d9d1bde5..0dcd0c7d 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/Web.config +++ b/WebsitePanel/Sources/WebsitePanel.Server/Web.config @@ -5,17 +5,6 @@
- - - -
-
-
-
- -
- - diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/Entities/OfficeOnlineCollection.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/Entities/OfficeOnlineCollection.cs index 47e614ed..c7f2d45d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/Entities/OfficeOnlineCollection.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/Entities/OfficeOnlineCollection.cs @@ -13,12 +13,14 @@ namespace WebsitePanel.WebDav.Core.Config.Entities { IsEnabled = ConfigSection.OfficeOnline.IsEnabled; Url = ConfigSection.OfficeOnline.Url; + NewFilePath = ConfigSection.OfficeOnline.CobaltNewFilePath; CobaltFileTtl = ConfigSection.OfficeOnline.CobaltFileTtl; _officeExtensions = ConfigSection.OfficeOnline.Cast().ToList(); } public bool IsEnabled { get; private set; } public string Url { get; private set; } + public string NewFilePath { get; private set; } public int CobaltFileTtl { get; private set; } public IEnumerator GetEnumerator() diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/Entities/SessionKeysCollection.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/Entities/SessionKeysCollection.cs index f9337401..1a45b059 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/Entities/SessionKeysCollection.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/Entities/SessionKeysCollection.cs @@ -45,6 +45,16 @@ namespace WebsitePanel.WebDav.Core.Config.Entities } } + public string OwaEditFoldersSessionKey + { + get + { + SessionKeysElement sessionKey = + _sessionKeys.FirstOrDefault(x => x.Key == SessionKeysElement.OwaEditFoldersSessionKey); + return sessionKey != null ? sessionKey.Value : null; + } + } + public string WebDavRootFoldersPermissions { get diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/WebConfigSections/OfficeOnlineElement.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/WebConfigSections/OfficeOnlineElement.cs index 560b6964..823fc98a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/WebConfigSections/OfficeOnlineElement.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/WebConfigSections/OfficeOnlineElement.cs @@ -8,6 +8,7 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections private const string OwaViewKey = "OwaView"; private const string OwaEditorKey = "OwaEditor"; private const string OwaMobileViewKey = "OwaMobileView"; + private const string OwaNewFileViewKey = "OwaNewFileView"; [ConfigurationProperty(ExtensionKey, IsKey = true, IsRequired = true)] public string Extension @@ -37,5 +38,12 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections get { return this[OwaMobileViewKey].ToString(); } set { this[OwaMobileViewKey] = value; } } + + [ConfigurationProperty(OwaNewFileViewKey, IsKey = true, IsRequired = true)] + public string OwaNewFileView + { + get { return this[OwaNewFileViewKey].ToString(); } + set { this[OwaNewFileViewKey] = value; } + } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/WebConfigSections/OfficeOnlineElementCollection.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/WebConfigSections/OfficeOnlineElementCollection.cs index 03f570c5..51603c99 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/WebConfigSections/OfficeOnlineElementCollection.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/WebConfigSections/OfficeOnlineElementCollection.cs @@ -9,6 +9,7 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections private const string UrlKey = "url"; private const string IsEnabledKey = "isEnabled"; private const string CobaltFileTtlKey = "cobaltFileTtl"; + private const string CobaltNewFilePathKey = "cobaltNewFilePath"; [ConfigurationProperty(UrlKey, IsKey = true, IsRequired = true)] public string Url @@ -24,6 +25,13 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections set { this[IsEnabledKey] = value; } } + [ConfigurationProperty(CobaltNewFilePathKey, IsKey = true, IsRequired = true)] + public string CobaltNewFilePath + { + get { return this[CobaltNewFilePathKey].ToString(); } + set { this[CobaltNewFilePathKey] = value; } + } + [ConfigurationProperty(CobaltFileTtlKey, IsKey = true, IsRequired = true)] public int CobaltFileTtl { diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/WebConfigSections/SessionKeysElement.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/WebConfigSections/SessionKeysElement.cs index ca2a44fd..76a0e7e8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/WebConfigSections/SessionKeysElement.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/WebConfigSections/SessionKeysElement.cs @@ -14,6 +14,7 @@ namespace WebsitePanel.WebDav.Core.Config.WebConfigSections public const string WebDavRootFolderPermissionsKey = "WebDavRootFolderPermissionsKey"; public const string ResourseRenderCountKey = "ResourseRenderCountSessionKey"; public const string ItemIdSessionKey = "ItemId"; + public const string OwaEditFoldersSessionKey = "OwaEditFoldersSession"; [ConfigurationProperty(KeyKey, IsKey = true, IsRequired = true)] public string Key diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Entities/Owa/CheckFileInfo.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Entities/Owa/CheckFileInfo.cs index 076cb1e3..e5e72685 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Entities/Owa/CheckFileInfo.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Entities/Owa/CheckFileInfo.cs @@ -37,6 +37,10 @@ namespace WebsitePanel.WebDav.Core.Entities.Owa public bool RestrictedWebViewOnly { get; set; } [DataMember] public string ClientUrl { get; set; } + [DataMember] + public bool CloseButtonClosesWindow { get; set; } + //[DataMember] + //public string CloseUrl { get; set; } //[DataMember] //public bool UserCanNotWriteRelative { get; set; } @@ -59,8 +63,7 @@ namespace WebsitePanel.WebDav.Core.Entities.Owa //public string BreadcrumbFolderUrl { get; set; } //[DataMember] //public string ClientUrl { get; set; } - //[DataMember] - //public bool CloseButtonClosesWindow { get; set; } + //[DataMember] //public string CloseUrl { get; set; } //[DataMember] diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Extensions/UriExtensions.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Extensions/UriExtensions.cs index 3f6bd4c6..0311ecce 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Extensions/UriExtensions.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Extensions/UriExtensions.cs @@ -3,11 +3,19 @@ using System.Linq; namespace WebsitePanel.WebDav.Core.Extensions { - static class UriExtensions + public static class UriExtensions { public static Uri Append(this Uri uri, params string[] paths) { return new Uri(paths.Aggregate(uri.AbsoluteUri, (current, path) => string.Format("{0}/{1}", current.TrimEnd('/'), path.TrimStart('/')))); } + + public static string ToStringPath(this Uri uri) + { + var hostStart = uri.ToString().IndexOf(uri.Host, System.StringComparison.Ordinal); + var hostLength = uri.Host.Length; + + return uri.ToString().Substring(hostStart + hostLength, uri.ToString().Length - hostStart - hostLength); + } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IFolder.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IFolder.cs index f37b9f94..8e3e2163 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IFolder.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IFolder.cs @@ -148,7 +148,7 @@ namespace WebsitePanel.WebDav.Core public IResource GetResource(string name) { IHierarchyItem item = - _children.Single(i => i.DisplayName.Trim('/') == name.Trim('/')); + _children.Single(i => i.DisplayName.ToLowerInvariant().Trim('/') == name.ToLowerInvariant().Trim('/')); var resource = new WebDavResource(); resource.SetCredentials(_credentials); resource.SetHierarchyItem(item); @@ -295,11 +295,11 @@ namespace WebsitePanel.WebDav.Core { XmlResponseList = XmlDoc.GetElementsByTagName("d:response"); } - var children = new WebDavHierarchyItem[XmlResponseList.Count]; + var children = new WebDavResource[XmlResponseList.Count]; int counter = 0; foreach (XmlNode XmlCurrentResponse in XmlResponseList) { - var item = new WebDavHierarchyItem(); + var item = new WebDavResource(); item.SetCredentials(_credentials); foreach (XmlNode XmlCurrentNode in XmlCurrentResponse.ChildNodes) diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IItemContent.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IItemContent.cs index 399aeba0..681efa2e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IItemContent.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IItemContent.cs @@ -9,6 +9,7 @@ namespace WebsitePanel.WebDav.Core long ContentLength { get; } long AllocatedSpace { get; set; } string ContentType { get; } + string Summary { get; set; } void Download(string filename); byte[] Download(); diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IResource.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IResource.cs index d1545431..8a46fff6 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IResource.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IResource.cs @@ -50,6 +50,7 @@ namespace WebsitePanel.WebDav.Core SendChunked = false; AllowWriteStreamBuffering = false; + IsRootItem = item.IsRootItem; SetCredentials(credentials); SetHierarchyItem(item); } @@ -88,6 +89,8 @@ namespace WebsitePanel.WebDav.Core } } + public string Summary { get; set; } + /// /// Downloads content of the resource to a file specified by filename /// @@ -257,7 +260,7 @@ namespace WebsitePanel.WebDav.Core { get { - string displayName = _href.AbsoluteUri.Trim('/').Replace(_baseUri.AbsoluteUri.Trim('/'), ""); + string displayName = _href.ToString().Trim('/').Replace(_baseUri.ToString().Trim('/'), ""); displayName = Regex.Replace(displayName, "\\/$", ""); Match displayNameMatch = Regex.Match(displayName, "([\\/]+)$"); if (displayNameMatch.Success) @@ -480,7 +483,7 @@ namespace WebsitePanel.WebDav.Core { _href = href; - var baseUrl = href.AbsoluteUri.Remove(href.AbsoluteUri.Length - href.Segments.Last().Length); + var baseUrl = href.ToString().Remove(href.ToString().Length - href.ToString().Trim('/').Split('/').Last().Length); _baseUri = new Uri(baseUrl); } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Interfaces/Managers/IWebDavManager.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Interfaces/Managers/IWebDavManager.cs index fd1fdc3a..bf634dd8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Interfaces/Managers/IWebDavManager.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Interfaces/Managers/IWebDavManager.cs @@ -19,5 +19,6 @@ namespace WebsitePanel.WebDav.Core.Interfaces.Managers string GetFileUrl(string path); void DeleteResource(string path); void LockFile(string path); + string GetFileFolderPath(string path); } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Interfaces/Owa/IWopiServer.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Interfaces/Owa/IWopiServer.cs index 6f35d7ff..058ad936 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Interfaces/Owa/IWopiServer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Interfaces/Owa/IWopiServer.cs @@ -1,4 +1,4 @@ -using System.Web.Mvc; +using WebsitePanel.EnterpriseServer.Base.HostedSolution; using WebsitePanel.WebDav.Core.Client; using WebsitePanel.WebDav.Core.Entities.Owa; @@ -6,7 +6,7 @@ namespace WebsitePanel.WebDav.Core.Interfaces.Owa { public interface IWopiServer { - CheckFileInfo GetCheckFileInfo(string path); - FileResult GetFile(string path); + CheckFileInfo GetCheckFileInfo(WebDavAccessToken token); + byte[] GetFileBytes(int accessTokenId); } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs index 98ea32ec..de3626fd 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs @@ -50,9 +50,9 @@ namespace WebsitePanel.WebDav.Core.Managers children = ConnectToWebDavServer().Select(x => new WebDavResource { Href = new Uri(x.Url), - ItemType = ItemType.Folder, - ContentLength = x.Size, - AllocatedSpace = x.FRSMQuotaMB, + ItemType = ItemType.Folder, + ContentLength = x.Size * 1024 * 1024, + AllocatedSpace = (long)x.FRSMQuotaMB * 1024 * 1024, IsRootItem = true }).ToArray(); } @@ -103,7 +103,7 @@ namespace WebsitePanel.WebDav.Core.Managers public bool IsFile(string path) { - string folder = GetFileFolder(path); + string folder = GetFileFolderPath(path); if (string.IsNullOrWhiteSpace(folder)) { @@ -124,7 +124,7 @@ namespace WebsitePanel.WebDav.Core.Managers { try { - string folder = GetFileFolder(path); + string folder = GetFileFolderPath(path); var resourceName = GetResourceName(path); @@ -212,7 +212,7 @@ namespace WebsitePanel.WebDav.Core.Managers path = RemoveLeadingFromPath(path, "edit"); path = RemoveLeadingFromPath(path, WspContext.User.OrganizationId); - string folderPath = GetFileFolder(path); + string folderPath = GetFileFolderPath(path); OpenFolder(folderPath); @@ -232,7 +232,7 @@ namespace WebsitePanel.WebDav.Core.Managers { try { - string folder = GetFileFolder(path); + string folder = GetFileFolderPath(path); var resourceName = GetResourceName(path); @@ -240,9 +240,9 @@ namespace WebsitePanel.WebDav.Core.Managers return _currentFolder.GetResource(resourceName); } - catch (InvalidOperationException exception) + catch (Exception) { - throw new ResourceNotFoundException("Resource not found", exception); + return null; } } @@ -250,7 +250,7 @@ namespace WebsitePanel.WebDav.Core.Managers { try { - string folder = GetFileFolder(path); + string folder = GetFileFolderPath(path); var resourceName = GetResourceName(path); @@ -270,7 +270,7 @@ namespace WebsitePanel.WebDav.Core.Managers { try { - string folder = GetFileFolder(path); + string folder = GetFileFolderPath(path); var resourceName = GetResourceName(path); @@ -345,6 +345,7 @@ namespace WebsitePanel.WebDav.Core.Managers webDavitem.SetLastModified(file.Changed); webDavitem.ContentLength = file.Size; webDavitem.AllocatedSpace = file.FRSMQuotaMB; + webDavitem.Summary = file.Summary; convertResult.Add(webDavitem); } @@ -372,7 +373,7 @@ namespace WebsitePanel.WebDav.Core.Managers targetStream.Write(buffer, 0, n); } - private string GetFileFolder(string path) + public string GetFileFolderPath(string path) { path = path.TrimEnd('/'); diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Owa/CobaltSessionManager.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Owa/CobaltSessionManager.cs index 2684bf83..e9f16955 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Owa/CobaltSessionManager.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Owa/CobaltSessionManager.cs @@ -2,8 +2,10 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Globalization; +using System.IO; using System.Linq; using System.Runtime.Caching; +using System.Web; using Cobalt; using WebsitePanel.WebDav.Core.Client; using WebsitePanel.WebDav.Core.Config; @@ -72,9 +74,20 @@ namespace WebsitePanel.WebDav.Core.Owa var token = _tokenManager.GetToken(accessTokenId); - var fileBytes = _webDavManager.GetFileBytes(token.FilePath); + Atom atom; - var atom = new AtomFromByteArray(fileBytes); + if (_webDavManager.FileExist(token.FilePath)) + { + var fileBytes = _webDavManager.GetFileBytes(token.FilePath); + + atom = new AtomFromByteArray(fileBytes); + } + else + { + var filePath = HttpContext.Current.Server.MapPath(WebDavAppConfigManager.Instance.OfficeOnline.NewFilePath + Path.GetExtension(token.FilePath)); + + atom = new AtomFromByteArray(File.ReadAllBytes(filePath)); + } Cobalt.Metrics o1; cobaltFile.GetCobaltFilePartition(FilePartitionId.Content).SetStream(RootId.Default.Value, atom, out o1); diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Owa/WopiServer.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Owa/WopiServer.cs index 547f930c..860d3528 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Owa/WopiServer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Owa/WopiServer.cs @@ -6,6 +6,8 @@ using System.Runtime.Serialization.Json; using System.Text; using System.Web; using System.Web.Mvc; +using Cobalt; +using WebsitePanel.EnterpriseServer.Base.HostedSolution; using WebsitePanel.WebDav.Core.Client; using WebsitePanel.WebDav.Core.Config; using WebsitePanel.WebDav.Core.Entities.Owa; @@ -22,25 +24,30 @@ namespace WebsitePanel.WebDav.Core.Owa private readonly IWebDavManager _webDavManager; private readonly IAccessTokenManager _tokenManager; private readonly IWebDavAuthorizationService _webDavAuthorizationService; + private readonly IWopiFileManager _fileManager; - public WopiServer(IWebDavManager webDavManager, IAccessTokenManager tokenManager, IWebDavAuthorizationService webDavAuthorizationService) + + public WopiServer(IWebDavManager webDavManager, IAccessTokenManager tokenManager, IWebDavAuthorizationService webDavAuthorizationService, IWopiFileManager fileManager) { _webDavManager = webDavManager; _tokenManager = tokenManager; _webDavAuthorizationService = webDavAuthorizationService; + _fileManager = fileManager; } - public CheckFileInfo GetCheckFileInfo(string path) + public CheckFileInfo GetCheckFileInfo(WebDavAccessToken token) { - var resource = _webDavManager.GetResource(path); + var resource = _webDavManager.GetResource(token.FilePath); - var readOnly = _webDavAuthorizationService.GetPermissions(WspContext.User, path).HasFlag(WebDavPermissions.Write) == false; + var permissions = _webDavAuthorizationService.GetPermissions(WspContext.User, token.FilePath); + + var readOnly = permissions.HasFlag(WebDavPermissions.Write) == false || permissions.HasFlag(WebDavPermissions.OwaEdit) == false; var cFileInfo = new CheckFileInfo { - BaseFileName = resource.DisplayName.Split(new []{'/'},StringSplitOptions.RemoveEmptyEntries).LastOrDefault(), + BaseFileName = resource == null ? token.FilePath.Split('/').Last() : resource.DisplayName.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries).LastOrDefault(), OwnerId = WspContext.User.Login, - Size = resource.ContentLength, + Size = resource == null ? 0 : resource.ContentLength, Version = DateTime.Now.ToString("s"), SupportsCoauth = true, SupportsCobalt = true, @@ -51,17 +58,34 @@ namespace WebsitePanel.WebDav.Core.Owa SupportsUpdate = true, UserCanWrite = !readOnly, ReadOnly = readOnly, - RestrictedWebViewOnly = false + RestrictedWebViewOnly = false, + CloseButtonClosesWindow = true }; + if (resource != null) + { + cFileInfo.ClientUrl = _webDavManager.GetFileUrl(token.FilePath); + } + return cFileInfo; } - public FileResult GetFile(string path) + public byte[] GetFileBytes(int accessTokenId) { - var fileBytes = _webDavManager.GetFileBytes(path); + var token = _tokenManager.GetToken(accessTokenId); - return new FileContentResult(fileBytes, MediaTypeNames.Application.Octet); + if (_webDavManager.FileExist(token.FilePath)) + { + return _webDavManager.GetFileBytes(token.FilePath); + } + + var cobaltFile = _fileManager.Get(token.FilePath) ?? _fileManager.Create(accessTokenId); + + var stream = new MemoryStream(); + + new GenericFda(cobaltFile.CobaltEndpoint, null).GetContentStream().CopyTo(stream); + + return stream.ToArray(); } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Security/Authorization/Enums/WebDavPermissions.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Security/Authorization/Enums/WebDavPermissions.cs index b3c9a52e..dd25dc50 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Security/Authorization/Enums/WebDavPermissions.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Security/Authorization/Enums/WebDavPermissions.cs @@ -8,6 +8,8 @@ namespace WebsitePanel.WebDav.Core.Security.Authorization.Enums Empty = 0, None = 1, Read = 2, - Write = 4 + Write = 4, + OwaRead = 8, + OwaEdit = 16 } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Security/Authorization/WebDavAuthorizationService.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Security/Authorization/WebDavAuthorizationService.cs index f0c285f3..d3fe710c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Security/Authorization/WebDavAuthorizationService.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Security/Authorization/WebDavAuthorizationService.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Web; +using Cobalt; using WebsitePanel.EnterpriseServer.Base.HostedSolution; using WebsitePanel.Providers.HostedSolution; using WebsitePanel.WebDav.Core.Config; @@ -54,6 +55,17 @@ namespace WebsitePanel.WebDav.Core.Security.Authorization } } + var owaEditFolders = GetOwaFoldersWithEditPermission(principal); + + if (owaEditFolders.Contains(rootFolder)) + { + resultPermissions |= WebDavPermissions.OwaEdit; + } + else + { + resultPermissions |= WebDavPermissions.OwaRead; + } + return resultPermissions; } @@ -105,5 +117,41 @@ namespace WebsitePanel.WebDav.Core.Security.Authorization return groups ?? new ExchangeAccount[0]; } + + private IEnumerable GetOwaFoldersWithEditPermission(WspPrincipal principal) + { + var folders = HttpContext.Current.Session != null ? HttpContext.Current.Session[WebDavAppConfigManager.Instance.SessionKeys.OwaEditFoldersSessionKey] as IEnumerable : null; + + if (folders != null) + { + return folders; + } + + var accountsIds = new List(); + + accountsIds.Add(principal.AccountId); + + var groups = GetUserSecurityGroups(principal); + + accountsIds.AddRange(groups.Select(x=>x.AccountId)); + + try + { + folders = WspContext.Services.EnterpriseStorage.GetUserEnterpriseFolderWithOwaEditPermission(principal.ItemId, accountsIds.ToArray()); + } + catch (Exception) + { + //TODO remove try catch when es &portal will be updated + return new List(); + } + + + if (HttpContext.Current.Session != null) + { + HttpContext.Current.Session[WebDavAppConfigManager.Instance.SessionKeys.OwaEditFoldersSessionKey] = folders; + } + + return folders; + } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/BundleConfig.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/BundleConfig.cs index 8b6dd2c9..d3be4e58 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/BundleConfig.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/BundleConfig.cs @@ -35,6 +35,10 @@ namespace WebsitePanel.WebDavPortal "~/Scripts/appScripts/wsp.js" )); + bundles.Add(new ScriptBundle("~/bundles/appScripts-webdav").Include( + "~/Scripts/appScripts/wsp-webdav.js" + )); + bundles.Add(new ScriptBundle("~/bundles/bigIconsScripts").Include( "~/Scripts/appScripts/recalculateResourseHeight.js" )); diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/RouteConfig.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/RouteConfig.cs index 1a5981a4..bf48c585 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/RouteConfig.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/RouteConfig.cs @@ -46,6 +46,32 @@ namespace WebsitePanel.WebDavPortal #region Enterprise storage + routes.MapRoute( + name: FileSystemRouteNames.ItemExist, + url: "storage/item-exist/{org}/{*pathPart}", + defaults: + new { controller = "FileSystem", action = "ItemExist", pathPart = UrlParameter.Optional } + ); + + routes.MapRoute( + name: FileSystemRouteNames.NewWebDavItem, + url: "storage/new/{org}/{*pathPart}", + defaults: + new { controller = "FileSystem", action = "NewWebDavItem", pathPart = UrlParameter.Optional } + ); + + routes.MapRoute( + name: FileSystemRouteNames.SearchFiles, + url: "storage/search/{org}/{*pathPart}", + defaults: new { controller = "FileSystem", action = "SearchFiles", pathPart = UrlParameter.Optional } + ); + + routes.MapRoute( + name: FileSystemRouteNames.SearchFilesContent, + url: "storage/ajax/search/{org}/{*pathPart}", + defaults: new { controller = "FileSystem", action = "SearchFilesContent", pathPart = UrlParameter.Optional } + ); + routes.MapRoute( name: FileSystemRouteNames.ChangeWebDavViewType, url: "storage/change-view-type/{viewType}", diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/Routes/FileSystemRouteNames.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/Routes/FileSystemRouteNames.cs index 23ac46e2..acb38f0c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/Routes/FileSystemRouteNames.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/Routes/FileSystemRouteNames.cs @@ -12,6 +12,9 @@ namespace WebsitePanel.WebDavPortal.UI.Routes public const string ShowContentDetails = "ShowContentDetailsRoute"; public const string ShowOfficeOnlinePath_ = "ShowOfficeOnlineRoute"; public const string ViewOfficeOnline = "ViewOfficeOnlineRoute"; + public const string NewFileOfficeOnline = "NewFileOfficeOnlineRoute"; + public const string NewWebDavItem = "NewWebDavItemRoute"; + public const string ItemExist = "ItemExistRoute"; public const string EditOfficeOnline = "EditOfficeOnlineRoute"; public const string ShowAdditionalContent = "ShowAdditionalContentRoute"; @@ -21,5 +24,8 @@ namespace WebsitePanel.WebDavPortal.UI.Routes public const string DeleteFiles = "DeleteFilesRoute"; public const string DownloadFile = "DownloadFileRoute"; + + public const string SearchFiles = "SearchFilesRoute"; + public const string SearchFilesContent = "SearchFilesPostRoute"; } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Constants/Formtas.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Constants/Formtas.cs new file mode 100644 index 00000000..9c4127ab --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Constants/Formtas.cs @@ -0,0 +1,7 @@ +namespace WebsitePanel.WebDavPortal.Constants +{ + public class Formtas + { + public const string DateFormatWithTime = "MM/dd/yyyy hh:mm tt"; + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/OwaFiles/New.docx b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/OwaFiles/New.docx new file mode 100644 index 00000000..b5ca5258 Binary files /dev/null and b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/OwaFiles/New.docx differ diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/OwaFiles/New.pptx b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/OwaFiles/New.pptx new file mode 100644 index 00000000..cc170548 Binary files /dev/null and b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/OwaFiles/New.pptx differ diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/OwaFiles/New.xlsx b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/OwaFiles/New.xlsx new file mode 100644 index 00000000..31991b64 Binary files /dev/null and b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/OwaFiles/New.xlsx differ diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css index f539d480..609ab5d0 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css @@ -60,6 +60,17 @@ tr.selected-file { .table-icon { height: 30px; + vertical-align: top; +} + +.column-name .file-info { + display: inline-block; + padding-left: 5px; + width: 90%; +} + +.table-icon.search { + height: 45px; } .noselect { @@ -77,6 +88,8 @@ tr.selected-file { #webdav-items-table .file-link { padding-left: 5px; + padding-top: 5px; + display: inline-block; vertical-align: middle !important; } @@ -86,6 +99,12 @@ tr.selected-file { height: 32px; } +#summary.summary { + font-size: 11px; + color: rgb(152, 152, 152); + word-wrap: break-word; +} + .drag-and-drop-area input { /* IE 8 */ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; @@ -233,17 +252,22 @@ tr.selected-file { .file-actions-menu .file-deletion { display: none; + margin-right: 10px; } .file-actions-menu .file-upload { display: inline-block; } +.create-new-item { + margin-top: -2px; +} + #message-area { margin-top: 15px; } -#processDialog .dialog-text { +#processDialog .dialog-text, .container .dialog-text{ display: inline-block; margin-left: 10px; } @@ -252,16 +276,41 @@ tr.selected-file { width: 200px; } -.search-block { - float: right; +.dataTables_processing { + width: 185px !important; + margin: 0 !important; + padding: 0 !important; + left: 43% !important; + background: initial !important; + background-color: #FFFFFF !important; + border: 1px solid #CDCDCD; + height: 44px !important; + z-index: 30; } -.search-block input, .search-block label { +.breadcrumb-wsp { + display: inline-block; + padding-top: 5px; +} + +.search-block { + float: right; + margin-right: 10px !important; + width: 36%; +} + +.search-block input{ + display: inline-block; + font-weight: normal; +} + +.search-block label { display: inline-block; width: initial; font-weight: normal; } + .elements-container { padding-top: 10px; } @@ -295,6 +344,25 @@ tr.selected-file { display: block; } +.column-name { + position: relative; +} + +.column-name #quota { + position: absolute; + right: 0px; + top: 20%; +} + + +.small-processing { + display: none; +} + +#filenameForm input { + max-width: 100%; +} + /* Theme Mods */ input,div{border-radius:0px!important;} @@ -361,4 +429,10 @@ div#breadcrumb_wrapper a:last-child { .header-portal-title { float: none; display: inline-block; +} + +@media (min-width: 768px) { + .navbar-right { + margin-right: 0; + } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/Api/OwaController.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/Api/OwaController.cs index 4b0e2a87..761214ef 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/Api/OwaController.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/Api/OwaController.cs @@ -54,22 +54,24 @@ namespace WebsitePanel.WebDavPortal.Controllers.Api { var token = _tokenManager.GetToken(accessTokenId); - var fileInfo = _wopiServer.GetCheckFileInfo(token.FilePath); + var fileInfo = _wopiServer.GetCheckFileInfo(token); - var urlPart = Url.Route(FileSystemRouteNames.ShowContentPath, new { org = WspContext.User.OrganizationId, pathPart = token.FilePath }); + if (fileInfo.Size <= 1) + { + return fileInfo; + } + + var urlPart = Url.Route(FileSystemRouteNames.ShowContentPath, new {org = WspContext.User.OrganizationId, pathPart = token.FilePath}); var url = new Uri(Request.RequestUri, urlPart).ToString(); fileInfo.DownloadUrl = url; - fileInfo.ClientUrl = _webDavManager.GetFileUrl(token.FilePath); return fileInfo; } public HttpResponseMessage GetFile(int accessTokenId) { - var token = _tokenManager.GetToken(accessTokenId); - - var bytes = _webDavManager.GetFileBytes(token.FilePath); + var bytes = _wopiServer.GetFileBytes(accessTokenId); var result = new HttpResponseMessage(HttpStatusCode.OK); diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs index c4c8591b..bf79329a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs @@ -35,6 +35,7 @@ using WebsitePanel.WebDavPortal.Models.Common.Enums; using WebsitePanel.WebDavPortal.Models.FileSystem; using WebsitePanel.WebDavPortal.UI; using WebsitePanel.WebDavPortal.UI.Routes; +using WebsitePanel.WebDav.Core.Extensions; namespace WebsitePanel.WebDavPortal.Controllers @@ -143,7 +144,6 @@ namespace WebsitePanel.WebDavPortal.Controllers } } - [HttpGet] public ActionResult GetContentDetails(string org, string pathPart, [ModelBinder(typeof (JqueryDataTableModelBinder))] JqueryDataTableRequest dtRequest) { @@ -151,16 +151,16 @@ namespace WebsitePanel.WebDavPortal.Controllers if (string.IsNullOrEmpty(dtRequest.Search.Value) == false) { - folderItems = _webdavManager.SearchFiles(WspContext.User.ItemId, pathPart, dtRequest.Search.Value, WspContext.User.Login, true).Select(x => new WebDavResource(null, x)); + folderItems = _webdavManager.SearchFiles(WspContext.User.ItemId, pathPart, dtRequest.Search.Value, WspContext.User.Login, true).Cast(); } else { - folderItems = _webdavManager.OpenFolder(pathPart).Select(x=>new WebDavResource(null, x)); + folderItems = _webdavManager.OpenFolder(pathPart).Cast(); } var tableItems = Mapper.Map, IEnumerable>(folderItems).ToList(); - FillContentModel(tableItems); + FillContentModel(tableItems, org); var orders = dtRequest.Orders.ToList(); orders.Insert(0, new JqueryDataTableOrder{Column = 3, Ascending = false}); @@ -184,6 +184,24 @@ namespace WebsitePanel.WebDavPortal.Controllers return PartialView("_ResourseCollectionPartial", result); } + public ActionResult SearchFiles(string org, string pathPart, string searchValue) + { + if (string.IsNullOrEmpty(searchValue)) + { + return RedirectToRoute(FileSystemRouteNames.ShowContentPath); + } + + var model = new ModelForWebDav + { + UrlSuffix = pathPart, + Permissions = _webDavAuthorizationService.GetPermissions(WspContext.User, pathPart), + UserSettings = _userSettingsManager.GetUserSettings(WspContext.User.AccountId), + SearchValue = searchValue + }; + + return View("ShowContentSearchResultTable", model); + } + [HttpGet] public ActionResult DownloadFile(string org, string pathPart) { @@ -285,6 +303,36 @@ namespace WebsitePanel.WebDavPortal.Controllers return Json(model); } + public ActionResult NewWebDavItem(string org, string pathPart) + { + var permissions = _webDavAuthorizationService.GetPermissions(WspContext.User, pathPart); + + var owaOpener = WebDavAppConfigManager.Instance.OfficeOnline.FirstOrDefault(x => x.Extension == Path.GetExtension(pathPart)); + + if (permissions.HasFlag(WebDavPermissions.Write) == false || (owaOpener != null && permissions.HasFlag(WebDavPermissions.OwaEdit) == false)) + { + return new RedirectToRouteResult(FileSystemRouteNames.ShowContentPath, null); + } + + if (owaOpener != null) + { + return ShowOfficeDocument(org, pathPart, owaOpener.OwaNewFileView); + } + + return new RedirectToRouteResult(FileSystemRouteNames.ShowContentPath, null); + } + + [HttpPost] + public JsonResult ItemExist(string org, string pathPart, string newItemName) + { + var exist = _webdavManager.FileExist(string.Format("{0}/{1}", pathPart.TrimEnd('/'), newItemName.Trim('/'))); + + return new JsonResult() + { + Data = !exist + }; + } + #region Owa Actions public ActionResult ShowOfficeDocument(string org, string pathPart, string owaOpenerUri) @@ -318,7 +366,7 @@ namespace WebsitePanel.WebDavPortal.Controllers { var permissions = _webDavAuthorizationService.GetPermissions(WspContext.User, pathPart); - if (permissions.HasFlag(WebDavPermissions.Write) == false || Request.Browser.IsMobileDevice) + if (permissions.HasFlag(WebDavPermissions.Write) == false || permissions.HasFlag(WebDavPermissions.OwaEdit) == false || Request.Browser.IsMobileDevice) { return new RedirectToRouteResult(FileSystemRouteNames.ViewOfficeOnline, null); } @@ -327,19 +375,21 @@ namespace WebsitePanel.WebDavPortal.Controllers return ShowOfficeDocument(org, pathPart, owaOpener.OwaEditor); } + #endregion - private void FillContentModel(IEnumerable items) + private void FillContentModel(IEnumerable items, string organizationId) { foreach (var item in items) { var opener = _openerManager[Path.GetExtension(item.DisplayName)]; + //var pathPart = item.Href.ToString().Replace("/" + WspContext.User.OrganizationId, "").TrimStart('/'); + var pathPart = item.Href.ToStringPath().Replace("/" + WspContext.User.OrganizationId, "").TrimStart('/'); switch (opener) { case FileOpenerType.OfficeOnline: { - var pathPart = item.Href.AbsolutePath.Replace("/" + WspContext.User.OrganizationId, "").TrimStart('/'); item.Url = string.Concat(Url.RouteUrl(FileSystemRouteNames.EditOfficeOnline, new {org = WspContext.User.OrganizationId, pathPart = ""}), pathPart); break; } @@ -350,6 +400,11 @@ namespace WebsitePanel.WebDavPortal.Controllers } } + var folderPath = Server.UrlDecode(_webdavManager.GetFileFolderPath(pathPart)); + + item.FolderUrlAbsoluteString = Server.UrlDecode(Url.RouteUrl(FileSystemRouteNames.ShowContentPath, new {org = organizationId, pathPart = folderPath}, Request.Url.Scheme)); + item.FolderUrlLocalString = Url.RouteUrl(FileSystemRouteNames.ShowContentPath, new { org = organizationId, pathPart = folderPath }); + if (Request.Browser.IsMobileDevice) { item.IsTargetBlank = false; diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Helpers/ViewDataHelper.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Helpers/ViewDataHelper.cs new file mode 100644 index 00000000..6bcbccc6 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Helpers/ViewDataHelper.cs @@ -0,0 +1,31 @@ +using System; + +namespace WebsitePanel.WebDavPortal.Helpers +{ + public class ViewDataHelper + { + public static string BytesToSize(long bytes) + { + if (bytes == 0) + { + return string.Format("0 {0}", Resources.UI.Byte); + } + + var k = 1024; + + var sizes = new[] + { + Resources.UI.Bytes, + Resources.UI.KilobyteShort, + Resources.UI.MegabyteShort, + Resources.UI.GigabyteShort, + Resources.UI.TerabyteShort, + Resources.UI.PetabyteShort, + Resources.UI.ExabyteShort + }; + + var i = (int) Math.Floor(Math.Log(bytes)/Math.Log(k)); + return string.Format("{0} {1}", Math.Round(bytes/Math.Pow(k, i), 3), sizes[i]); + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/Profiles/Webdav/ResourceTableItemProfile.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/Profiles/Webdav/ResourceTableItemProfile.cs index a20e44b3..92987801 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/Profiles/Webdav/ResourceTableItemProfile.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/Profiles/Webdav/ResourceTableItemProfile.cs @@ -7,6 +7,7 @@ using AutoMapper; using WebsitePanel.WebDav.Core.Client; using WebsitePanel.WebDav.Core.Config; using WebsitePanel.WebDav.Core.Extensions; +using WebsitePanel.WebDavPortal.Constants; using WebsitePanel.WebDavPortal.FileOperations; using WebsitePanel.WebDavPortal.Models.FileSystem; @@ -43,9 +44,12 @@ namespace WebsitePanel.WebDavPortal.Mapping.Profiles.Webdav .ForMember(ti => ti.IconHref, x => x.MapFrom(hi => hi.ItemType == ItemType.Folder ? WebDavAppConfigManager.Instance.FileIcons.FolderPath.Trim('~') : WebDavAppConfigManager.Instance.FileIcons[Path.GetExtension(hi.DisplayName.Trim('/'))].Trim('~'))) .ForMember(ti => ti.IsTargetBlank, x => x.MapFrom(hi => openerManager.GetIsTargetBlank(hi))) .ForMember(ti => ti.LastModified, x => x.MapFrom(hi => hi.LastModified)) - .ForMember(ti => ti.LastModifiedFormated, x => x.MapFrom(hi => hi.LastModified == DateTime.MinValue ? "--" : (new WebDavResource(null, hi)).LastModified.ToString("dd/MM/yyyy hh:mm tt"))) + .ForMember(ti => ti.LastModifiedFormated, x => x.MapFrom(hi => hi.LastModified == DateTime.MinValue ? "--" : (new WebDavResource(null, hi)).LastModified.ToString(Formtas.DateFormatWithTime))) + .ForMember(ti => ti.Summary, x => x.MapFrom(hi => hi.Summary)) + .ForMember(ti => ti.IsRoot, x => x.MapFrom(hi => hi.IsRootItem)) .ForMember(ti => ti.Size, x => x.MapFrom(hi => hi.ContentLength)) + .ForMember(ti => ti.Quota, x => x.MapFrom(hi => hi.AllocatedSpace)) .ForMember(ti => ti.IsFolder, x => x.MapFrom(hi => hi.ItemType == ItemType.Folder)); } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/FileSystem/ResourceTableItemModel.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/FileSystem/ResourceTableItemModel.cs index 24ac5e13..bc605c28 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/FileSystem/ResourceTableItemModel.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/FileSystem/ResourceTableItemModel.cs @@ -12,10 +12,16 @@ namespace WebsitePanel.WebDavPortal.Models.FileSystem public bool IsTargetBlank { get; set; } public bool IsFolder { get; set; } public long Size { get; set; } + public bool IsRoot { get; set; } + public long Quota { get; set; } public string Type { get; set; } public DateTime LastModified { get; set; } public string LastModifiedFormated { get; set; } public string IconHref { get; set; } + public string FolderUrlAbsoluteString { get; set; } + public string FolderUrlLocalString { get; set; } + public string FolderName { get; set; } + public string Summary { get; set; } public override dynamic this[int index] { diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.Designer.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.Designer.cs index e3836593..f9a6db66 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.Designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.Designer.cs @@ -69,6 +69,24 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Byte. + /// + public static string Byte { + get { + return ResourceManager.GetString("Byte", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Bytes. + /// + public static string Bytes { + get { + return ResourceManager.GetString("Bytes", resourceCulture); + } + } + /// /// Looks up a localized string similar to Cancel. /// @@ -105,6 +123,15 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Create. + /// + public static string Create { + get { + return ResourceManager.GetString("Create", resourceCulture); + } + } + /// /// Looks up a localized string similar to Delete. /// @@ -141,6 +168,15 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Please enter file name. + /// + public static string EnterFileName { + get { + return ResourceManager.GetString("EnterFileName", resourceCulture); + } + } + /// /// Looks up a localized string similar to Error. /// @@ -150,6 +186,42 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to EB. + /// + public static string ExabyteShort { + get { + return ResourceManager.GetString("ExabyteShort", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Excel workbook. + /// + public static string ExcelWorkbook { + get { + return ResourceManager.GetString("ExcelWorkbook", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File. + /// + public static string File { + get { + return ResourceManager.GetString("File", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File name. + /// + public static string FileName { + get { + return ResourceManager.GetString("FileName", resourceCulture); + } + } + /// /// Looks up a localized string similar to File Upload. /// @@ -168,6 +240,24 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Info. + /// + public static string Info { + get { + return ResourceManager.GetString("Info", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File already exist. + /// + public static string ItemExist { + get { + return ResourceManager.GetString("ItemExist", resourceCulture); + } + } + /// /// Looks up a localized string similar to {0} items was removed.. /// @@ -177,6 +267,24 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to KB. + /// + public static string KilobyteShort { + get { + return ResourceManager.GetString("KilobyteShort", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MB. + /// + public static string MegabyteShort { + get { + return ResourceManager.GetString("MegabyteShort", resourceCulture); + } + } + /// /// Looks up a localized string similar to Modified. /// @@ -222,6 +330,15 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to PB. + /// + public static string PetabyteShort { + get { + return ResourceManager.GetString("PetabyteShort", resourceCulture); + } + } + /// /// Looks up a localized string similar to Please wait.... /// @@ -231,6 +348,15 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Powerpoint presentation. + /// + public static string PowerPointPresentation { + get { + return ResourceManager.GetString("PowerPointPresentation", resourceCulture); + } + } + /// /// Looks up a localized string similar to Processing. /// @@ -258,6 +384,24 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Search Documents. + /// + public static string SearchDocuments { + get { + return ResourceManager.GetString("SearchDocuments", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Search Results. + /// + public static string SearchResults { + get { + return ResourceManager.GetString("SearchResults", resourceCulture); + } + } + /// /// Looks up a localized string similar to Select files to upload. /// @@ -285,6 +429,15 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to TB. + /// + public static string TerabyteShort { + get { + return ResourceManager.GetString("TerabyteShort", resourceCulture); + } + } + /// /// Looks up a localized string similar to Type. /// @@ -303,6 +456,15 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Word document. + /// + public static string WordDocument { + get { + return ResourceManager.GetString("WordDocument", resourceCulture); + } + } + /// /// Looks up a localized string similar to Yes. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.resx b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.resx index 5cb4b1a3..56929bcc 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.resx @@ -120,6 +120,12 @@ Actions + + Byte + + + Bytes + Cancel @@ -132,6 +138,9 @@ Confirm + + Create + Delete @@ -144,18 +153,45 @@ Are you sure you want to delete {0} item(s)? + + Please enter file name + Error + + EB + + + Excel workbook + + + File + + + File name + File Upload Gb + + Info + + + File already exist + {0} items was removed. + + KB + + + MB + Modified @@ -171,9 +207,15 @@ or drag and drop files here. + + PB + Please wait... + + Powerpoint presentation + Processing @@ -183,6 +225,12 @@ Search + + Search Documents + + + Search Results + Select files to upload @@ -192,12 +240,18 @@ Table + + TB + Type Upload + + Word document + Yes diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/authentication.js b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/authentication.js index 3752ad1e..35a5b8ff 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/authentication.js +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/authentication.js @@ -1,18 +1,19 @@ -function CheckAuthenticationExpiration(authcookieName, logoutUrl) { - var c = $.cookie(authcookieName); - +function CheckAuthenticationExpiration(authTimeOutCookieName, authCookieName, logoutUrl) { + var c = $.cookie(authTimeOutCookieName); + if (c != null && c != "" && !isNaN(c)) { var now = new Date(); var ms = parseInt(c, 10); var expiration = new Date().setTime(ms); if (now > expiration) { + $.removeCookie(authTimeOutCookieName, { path: '/' }); window.location.replace(logoutUrl); } } } -function StartAuthExpirationCheckTimer(authcookieName, logoutUrl) { +function StartAuthExpirationCheckTimer(authTimeOutCookieName, authCookieName, logoutUrl) { setInterval(function() { - CheckAuthenticationExpiration(authcookieName, logoutUrl); + CheckAuthenticationExpiration(authTimeOutCookieName, authCookieName, logoutUrl); }, 20000); } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/dialogs.js b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/dialogs.js index 25693b41..64823404 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/dialogs.js +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/dialogs.js @@ -1,5 +1,9 @@ function WspDialogs() { - this.settings = { dialogId: "#confirm-dialog", processDialogId: "#processDialog" }; + this.settings = { + dialogId: "#confirm-dialog", + processDialogId: "#processDialog", + inlineProcessDialog: '.glyphicon-refresh' + }; } WspDialogs.prototype = @@ -36,6 +40,14 @@ WspDialogs.prototype = hideProcessDialog: function() { $(this.settings.processDialogId).modal('hide'); -} + }, + + showInlineProcessing: function(itemId) { + $(itemId).parent().find(this.settings.inlineProcessDialog).show(); + }, + + hideInlineProcessing: function (itemId) { + $(itemId).parent().find(this.settings.inlineProcessDialog).hide(); + } }; diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/fileBrowsing.js b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/fileBrowsing.js index 10478859..5849d557 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/fileBrowsing.js +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/fileBrowsing.js @@ -1,6 +1,21 @@ function WspFileBrowser() { - this.settings = { deletionBlockSelector: ".file-actions-menu .file-deletion", deletionUrl: "storage/files-group-action/delete" }; - this.table = null; + this.settings = { + deletionBlockSelector: ".file-actions-menu .file-deletion", + deletionUrl: "storage/files-group-action/delete", + fileExistUrl: "storage/fileExist", + textDateModified: "Date modified", + textSize: "Size", + textItemExist: "File already exists", + textItemExistFunc: function() { + return textItemExist; + } , + createNewItemDialogId: "#createNewItemDialog", + createNewItemButtonId: "#create-button", + createNewItemTitleId: '#create-dalog-label', + processingDialogDom: '

Please wait...

' + }; + this.itemsTable = null; + this.searchTable = null; } WspFileBrowser.prototype = { @@ -34,7 +49,8 @@ WspFileBrowser.prototype = { }).get(); }, - deleteSelectedItems: function(e) { + deleteSelectedItems: function (e) { + $.ajax({ type: 'POST', url: wsp.fileBrowser.settings.deletionUrl, @@ -45,7 +61,7 @@ WspFileBrowser.prototype = { wsp.fileBrowser.clearDeletedItems(model.DeletedFiles); wsp.fileBrowser.refreshDeletionBlock(); - wsp.fileBrowser.refreshDataTable(); + wsp.fileBrowser.refreshDataTable(wsp.fileBrowser.itemsTable); wsp.dialogs.hideProcessDialog(); }, @@ -53,7 +69,7 @@ WspFileBrowser.prototype = { wsp.messages.addErrorMessage(errorThrown); wsp.fileBrowser.refreshDeletionBlock(); - wsp.fileBrowser.refreshDataTable(); + wsp.fileBrowser.refreshDataTable(wsp.fileBrowser.itemsTable); wsp.dialogs.hideProcessDialog(); } @@ -79,17 +95,19 @@ WspFileBrowser.prototype = { }, initDataTable: function (tableId, ajaxUrl) { - this.table = $(tableId).dataTable({ + this.itemsTable = $(tableId).dataTable({ "ajax": ajaxUrl, - "processing": false, + "processing": true, "serverSide": true, + "dom": 'rtlp', "columnDefs": [ { "render": function(data, type, row) { - return '' + - '' + + return '
' + + '' + row.DisplayName + - ''; + '' + (row.IsRoot ? '' + wsp.fileBrowser.bytesToSize(row.Size) + ' / ' + wsp.fileBrowser.bytesToSize(row.Quota) + '' : '') + +'
'; }, "targets": 0 }, @@ -114,31 +132,88 @@ WspFileBrowser.prototype = { "createdRow": function(row, data, index) { $(row).addClass('element-container'); }, - "fnPreDrawCallback": function () { - // gather info to compose a message - wsp.dialogs.showProcessDialog(); - return true; - }, - "fnDrawCallback": function () { - // in case your overlay needs to be put away automatically you can put it here - wsp.dialogs.hideProcessDialog(); + "oLanguage": { + "sProcessing": this.settings.processingDialogDom } }); $(tableId).removeClass('dataTable'); - var oTable = this.table; - $(tableId+'_filter input').unbind(); - $(tableId+'_filter input').bind('keyup', function (e) { - if (e.keyCode == 13) { - oTable.fnFilter(this.value); - } - }); + //var oTable = this.table; + + //$(searchInputId).bind('keyup', function (e) { + // if (e.keyCode == 13) { + // oTable.fnFilter(this.value); + // } + //}); + + //$(searchInputId).keydown(function (event) { + // if (event.keyCode == 13) { + // event.preventDefault(); + // return false; + // } + + // return true; + //}); + }, - refreshDataTable: function () { - if (this.table != null) { - this.table.fnDraw(false); + initSearchDataTable: function (tableId, ajaxUrl, initSearch) { + + var settings = this.settings; + var classThis = this; + + this.searchTable = $(tableId).dataTable({ + "ajax": ajaxUrl, + "processing": true, + "serverSide": true, + "oSearch": { "sSearch": initSearch }, + "dom": 'rtlp', + "columnDefs": [ + { + "render": function (data, type, row) { + return '
' + + '' + + '
' + + '' + + row.DisplayName + + '' + + '
' + (row.Summary ? (row.Summary + '').substring(0, 500) + '...' : '') + '
' + + '' + + '
' + + '
'; + }, + "targets": 0 + }, + { + "render": function (data, type, row) { + return '
' +settings.textDateModified+': '+ row.LastModifiedFormated+ '
' + + '
' + settings.textSize + ': ' + classThis.bytesToSize(row.Size) + '
'; + }, + "orderable": false, + "width": "25%", + "targets": 1 + } + ], + "createdRow": function (row, data, index) { + $(row).addClass('element-container'); + }, + "oLanguage": { + "sProcessing": this.settings.processingDialogDom + } + }); + + $(tableId).removeClass('dataTable'); + + }, + + refreshDataTable: function (table) { + if (table != null) { + table.fnDraw(false); } }, @@ -186,6 +261,48 @@ WspFileBrowser.prototype = { } }); }; + }, + + bytesToSize: function(bytes) { + if (bytes == 0) return '0 Byte'; + var k = 1024; + var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + var i = Math.floor(Math.log(bytes) / Math.log(k)); + return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i]; + }, + + showCreateNewItemDialog: function (extension, target, title) { + $(this.settings.createNewItemButtonId).data('extension', extension); + $(this.settings.createNewItemButtonId).data('target', target); + + $(this.settings.createNewItemDialogId + " input").val(""); + + $(this.settings.createNewItemTitleId).text($(this.settings.createNewItemTitleId).data('title') + " " + title); + + $(this.settings.createNewItemDialogId).modal(); + }, + + hideCreateNewItemDialog: function () { + $(this.settings.createNewItemDialogId).modal('hide'); + }, + + uniqueFileNameFieldRule: function(fieldId) { + + return { + url: this.settings.fileExistUrl, + type: "post", + data: { + newItemName: function() { + return $(fieldId).val() + $(wsp.fileBrowser.settings.createNewItemButtonId).data('extension'); + } + }, + beforeSend: function(response) { + wsp.dialogs.showInlineProcessing(fieldId); + }, + complete: function() { + wsp.dialogs.hideInlineProcessing(fieldId); + } + }; } }; diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/wsp-webdav.js b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/wsp-webdav.js new file mode 100644 index 00000000..90c6f7d8 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/wsp-webdav.js @@ -0,0 +1,124 @@ +//Toggle file select + Ctrl multiselect +$(document).on('click', '.element-container', function (e) { + if (e.ctrlKey) { + $(this).toggleClass("selected-file"); + } else { + + wsp.fileBrowser.clearAllSelectedItems(); + + wsp.fileBrowser.selectItem(this); + } + + wsp.fileBrowser.refreshDeletionBlock(); +}); + +$(document).on('touchstart', '.element-container', function (e) { + var now = new Date().getTime(); + var lastTouch = $(this).data('lastTouch') || now + 1; + var delta = now - lastTouch; + + if (delta < 300 && delta > 0) { + wsp.fileBrowser.openItem(this); + $(this).data('lastTouch', 0); + } + + $(this).data('lastTouch', now); +}); + +//Double click file open +$(document).on('dblclick', '.element-container', function (e) { + wsp.fileBrowser.openItem(this); + + var links = $(this).find('.file-link'); + + if (links.length != 0 && $(links[0]).hasClass('processing-dialog')) { + wsp.dialogs.showProcessDialog(); + } +}); + + +//Delete button click +$(document).on('click', '.file-deletion #delete-button', function (e) { + var dialogId = $(this).data('target'); + var buttonText = $(this).data('target-positive-button-text'); + var content = $(this).data('target-content'); + var title = $(this).data('target-title-text'); + + content = jQuery.validator.format(content, wsp.fileBrowser.getSelectedItemsCount()); + + wsp.dialogs.showConfirmDialog(title, content, buttonText, wsp.fileBrowser.deleteSelectedItems, dialogId); +}); + + +$(document).click(function (event) { + if (!$(event.target).closest('.element-container, .prevent-deselect').length) { + wsp.fileBrowser.clearAllSelectedItems(); + wsp.fileBrowser.refreshDeletionBlock(); + } +}); + +$('#drag-and-drop-area').click(function (e) { + $('#file-input').click(); +}); + +$('#drag-and-drop-area #file-input').click(function (e) { + e.stopPropagation(); +}); + + + +$("#create-button").click(function (e) { + + if ($('#filenameForm').valid()) { + + var fileName = $('#createNewItemDialog #filename').val() + $(this).data('extension'); + + $(this).attr('href', $(this).data('href') + '/' + fileName); + + $(this).attr('target', $(this).data('target')); + + wsp.fileBrowser.hideCreateNewItemDialog(); + //; + } else { + e.preventDefault(); + } +}); + +$(document).ready(function () { + + $('#filenameForm').validate({ + onkeyup: false, + onclick: false, + async: false, + rules: { + filename: { + required: true, + synchronousRemote: wsp.fileBrowser.uniqueFileNameFieldRule("#filename") + } + }, + messages: { + filename: { + synchronousRemote: wsp.fileBrowser.settings.textItemExist + } + } + }); + +}); + +$('#filename').keydown(function (event) { + if (event.keyCode == 13) { + event.preventDefault(); + return false; + } + return true; +}); + + +$(".create-new-item li a").click(function () { + + $("#filenameForm").clearValidation(); + + wsp.fileBrowser.showCreateNewItemDialog($(this).data('extension'), $(this).data('target'), $(this).text()); + + $("#filename").focus(); +}); diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/wsp.js b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/wsp.js index 41f36ed8..a45da0f1 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/wsp.js +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/wsp.js @@ -10,72 +10,84 @@ $(document).on('click', '.processing-dialog', function (e) { }); -//Toggle file select + Ctrl multiselect -$(document).on('click', '.element-container', function (e) { - if (e.ctrlKey) { - $(this).toggleClass("selected-file"); - } else { +$(document).ready(function() { + //bootstrap jquery validate styles fix + $.validator.setDefaults({ + highlight: function(element) { + $(element).closest('.form-group').addClass('has-error'); + }, + unhighlight: function(element) { + $(element).closest('.form-group').removeClass('has-error'); + }, + errorElement: 'span', + errorClass: 'help-block', + errorPlacement: function(error, element) { + if (element.parent('.input-group').length) { + error.insertAfter(element.parent()); + } else { + error.insertAfter(element); + } + } + }); - wsp.fileBrowser.clearAllSelectedItems(); + $.validator.addMethod("synchronousRemote", function(value, element, param) { + if (this.optional(element)) { + return "dependency-mismatch"; + } - wsp.fileBrowser.selectItem(this); - } + var previous = this.previousValue(element); + if (!this.settings.messages[element.name]) { + this.settings.messages[element.name] = {}; + } + previous.originalMessage = this.settings.messages[element.name].remote; + this.settings.messages[element.name].remote = previous.message; - wsp.fileBrowser.refreshDeletionBlock(); -}); + param = typeof param === "string" && { url: param } || param; -$(document).on('touchstart', '.element-container', function(e) { - var now = new Date().getTime(); - var lastTouch = $(this).data('lastTouch') || now + 1; - var delta = now - lastTouch; + if (previous.old === value) { + return previous.valid; + } - if (delta < 300 && delta > 0) { - wsp.fileBrowser.openItem(this); - $(this).data('lastTouch', 0); - } - - $(this).data('lastTouch', now); -}); - -//Double click file open -$(document).on('dblclick', '.element-container', function (e) { - wsp.fileBrowser.openItem(this); - - var links = $(this).find('.file-link'); - - if (links.length != 0 && $(links[0]).hasClass('processing-dialog')) { - wsp.dialogs.showProcessDialog(); - } + previous.old = value; + var validator = this; + this.startRequest(element); + var data = {}; + data[element.name] = value; + var valid = "pending"; + $.ajax($.extend(true, { + url: param, + async: false, + mode: "abort", + port: "validate" + element.name, + dataType: "json", + data: data, + success: function(response) { + validator.settings.messages[element.name].remote = previous.originalMessage; + valid = response === true || response === "true"; + if (valid) { + var submitted = validator.formSubmitted; + validator.prepareElement(element); + validator.formSubmitted = submitted; + validator.successList.push(element); + delete validator.invalid[element.name]; + validator.showErrors(); + } else { + var errors = {}; + var message = response || validator.defaultMessage(element, "remote"); + errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message; + validator.invalid[element.name] = true; + validator.showErrors(errors); + } + previous.valid = valid; + validator.stopRequest(element, valid); + } + }, param)); + return valid; + }, "Please fix this field."); }); -//Delete button click -$(document).on('click', '.file-deletion #delete-button', function (e) { - var dialogId = $(this).data('target'); - var buttonText = $(this).data('target-positive-button-text'); - var content = $(this).data('target-content'); - var title = $(this).data('target-title-text'); - - content = jQuery.validator.format(content, wsp.fileBrowser.getSelectedItemsCount()); - - wsp.dialogs.showConfirmDialog(title, content, buttonText, wsp.fileBrowser.deleteSelectedItems, dialogId); -}); - - -$(document).click(function(event) { - if (!$(event.target).closest('.element-container, .prevent-deselect').length) { - wsp.fileBrowser.clearAllSelectedItems(); - wsp.fileBrowser.refreshDeletionBlock(); - } -}); - -$('#drag-and-drop-area').click(function (e) { - $('#file-input').click(); -}); - -$('#drag-and-drop-area #file-input').click(function (e) { - e.stopPropagation(); -}); +$.fn.clearValidation = function () { var v = $(this).validate(); $('[name]', this).each(function () { v.successList.push(this); v.showErrors(); }); v.resetForm(); v.reset(); $(this).find('.form-group').removeClass('has-error'); }; function isMobileDevice() { diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowContent.cshtml b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowContent.cshtml index b36be144..db3e1da3 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowContent.cshtml +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowContent.cshtml @@ -25,9 +25,15 @@ else @section scripts{ + + + @Scripts.Render("~/bundles/appScripts-webdav") @if (Model.UserSettings.WebDavViewType == FolderViewTypes.BigIcons) { @@ -47,15 +53,37 @@ else { } } -@section popups -{ - @Html.Partial("_ProcessDialog", null) - @Html.Partial("_ConfirmDialog") +@section popups{ + } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowContentSearchResultTable.cshtml b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowContentSearchResultTable.cshtml new file mode 100644 index 00000000..d4044452 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowContentSearchResultTable.cshtml @@ -0,0 +1,29 @@ +@using WebsitePanel.WebDavPortal.Resources +@using WebsitePanel.WebDavPortal.UI.Routes +@model WebsitePanel.WebDavPortal.Models.ModelForWebDav + + +@Html.Partial("_ShowContentTopMenu", Model) + +
+ + + + + + + +
@UI.File@UI.Details
+
+ +@section scripts +{ + + @Scripts.Render("~/bundles/appScripts-webdav") +} + diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ResoursePartial.cshtml b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ResoursePartial.cshtml index 274f677b..9285872a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ResoursePartial.cshtml +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ResoursePartial.cshtml @@ -4,6 +4,7 @@ @using WebsitePanel.WebDav.Core.Config @using WebsitePanel.WebDavPortal.FileOperations @using Ninject; +@using WebsitePanel.WebDavPortal.Helpers @using WebsitePanel.WebDavPortal.Resources @using WebsitePanel.WebDavPortal.UI @using WebsitePanel.WebDavPortal.UI.Routes @@ -63,7 +64,7 @@

@percent%

-

@Math.Round(Convert.ToDecimal(resource.ContentLength) / 1024, 2) / @Math.Round(Convert.ToDecimal(resource.AllocatedSpace) / 1024, 2) @UI.GigabyteShort

+

@ViewDataHelper.BytesToSize(resource.ContentLength) / @ViewDataHelper.BytesToSize(resource.AllocatedSpace)

}
diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentBigIcons.cshtml b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentBigIcons.cshtml index e87f9c2d..8591768f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentBigIcons.cshtml +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentBigIcons.cshtml @@ -3,21 +3,6 @@ @using WebsitePanel.WebDavPortal.UI.Routes @model WebsitePanel.WebDavPortal.Models.ModelForWebDav -
- - -
-
diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentTable.cshtml b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentTable.cshtml index 8aed098b..a729ca02 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentTable.cshtml +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentTable.cshtml @@ -15,8 +15,3 @@
-@section popups -{ - @Html.Partial("_ProcessDialog", null) - @Html.Partial("_ConfirmDialog") -} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentTopMenu.cshtml b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentTopMenu.cshtml index 4a6089ff..b749eee1 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentTopMenu.cshtml +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentTopMenu.cshtml @@ -10,42 +10,82 @@ @if (Model != null) { string header = WspContext.User.OrganizationId; - @header - string[] elements = Model.UrlSuffix.Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries); - for (int i = 0; i < elements.Length; i++) - { - / - @elements[i] - } - } -
-
- @if (Model.Permissions.HasFlag(WebDavPermissions.Write)) - { -
+ @Html.Partial("_ProcessDialog", null) + @Html.Partial("_ConfirmDialog") + @RenderSection("popups", required: false)
@@ -62,9 +65,9 @@ @Scripts.Render("~/bundles/authScripts") } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Web.config b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Web.config index 265b5f6e..b33b3e60 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Web.config +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Web.config @@ -52,6 +52,7 @@ + @@ -84,13 +85,13 @@ - - - - - - - + + + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebsitePanel.WebDavPortal.csproj b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebsitePanel.WebDavPortal.csproj index 9327be8f..21db106b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebsitePanel.WebDavPortal.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebsitePanel.WebDavPortal.csproj @@ -165,6 +165,7 @@ + @@ -183,6 +184,7 @@ Global.asax + @@ -369,6 +371,8 @@ + + @@ -376,6 +380,7 @@ + @@ -459,6 +464,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config index f4e2aa27..ff127dbd 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config @@ -135,6 +135,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config index b78fd5a1..4f2a314a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config @@ -563,6 +563,9 @@ + + + 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 033cf7f3..5269c27d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -5656,6 +5656,12 @@ Session host certificate not installed + + RDS Server not added + + + Session host certificate has been installed + RDS Collection settings not updated diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/RDSServers.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/RDSServers.ascx.resx index 4677be06..a769c20c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/RDSServers.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/RDSServers.ascx.resx @@ -120,6 +120,9 @@ Add RDS Server + + Status + The list of RDS Servers is empty.<br><br>To add a new Server click "Add RDS Sever" button. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SystemSettings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SystemSettings.ascx.resx index d0dd8013..fb855fc2 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SystemSettings.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SystemSettings.ascx.resx @@ -162,4 +162,10 @@ (One (1) extension per line) + + Main RDS Controller: + + + RDS + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/RDSHelper.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/RDSHelper.cs index 0e13992a..0b5c8e67 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/RDSHelper.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/RDSHelper.cs @@ -52,11 +52,13 @@ namespace WebsitePanel.Portal { rdsServers = ES.Services.RDS.GetRdsServersPaged("", filterValue, sortColumn, startRowIndex, maximumRows); - return rdsServers.Servers; - //return new RdsServer[] { new RdsServer { Name = "rds.1.server", FqdName = "", Address = "127.0.0.1" }, - // new RdsServer { Name = "rds.2.server", FqdName = "", Address = "127.0.0.2" }, - // new RdsServer { Name = "rds.3.server", FqdName = "", Address = "127.0.0.3" }, - // new RdsServer { Name = "rds.4.server", FqdName = "", Address = "127.0.0.4" }}; + foreach (var rdsServer in rdsServers.Servers) + { + rdsServer.Status = ES.Services.RDS.GetRdsServerStatus(null, rdsServer.FqdName); + rdsServer.SslAvailable = ES.Services.RDS.GetRdsCertificateByItemId(rdsServer.ItemId) != null; + } + + return rdsServers.Servers; } public int GetOrganizationRdsServersPagedCount(int itemId, string filterValue) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderGeneralSettings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderGeneralSettings.ascx.resx index 371dc3d8..38060605 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderGeneralSettings.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderGeneralSettings.ascx.resx @@ -168,4 +168,7 @@ Soft + + General Settings + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderSettingsFolderPermissions.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderSettingsFolderPermissions.ascx.resx new file mode 100644 index 00000000..5052b0b5 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderSettingsFolderPermissions.ascx.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + ShowProgressDialog('Updating folder settings...'); + + + Save Changes + + + Folder Permissions + + + Permissions + + + Edit Folder + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderSettingsOwaEditing.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderSettingsOwaEditing.ascx.resx new file mode 100644 index 00000000..012d8bf8 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderSettingsOwaEditing.ascx.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + ShowProgressDialog('Updating folder settings...'); + + + Save Changes + + + Office Web App Editing + + + Users And Groups + + + Edit Folder + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx index 84cc95b7..37ced623 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx @@ -1,8 +1,11 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EnterpriseStorageFolderGeneralSettings.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.EnterpriseStorageFolderGeneralSettings" %> + <%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> <%@ Register Src="UserControls/EnterpriseStoragePermissions.ascx" TagName="ESPermissions" TagPrefix="wsp"%> <%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../UserControls/CollapsiblePanel.ascx" %> <%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> +<%@ Register TagPrefix="wsp" Namespace="WebsitePanel.Portal.ExchangeServer.UserControls" Assembly="WebsitePanel.Portal.Modules" %> +<%@ Register Src="UserControls/EnterpriseStorageEditFolderTabs.ascx" TagName="CollectionTabs" TagPrefix="wsp" %> @@ -16,62 +19,62 @@ - +
+ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + +
- - -
- - - -
- - -
-
-
 
- -
 
-
- - -
-
 
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + +
+ + +
+
+
 
+ +
 
+ - -
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.cs index 315780f2..ca4b3d1e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.cs @@ -107,11 +107,7 @@ namespace WebsitePanel.Portal.ExchangeServer break; } - var esPermissions = ES.Services.EnterpriseStorage.GetEnterpriseFolderPermissions(PanelRequest.ItemID,folder.Name); - chkDirectoryBrowsing.Checked = ES.Services.EnterpriseStorage.GetDirectoryBrowseEnabled(PanelRequest.ItemID, folder.Url); - - permissions.SetPermissions(esPermissions); } catch (Exception ex) { @@ -159,10 +155,9 @@ namespace WebsitePanel.Portal.ExchangeServer } } - ES.Services.EnterpriseStorage.SetEnterpriseFolderSettings( + ES.Services.EnterpriseStorage.SetEnterpriseFolderGeneralSettings( PanelRequest.ItemID, folder, - permissions.GetPemissions(), chkDirectoryBrowsing.Checked, (int)(decimal.Parse(txtFolderSize.Text) * OneGb), rbtnQuotaSoft.Checked ? QuotaType.Soft : QuotaType.Hard); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.designer.cs index dc276b18..4488393f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.designer.cs @@ -1,31 +1,3 @@ -// Copyright (c) 2015, Outercurve Foundation. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// - Neither the name of the Outercurve Foundation nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - //------------------------------------------------------------------------------ // // This code was generated by a tool. @@ -76,6 +48,15 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::System.Web.UI.WebControls.Literal litFolderName; + /// + /// tabs control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStorageEditFolderTabs tabs; + /// /// messageBox control. /// @@ -85,6 +66,24 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + /// + /// colFolderGeneralSettings control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel colFolderGeneralSettings; + + /// + /// panelFolderGeneralSettings control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel panelFolderGeneralSettings; + /// /// locFolderName control. /// @@ -211,33 +210,6 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::System.Web.UI.WebControls.CheckBox chkDirectoryBrowsing; - /// - /// PermissionsPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl PermissionsPanel; - - /// - /// PermissionsSection control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize PermissionsSection; - - /// - /// permissions control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStoragePermissions permissions; - /// /// btnSave control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx new file mode 100644 index 00000000..8bddadca --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx @@ -0,0 +1,55 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EnterpriseStorageFolderSettingsFolderPermissions.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.EnterpriseStorageFolderSettingsFolderPermissions" %> + + +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register Src="UserControls/EnterpriseStoragePermissions.ascx" TagName="ESPermissions" TagPrefix="wsp"%> +<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../UserControls/CollapsiblePanel.ascx" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> +<%@ Register TagPrefix="wsp" Namespace="WebsitePanel.Portal.ExchangeServer.UserControls" Assembly="WebsitePanel.Portal.Modules" %> +<%@ Register Src="UserControls/EnterpriseStorageEditFolderTabs.ascx" TagName="CollectionTabs" TagPrefix="wsp" %> + + + +
+
+
+
+
+
+
+ + + + +
+
+ + + + + + + + + + + + +
+
+ + +
+
 
+
+ +
+ + +
+
+
+
+
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx.cs new file mode 100644 index 00000000..219a9f4c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.OS; + +namespace WebsitePanel.Portal.ExchangeServer +{ + public partial class EnterpriseStorageFolderSettingsFolderPermissions : WebsitePanelModuleBase + { + #region Constants + + private const int OneGb = 1024; + + #endregion + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + if (!ES.Services.EnterpriseStorage.CheckUsersDomainExists(PanelRequest.ItemID)) + { + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "enterprisestorage_folders", + "ItemID=" + PanelRequest.ItemID)); + } + + BindSettings(); + } + } + + private void BindSettings() + { + try + { + // get settings + Organization org = ES.Services.Organizations.GetOrganization(PanelRequest.ItemID); + + SystemFile folder = ES.Services.EnterpriseStorage.GetEnterpriseFolder( + PanelRequest.ItemID, PanelRequest.FolderID); + + litFolderName.Text = string.Format("{0}", folder.Name); + + // bind form + var esPermissions = ES.Services.EnterpriseStorage.GetEnterpriseFolderPermissions(PanelRequest.ItemID,folder.Name); + + permissions.SetPermissions(esPermissions); + } + catch (Exception ex) + { + messageBox.ShowErrorMessage("ENETERPRISE_STORAGE_GET_FOLDER_SETTINGS", ex); + } + } + + protected void btnSave_Click(object sender, EventArgs e) + { + if (!Page.IsValid) + return; + + try + { + SystemFile folder = new SystemFile { Name = PanelRequest.FolderID }; + + if (!ES.Services.EnterpriseStorage.CheckEnterpriseStorageInitialization(PanelSecurity.PackageId, PanelRequest.ItemID)) + { + ES.Services.EnterpriseStorage.CreateEnterpriseStorage(PanelSecurity.PackageId, PanelRequest.ItemID); + } + + ES.Services.EnterpriseStorage.SetEnterpriseFolderPermissionSettings( + PanelRequest.ItemID, + folder, + permissions.GetPemissions()); + + + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "enterprisestorage_folders", + "ItemID=" + PanelRequest.ItemID)); + } + catch (Exception ex) + { + messageBox.ShowErrorMessage("ENTERPRISE_STORAGE_UPDATE_FOLDER_SETTINGS", ex); + } + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx.designer.cs new file mode 100644 index 00000000..503327d4 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx.designer.cs @@ -0,0 +1,132 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ExchangeServer { + + + public partial class EnterpriseStorageFolderSettingsFolderPermissions { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// Image1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image Image1; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// litFolderName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litFolderName; + + /// + /// tabs control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStorageEditFolderTabs tabs; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// colFolderPermissions control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel colFolderPermissions; + + /// + /// panelFolderPermissions control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel panelFolderPermissions; + + /// + /// PermissionsPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl PermissionsPanel; + + /// + /// PermissionsSection control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize PermissionsSection; + + /// + /// permissions control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStoragePermissions permissions; + + /// + /// btnSave control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnSave; + + /// + /// valSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ValidationSummary valSummary; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx new file mode 100644 index 00000000..07ed6c6c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx @@ -0,0 +1,54 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EnterpriseStorageFolderSettingsOwaEditing.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.EnterpriseStorageFolderSettingsOwaEditing" %> + + +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register Src="UserControls/EnterpriseStorageOwaUsersList.ascx" TagName="OwaUsers" TagPrefix="wsp"%> +<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../UserControls/CollapsiblePanel.ascx" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> +<%@ Register Src="UserControls/EnterpriseStorageEditFolderTabs.ascx" TagName="CollectionTabs" TagPrefix="wsp" %> + + + +
+
+
+
+
+
+
+ + + + +
+
+ + + + + + + + + + + + +
+
+ + +
+
 
+
+ +
+ + +
+
+
+
+
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx.cs new file mode 100644 index 00000000..108c1c24 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.OS; + +namespace WebsitePanel.Portal.ExchangeServer +{ + public partial class EnterpriseStorageFolderSettingsOwaEditing : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + if (!ES.Services.EnterpriseStorage.CheckUsersDomainExists(PanelRequest.ItemID)) + { + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "enterprisestorage_folders", + "ItemID=" + PanelRequest.ItemID)); + } + + BindSettings(); + } + } + + private void BindSettings() + { + try + { + // get settings + Organization org = ES.Services.Organizations.GetOrganization(PanelRequest.ItemID); + + SystemFile folder = ES.Services.EnterpriseStorage.GetEnterpriseFolder( + PanelRequest.ItemID, PanelRequest.FolderID); + + litFolderName.Text = string.Format("{0}", folder.Name); + + // bind form + var esPermissions = ES.Services.EnterpriseStorage.GetFolderOwaAccounts(PanelRequest.ItemID, folder); + + owaUsers.SetUsers(esPermissions); + } + catch (Exception ex) + { + messageBox.ShowErrorMessage("ENETERPRISE_STORAGE_GET_FOLDER_SETTINGS", ex); + } + } + + protected void btnSave_Click(object sender, EventArgs e) + { + if (!Page.IsValid) + return; + + try + { + SystemFile folder = new SystemFile { Name = PanelRequest.FolderID }; + + if (!ES.Services.EnterpriseStorage.CheckEnterpriseStorageInitialization(PanelSecurity.PackageId, PanelRequest.ItemID)) + { + ES.Services.EnterpriseStorage.CreateEnterpriseStorage(PanelSecurity.PackageId, PanelRequest.ItemID); + } + + ES.Services.EnterpriseStorage.SetFolderOwaAccounts( + PanelRequest.ItemID, + folder, + owaUsers.GetUsers()); + + + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "enterprisestorage_folders", + "ItemID=" + PanelRequest.ItemID)); + } + catch (Exception ex) + { + messageBox.ShowErrorMessage("ENTERPRISE_STORAGE_UPDATE_FOLDER_SETTINGS", ex); + } + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx.designer.cs new file mode 100644 index 00000000..b927b94e --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx.designer.cs @@ -0,0 +1,132 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ExchangeServer { + + + public partial class EnterpriseStorageFolderSettingsOwaEditing { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// Image1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image Image1; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// litFolderName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litFolderName; + + /// + /// tabs control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStorageEditFolderTabs tabs; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// colOwaEditing control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel colOwaEditing; + + /// + /// panelFolderPermissions control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel panelFolderPermissions; + + /// + /// OwaUsersPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl OwaUsersPanel; + + /// + /// locOwaEditingSection control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locOwaEditingSection; + + /// + /// owaUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStorageOwaUsersList owaUsers; + + /// + /// btnSave control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnSave; + + /// + /// valSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ValidationSummary valSummary; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/EnterpriseStorageEditFolderTabs.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/EnterpriseStorageEditFolderTabs.ascx.resx new file mode 100644 index 00000000..da04d0f8 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/EnterpriseStorageEditFolderTabs.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 + + + Folder Permissions + + + General Settings + + + Office Web App Editing + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/EnterpriseStorageOwaUsersList.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/EnterpriseStorageOwaUsersList.ascx.resx new file mode 100644 index 00000000..47a2f1e3 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/EnterpriseStorageOwaUsersList.ascx.resx @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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... + + + Add Accounts + + + Cancel + + + Delete + + + Display Name + + + E-mail Address + + + Display Name + + + Email + + + No accounts found. + + + The list of users is empty. Click "Add..." button. + + + Users + + + Enabled Users + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageEditFolderTabs.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageEditFolderTabs.ascx new file mode 100644 index 00000000..1fdcdd00 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageEditFolderTabs.ascx @@ -0,0 +1,31 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EnterpriseStorageEditFolderTabs.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStorageEditFolderTabs" %> + + + + + +
+ + + + + <%# Eval("Name") %> + + + + + + <%# Eval("Name") %> + + + +
+
+ + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageEditFolderTabs.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageEditFolderTabs.ascx.cs new file mode 100644 index 00000000..2065b00c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageEditFolderTabs.ascx.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using WebsitePanel.Portal.Code.UserControls; + +namespace WebsitePanel.Portal.ExchangeServer.UserControls +{ + public partial class EnterpriseStorageEditFolderTabs : WebsitePanelControlBase + { + public string SelectedTab { get; set; } + + protected void Page_Load(object sender, EventArgs e) + { + BindTabs(); + } + + private void BindTabs() + { + List tabsList = new List(); + tabsList.Add(CreateTab("enterprisestorage_folder_settings", "Tab.GeneralSettings")); + tabsList.Add(CreateTab("enterprisestorage_folder_settings_folder_permissions", "Tab.FolderPermissions")); + tabsList.Add(CreateTab("enterprisestorage_folder_settings_owa_editing", "Tab.OwaEditPermissions")); + + int idx = 0; + + foreach (Tab tab in tabsList) + { + if (String.Compare(tab.Id, SelectedTab, true) == 0) + { + break; + } + + idx++; + } + + esTabs.SelectedIndex = idx; + esTabs.DataSource = tabsList; + esTabs.DataBind(); + } + + private Tab CreateTab(string id, string text) + { + return new Tab(id,GetLocalizedString(text), + HostModule.EditUrl("AccountID", PanelRequest.AccountID.ToString(), id, + "SpaceID=" + PanelSecurity.PackageId.ToString(), + "ItemID=" + PanelRequest.ItemID.ToString(), "FolderID=" + PanelRequest.FolderID)); + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageEditFolderTabs.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageEditFolderTabs.ascx.designer.cs new file mode 100644 index 00000000..8d176214 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageEditFolderTabs.ascx.designer.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ExchangeServer.UserControls { + + + public partial class EnterpriseStorageEditFolderTabs { + + /// + /// esTabs control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DataList esTabs; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx new file mode 100644 index 00000000..a5b8246c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx @@ -0,0 +1,114 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EnterpriseStorageOwaUsersList.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStorageOwaUsersList" %> + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+
+ + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx.cs new file mode 100644 index 00000000..bf79f327 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx.cs @@ -0,0 +1,215 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using WebsitePanel.Providers.HostedSolution; + +namespace WebsitePanel.Portal.ExchangeServer.UserControls +{ + public partial class EnterpriseStorageOwaUsersList : WebsitePanelControlBase + { + public const string DirectionString = "DirectionString"; + + protected enum SelectedState + { + All, + Selected, + Unselected + } + + public void SetUsers(OrganizationUser[] users) + { + BindAccounts(users, false); + } + + public OrganizationUser[] GetUsers() + { + return GetGridViewUsers(EnterpriseStorageOwaUsersList.SelectedState.All).ToArray(); + } + + protected void Page_Load(object sender, EventArgs e) + { + // register javascript + if (!Page.ClientScript.IsClientScriptBlockRegistered("SelectAllCheckboxes")) + { + string script = @" function SelectAllCheckboxes(box) + { + var state = box.checked; + var elm = box.parentElement.parentElement.parentElement.parentElement.getElementsByTagName(""INPUT""); + for(i = 0; i < elm.length; i++) + if(elm[i].type == ""checkbox"" && elm[i].id != box.id && elm[i].checked != state && !elm[i].disabled) + elm[i].checked = state; + }"; + Page.ClientScript.RegisterClientScriptBlock(typeof(EnterpriseStorageOwaUsersList), "SelectAllCheckboxes", + script, true); + } + } + + protected void btnAdd_Click(object sender, EventArgs e) + { + // bind all accounts + BindPopupAccounts(); + + // show modal + AddAccountsModal.Show(); + } + + protected void btnDelete_Click(object sender, EventArgs e) + { + List selectedAccounts = GetGridViewUsers(EnterpriseStorageOwaUsersList.SelectedState.Unselected); + + BindAccounts(selectedAccounts.ToArray(), false); + } + + protected void btnAddSelected_Click(object sender, EventArgs e) + { + List selectedAccounts = GetGridViewAccounts(); + + BindAccounts(selectedAccounts.ToArray(), true); + + } + + public string GetAccountImage(int accountTypeId) + { + string imgName = string.Empty; + + ExchangeAccountType accountType = (ExchangeAccountType)accountTypeId; + switch (accountType) + { + case ExchangeAccountType.Room: + imgName = "room_16.gif"; + break; + case ExchangeAccountType.Equipment: + imgName = "equipment_16.gif"; + break; + default: + imgName = "admin_16.png"; + break; + } + + return GetThemedImage("Exchange/" + imgName); + } + + protected void BindPopupAccounts() + { + ExchangeAccount[] accounts = ES.Services.EnterpriseStorage.SearchESAccounts(PanelRequest.ItemID, + ddlSearchColumn.SelectedValue, txtSearchValue.Text + "%", ""); + + accounts = accounts.Where(x => !GetUsers().Select(p => p.AccountName).Contains(x.AccountName)).ToArray(); + + Array.Sort(accounts, CompareAccount); + + if (Direction == SortDirection.Ascending) + { + Array.Reverse(accounts); + Direction = SortDirection.Descending; + } + else + Direction = SortDirection.Ascending; + + gvPopupAccounts.DataSource = accounts; + gvPopupAccounts.DataBind(); + } + + protected void BindAccounts(OrganizationUser[] newUsers, bool preserveExisting) + { + // get binded addresses + List users = new List(); + if (preserveExisting) + users.AddRange(GetGridViewUsers(EnterpriseStorageOwaUsersList.SelectedState.All)); + + // add new accounts + if (newUsers != null) + { + foreach (OrganizationUser newUser in newUsers) + { + // check if exists + bool exists = false; + foreach (OrganizationUser user in users) + { + if (String.Compare(user.AccountName, newUser.AccountName, true) == 0) + { + exists = true; + break; + } + } + + if (exists) + continue; + + users.Add(newUser); + } + } + + gvUsers.DataSource = users; + gvUsers.DataBind(); + } + + protected List GetGridViewUsers(EnterpriseStorageOwaUsersList.SelectedState state) + { + List users = new List(); + for (int i = 0; i < gvUsers.Rows.Count; i++) + { + GridViewRow row = gvUsers.Rows[i]; + CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect"); + if (chkSelect == null) + continue; + + OrganizationUser user = new OrganizationUser(); + user.AccountName = (string)gvUsers.DataKeys[i][0]; + user.DisplayName = ((Literal)row.FindControl("litAccount")).Text; + user.AccountId = Convert.ToInt32(((HiddenField)row.FindControl("hdnAccountId")).Value); + + if (state == EnterpriseStorageOwaUsersList.SelectedState.All || + (state == EnterpriseStorageOwaUsersList.SelectedState.Selected && chkSelect.Checked) || + (state == EnterpriseStorageOwaUsersList.SelectedState.Unselected && !chkSelect.Checked)) + users.Add(user); + } + + return users; + } + + protected List GetGridViewAccounts() + { + List accounts = new List(); + for (int i = 0; i < gvPopupAccounts.Rows.Count; i++) + { + GridViewRow row = gvPopupAccounts.Rows[i]; + CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect"); + if (chkSelect == null) + continue; + + if (chkSelect.Checked) + { + accounts.Add(new OrganizationUser + { + AccountName = (string)gvPopupAccounts.DataKeys[i][0], + DisplayName = ((Literal)row.FindControl("litDisplayName")).Text, + AccountId = Convert.ToInt32(((HiddenField)row.FindControl("hdnAccountId")).Value) + }); + } + } + + return accounts; + + } + + protected void cmdSearch_Click(object sender, ImageClickEventArgs e) + { + BindPopupAccounts(); + } + + protected SortDirection Direction + { + get { return ViewState[DirectionString] == null ? SortDirection.Descending : (SortDirection)ViewState[DirectionString]; } + set { ViewState[DirectionString] = value; } + } + + protected static int CompareAccount(ExchangeAccount user1, ExchangeAccount user2) + { + return string.Compare(user1.DisplayName, user2.DisplayName); + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx.designer.cs new file mode 100644 index 00000000..d9681b0e --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx.designer.cs @@ -0,0 +1,159 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ExchangeServer.UserControls { + + + public partial class EnterpriseStorageOwaUsersList { + + /// + /// UsersUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel UsersUpdatePanel; + + /// + /// btnAdd control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAdd; + + /// + /// btnDelete control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnDelete; + + /// + /// gvUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvUsers; + + /// + /// AddAccountsPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel AddAccountsPanel; + + /// + /// headerAddAccounts control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize headerAddAccounts; + + /// + /// AddAccountsUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel AddAccountsUpdatePanel; + + /// + /// SearchPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SearchPanel; + + /// + /// ddlSearchColumn control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlSearchColumn; + + /// + /// txtSearchValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtSearchValue; + + /// + /// cmdSearch control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ImageButton cmdSearch; + + /// + /// gvPopupAccounts control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvPopupAccounts; + + /// + /// btnAddSelected control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAddSelected; + + /// + /// btnCancelAdd control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnCancelAdd; + + /// + /// btnAddAccountsFake control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAddAccountsFake; + + /// + /// AddAccountsModal control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::AjaxControlToolkit.ModalPopupExtender AddAccountsModal; + } +} 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 index f3221c01..dd9c465d 100644 --- 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 @@ -126,4 +126,25 @@ Server Name + + Certificate Password: + + + SSL Certificate + + + Select Certificate: + + + Expiry Date: + + + Issued By: + + + SAN Name: + + + Computers Root OU: + \ 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 879afc47..415fd085 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx @@ -1,5 +1,63 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDS_Settings.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.RDS_Settings" %> - +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> + +
+ +   + +
+ + + + + + + + + +
+ +
+ + + +
+ +
+ +   + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+
+
+
+ + + + + -
@@ -18,6 +76,15 @@
+ + + + +
@@ -72,4 +139,6 @@
\ No newline at end of file + +
+
\ 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 596af4e5..8806b61d 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 @@ -26,11 +26,14 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +using AjaxControlToolkit; using System; using System.Collections.Generic; +using System.Security.Cryptography.X509Certificates; using System.Web.UI.WebControls; using WebsitePanel.EnterpriseServer; using WebsitePanel.Providers.Common; +using WebsitePanel.Providers.RemoteDesktopServices; namespace WebsitePanel.Portal.ProviderControls { @@ -38,7 +41,7 @@ namespace WebsitePanel.Portal.ProviderControls { protected void Page_Load(object sender, EventArgs e) { - + FillCertificateInfo(); } public string GWServers @@ -53,15 +56,34 @@ namespace WebsitePanel.Portal.ProviderControls } } - public void BindSettings(System.Collections.Specialized.StringDictionary settings) + private void FillCertificateInfo() { + var certificate = ES.Services.RDS.GetRdsCertificateByServiceId(PanelRequest.ServiceId); + + if (certificate != null) + { + var array = Convert.FromBase64String(certificate.Hash); + char[] chars = new char[array.Length / sizeof(char)]; + System.Buffer.BlockCopy(array, 0, chars, 0, array.Length); + string password = new string(chars); + plCertificateInfo.Visible = true; + byte[] content = Convert.FromBase64String(certificate.Content); + var x509 = new X509Certificate2(content, password); + lblIssuedBy.Text = x509.Issuer.Replace("CN=", "").Replace("OU=", "").Replace("O=", "").Replace("L=", "").Replace("S=", "").Replace("C=", ""); + lblExpiryDate.Text = x509.NotAfter.ToLongDateString(); + lblSanName.Text = x509.SubjectName.Name.Replace("CN=", ""); + } + } + + public void BindSettings(System.Collections.Specialized.StringDictionary settings) + { txtConnectionBroker.Text = settings["ConnectionBroker"]; GWServers = settings["GWServrsList"]; - UpdateLyncServersGrid(); txtRootOU.Text = settings["RootOU"]; + txtComputersRootOu.Text = settings["ComputersRootOU"]; txtPrimaryDomainController.Text = settings["PrimaryDomainController"]; if (!string.IsNullOrEmpty(settings["UseCentralNPS"]) && bool.TrueString == settings["UseCentralNPS"]) @@ -82,11 +104,31 @@ namespace WebsitePanel.Portal.ProviderControls { settings["ConnectionBroker"] = txtConnectionBroker.Text; settings["RootOU"] = txtRootOU.Text; + settings["ComputersRootOU"] = txtComputersRootOu.Text; settings["PrimaryDomainController"] = txtPrimaryDomainController.Text; settings["UseCentralNPS"] = chkUseCentralNPS.Checked.ToString(); settings["CentralNPS"] = chkUseCentralNPS.Checked ? txtCentralNPS.Text : string.Empty; - settings["GWServrsList"] = GWServers; + settings["GWServrsList"] = GWServers; + + try + { + if (upPFX.HasFile.Equals(true)) + { + var certificate = new RdsCertificate + { + ServiceId = PanelRequest.ServiceId, + Content = Convert.ToBase64String(upPFX.FileBytes), + FileName = upPFX.FileName, + Hash = txtPFXInstallPassword.Text + }; + + ES.Services.RDS.AddRdsCertificate(certificate); + } + } + catch (Exception) + { + } } protected void chkUseCentralNPS_CheckedChanged(object sender, EventArgs e) @@ -144,7 +186,7 @@ namespace WebsitePanel.Portal.ProviderControls GWServers = str.TrimEnd(';'); UpdateLyncServersGrid(); } - } + } } public class GWServer 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 f0638a0c..81ceb1a6 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 @@ -1,31 +1,3 @@ -// Copyright (c) 2015, Outercurve Foundation. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// - Neither the name of the Outercurve Foundation nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - //------------------------------------------------------------------------------ // // This code was generated by a tool. @@ -40,6 +12,78 @@ namespace WebsitePanel.Portal.ProviderControls { public partial class RDS_Settings { + /// + /// secCertificateSettings control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label secCertificateSettings; + + /// + /// upPFX control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.FileUpload upPFX; + + /// + /// txtPFXInstallPassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtPFXInstallPassword; + + /// + /// currentCertificate control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label currentCertificate; + + /// + /// plCertificateInfo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel plCertificateInfo; + + /// + /// lblIssuedBy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblIssuedBy; + + /// + /// lblSanName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSanName; + + /// + /// lblExpiryDate control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblExpiryDate; + /// /// lblConnectionBroker control. /// @@ -94,6 +138,33 @@ namespace WebsitePanel.Portal.ProviderControls { /// protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator4; + /// + /// lblComputersRootOU control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblComputersRootOU; + + /// + /// txtComputersRootOu control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtComputersRootOu; + + /// + /// RequiredFieldValidator1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1; + /// /// lblPrimaryDomainController control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditApplicationUsers.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditApplicationUsers.ascx.resx index eb391f90..4d916746 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditApplicationUsers.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditApplicationUsers.ascx.resx @@ -153,4 +153,10 @@ Application Name + + Back to Applications List + + + Save Changes and Exit + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx index e7277028..9549a550 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx @@ -28,27 +28,7 @@ - - - - - - -
-
-
- -
-
- -
-
- -
-
-
-
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx.cs index 21ef3c4d..5f09adc8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx.cs @@ -63,27 +63,13 @@ namespace WebsitePanel.Portal.RDS } RdsCollection collection = new RdsCollection{ Name = txtCollectionName.Text, DisplayName = txtCollectionName.Text, Servers = servers.GetServers(), Description = "" }; - int collectionId = ES.Services.RDS.AddRdsCollection(PanelRequest.ItemID, collection); - - try - { - if (upPFX.HasFile.Equals(true)) - { - byte[] pfx = upPFX.FileBytes; - string certPassword = txtPFXInstallPassword.Text; - //ES.Services.RDS.InstallSessionHostsCertificate(collectionId, pfx, certPassword); - } - } - catch(Exception ex) - { - messageBox.ShowErrorMessage("RDSSESSIONHOST_CERTIFICATE_NOT_INSTALLED", ex); - } + int collectionId = ES.Services.RDS.AddRdsCollection(PanelRequest.ItemID, collection); Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "rds_edit_collection", "CollectionId=" + collectionId, "ItemID=" + PanelRequest.ItemID)); } catch (Exception ex) { - messageBox.ShowErrorMessage("RDSCOLLECTION_NOT_CREATED", ex); + ShowErrorMessage("RDSCOLLECTION_NOT_CREATED", ex); } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx.designer.cs index f61636b8..b1666d95 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx.designer.cs @@ -75,42 +75,6 @@ namespace WebsitePanel.Portal.RDS { /// protected global::System.Web.UI.WebControls.RequiredFieldValidator valCollectionName; - /// - /// secSelectSertificate control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.CollapsiblePanel secSelectSertificate; - - /// - /// panelSelectSertificate control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel panelSelectSertificate; - - /// - /// upPFX control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.FileUpload upPFX; - - /// - /// txtPFXInstallPassword control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox txtPFXInstallPassword; - /// /// RDSServersPanel control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx index 6095f06d..e7cf4275 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx @@ -55,8 +55,12 @@
- + + +
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx.cs index 41bdec12..a5731696 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx.cs @@ -52,6 +52,19 @@ namespace WebsitePanel.Portal.RDS txtApplicationName.Text = remoteApp.DisplayName; //var remoteAppUsers = organizationUsers.Where(x => applicationUsers.Contains(x.AccountName)); var remoteAppUsers = organizationUsers.Where(x => applicationUsers.Select(a => a.Split('\\').Last().ToLower()).Contains(x.SamAccountName.Split('\\').Last().ToLower())); + var localAdmins = ES.Services.RDS.GetRdsCollectionLocalAdmins(PanelRequest.CollectionID); + + foreach(var user in remoteAppUsers) + { + if (localAdmins.Select(l => l.AccountName).Contains(user.AccountName)) + { + user.IsVIP = true; + } + else + { + user.IsVIP = false; + } + } users.SetUsers(remoteAppUsers.ToArray()); } @@ -100,5 +113,10 @@ namespace WebsitePanel.Portal.RDS Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "rds_collection_edit_apps", "CollectionId=" + PanelRequest.CollectionID, "ItemID=" + PanelRequest.ItemID)); } } + + protected void btnExit_Click(object sender, EventArgs e) + { + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "rds_collection_edit_apps", "CollectionId=" + PanelRequest.CollectionID, "ItemID=" + PanelRequest.ItemID)); + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx.designer.cs index fd65d541..62030191 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx.designer.cs @@ -139,12 +139,30 @@ namespace WebsitePanel.Portal.RDS { protected global::WebsitePanel.Portal.RDS.UserControls.RDSCollectionUsers users; /// - /// buttonPanel control. + /// btnSave control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::WebsitePanel.Portal.ItemButtonPanel buttonPanel; + protected global::System.Web.UI.WebControls.Button btnSave; + + /// + /// btnSaveExit control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnSaveExit; + + /// + /// btnExit control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnExit; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionSettings.ascx index 56646324..b4c681b9 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionSettings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionSettings.ascx @@ -205,7 +205,7 @@ - + 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 767eab4f..8af9191a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx.cs @@ -27,6 +27,7 @@ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using System; +using System.Linq; using System.Web.UI.WebControls; using WebsitePanel.EnterpriseServer; using WebsitePanel.Providers.Common; @@ -45,6 +46,19 @@ namespace WebsitePanel.Portal.RDS BindQuota(); var collectionUsers = ES.Services.RDS.GetRdsCollectionUsers(PanelRequest.CollectionID); var collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID); + var localAdmins = ES.Services.RDS.GetRdsCollectionLocalAdmins(PanelRequest.CollectionID); + + foreach (var user in collectionUsers) + { + if (localAdmins.Select(l => l.AccountName).Contains(user.AccountName)) + { + user.IsVIP = true; + } + else + { + user.IsVIP = false; + } + } litCollectionName.Text = collection.DisplayName; users.SetUsers(collectionUsers); @@ -63,6 +77,12 @@ namespace WebsitePanel.Portal.RDS { usersQuota.QuotaAvailable = tenantStats.AllocatedRdsUsers - tenantStats.CreatedRdsUsers; } + + if (cntx.Quotas.ContainsKey(Quotas.RDS_USERS)) + { + int rdsUsersCount = ES.Services.RDS.GetOrganizationRdsUsersCount(PanelRequest.ItemID); + users.ButtonAddEnabled = (!(cntx.Quotas[Quotas.RDS_USERS].QuotaAllocatedValue <= rdsUsersCount) || (cntx.Quotas[Quotas.RDS_USERS].QuotaAllocatedValue == -1)); + } } private bool SaveRdsUsers() diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSLocalAdmins.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSLocalAdmins.ascx.cs index 1ea540d9..7ce5ca79 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSLocalAdmins.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSLocalAdmins.ascx.cs @@ -4,6 +4,8 @@ using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.RemoteDesktopServices; namespace WebsitePanel.Portal.RDS { @@ -17,6 +19,12 @@ namespace WebsitePanel.Portal.RDS var collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID); litCollectionName.Text = collection.DisplayName; + + foreach(var user in collectionLocalAdmins) + { + user.IsVIP = false; + } + users.SetUsers(collectionLocalAdmins); } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx index bbc141f1..36c6fb36 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx @@ -28,6 +28,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.cs index 15bf0ecc..47e39a3d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.cs @@ -136,7 +136,7 @@ namespace WebsitePanel.Portal.RDS.UserControls var fullRemote = new StartMenuApp { DisplayName = string.Format("Full Desktop - {0}", host.ToLower()), - FilePath = "%SystemRoot%\\system32\\mstsc.exe", + FilePath = "c:\\windows\\system32\\mstsc.exe", RequiredCommandLine = string.Format("/v:{0}", host.ToLower()) }; @@ -210,9 +210,16 @@ namespace WebsitePanel.Portal.RDS.UserControls RemoteApplication app = new RemoteApplication(); app.Alias = (string)gvApps.DataKeys[i][0]; - app.DisplayName = ((HyperLink)row.FindControl("lnkDisplayName")).Text; + app.DisplayName = ((LinkButton)row.FindControl("lnkDisplayName")).Text; app.FilePath = ((HiddenField)row.FindControl("hfFilePath")).Value; app.RequiredCommandLine = ((HiddenField)row.FindControl("hfRequiredCommandLine")).Value; + var users = ((HiddenField)row.FindControl("hfUsers")).Value; + + if (!string.IsNullOrEmpty(users)) + { + app.Users = new string[]{"New"}; + } + if (state == SelectedState.All || (state == SelectedState.Selected && chkSelect.Checked) || diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx index 4ba1e5c0..93432cd3 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx @@ -23,8 +23,9 @@ - + + @@ -81,6 +82,7 @@ + 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 fdd2e6ce..76837a86 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 @@ -42,6 +42,18 @@ namespace WebsitePanel.Portal.RDS.UserControls { public const string DirectionString = "DirectionString"; + public bool ButtonAddEnabled + { + get + { + return btnAdd.Enabled; + } + set + { + btnAdd.Enabled = value; + } + } + protected enum SelectedState { All, @@ -74,14 +86,7 @@ namespace WebsitePanel.Portal.RDS.UserControls }"; Page.ClientScript.RegisterClientScriptBlock(typeof(RDSCollectionUsers), "SelectAllCheckboxes", script, true); - } - - PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); - if (cntx.Quotas.ContainsKey(Quotas.RDS_USERS)) - { - int rdsUsersCount = ES.Services.RDS.GetOrganizationRdsUsersCount(PanelRequest.ItemID); - btnAdd.Enabled = (!(cntx.Quotas[Quotas.RDS_USERS].QuotaAllocatedValue <= rdsUsersCount) || (cntx.Quotas[Quotas.RDS_USERS].QuotaAllocatedValue == -1)); - } + } } protected void btnAdd_Click(object sender, EventArgs e) @@ -132,6 +137,19 @@ namespace WebsitePanel.Portal.RDS.UserControls protected void BindPopupAccounts() { OrganizationUser[] accounts = ES.Services.Organizations.GetOrganizationUsersPaged(PanelRequest.ItemID, null, null, null, 0, Int32.MaxValue).PageUsers; + var localAdmins = ES.Services.RDS.GetRdsCollectionLocalAdmins(PanelRequest.CollectionID); + + foreach (var user in accounts) + { + if (localAdmins.Select(l => l.AccountName).Contains(user.AccountName)) + { + user.IsVIP = true; + } + else + { + user.IsVIP = false; + } + } accounts = accounts.Where(x => !GetUsers().Select(p => p.AccountName).Contains(x.AccountName)).ToArray(); Array.Sort(accounts, CompareAccount); @@ -221,7 +239,8 @@ namespace WebsitePanel.Portal.RDS.UserControls { AccountName = (string)gvPopupAccounts.DataKeys[i][0], DisplayName = ((Literal)row.FindControl("litDisplayName")).Text, - SamAccountName = ((HiddenField)row.FindControl("hdnSamName")).Value + SamAccountName = ((HiddenField)row.FindControl("hdnSamName")).Value, + IsVIP = Convert.ToBoolean(((HiddenField)row.FindControl("hdnLocalAdmin")).Value) }); } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx index 0aa32a4e..45518cce 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx @@ -5,13 +5,18 @@ <%@ Register Src="UserControls/UserDetails.ascx" TagName="UserDetails" TagPrefix="uc2" %> <%@ Register Src="UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %> <%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register Src="UserControls/PopupHeader.ascx" TagName="PopupHeader" TagPrefix="wsp" %> +<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> - - + + + + + -
+
100 - - + +
+ + + + + + + + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + meta:resourcekey="cmdDelete" OnClientClick="if(confirm('Are you sure you want to delete selected rds server??')) ShowProgressDialog('Removeing RDS Server...'); else return false;"> - - - - - - - + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx.cs index 73454dff..1b73054e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx.cs @@ -31,6 +31,7 @@ using System.Data; using System.Configuration; using System.Collections; using System.Web; +using System.Linq; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; @@ -39,13 +40,14 @@ using System.Web.UI.HtmlControls; using WebsitePanel.EnterpriseServer; using WebsitePanel.Providers.Common; +using AjaxControlToolkit; namespace WebsitePanel.Portal { public partial class RDSServers : WebsitePanelModuleBase { protected void Page_Load(object sender, EventArgs e) - { + { if (!IsPostBack) { gvRDSServers.PageSize = Convert.ToInt16(ddlPageSize.SelectedValue); @@ -86,6 +88,8 @@ namespace WebsitePanel.Portal result = ES.Services.RDS.RemoveRdsServer(rdsServerId); } + ((ModalPopupExtender)asyncTasks.FindControl("ModalPopupProperties")).Hide(); + if (!result.IsSuccess) { messageBox.ShowMessage(result, "REMOTE_DESKTOP_SERVICES_REMOVE_RDSSERVER", "RDS"); @@ -99,6 +103,28 @@ namespace WebsitePanel.Portal ShowErrorMessage("REMOTE_DESKTOP_SERVICES_REMOVE_RDSSERVER", ex); } } + else if (e.CommandName == "ViewInfo") + { + try + { + ShowInfo(e.CommandArgument.ToString()); + } + catch (Exception) + { + } + } + else if (e.CommandName == "Restart") + { + Restart(e.CommandArgument.ToString()); + } + else if (e.CommandName == "ShutDown") + { + ShutDown(e.CommandArgument.ToString()); + } + else if (e.CommandName == "InstallCertificate") + { + InstallCertificate(e.CommandArgument.ToString()); + } } protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) @@ -107,5 +133,60 @@ namespace WebsitePanel.Portal gvRDSServers.DataBind(); } + + private void ShowInfo(string serverId) + { + ViewInfoModal.Show(); + var rdsServer = ES.Services.RDS.GetRdsServer(Convert.ToInt32(serverId)); + var serverInfo = ES.Services.RDS.GetRdsServerInfo(null, rdsServer.FqdName); + litProcessor.Text = string.Format("{0}x{1} MHz", serverInfo.NumberOfCores, serverInfo.MaxClockSpeed); + litLoadPercentage.Text = string.Format("{0}%", serverInfo.LoadPercentage); + litMemoryAllocated.Text = string.Format("{0} MB", serverInfo.MemoryAllocatedMb); + litFreeMemory.Text = string.Format("{0} MB", serverInfo.FreeMemoryMb); + rpServerDrives.DataSource = serverInfo.Drives; + rpServerDrives.DataBind(); + ((ModalPopupExtender)asyncTasks.FindControl("ModalPopupProperties")).Hide(); + } + + private void Restart(string serverId) + { + var rdsServer = ES.Services.RDS.GetRdsServer(Convert.ToInt32(serverId)); + ES.Services.RDS.RestartRdsServer(null, rdsServer.FqdName); + Response.Redirect(Request.Url.ToString(), true); + } + + private void ShutDown(string serverId) + { + var rdsServer = ES.Services.RDS.GetRdsServer(Convert.ToInt32(serverId)); + ES.Services.RDS.ShutDownRdsServer(null, rdsServer.FqdName); + Response.Redirect(Request.Url.ToString(), true); + } + + private void RefreshServerInfo() + { + var servers = odsRDSServersPaged.Select(); + gvRDSServers.DataSource = servers; + gvRDSServers.DataBind(); + ((ModalPopupExtender)asyncTasks.FindControl("ModalPopupProperties")).Hide(); + } + + private void InstallCertificate(string serverId) + { + var rdsServer = ES.Services.RDS.GetRdsServer(Convert.ToInt32(serverId)); + + try + { + ES.Services.RDS.InstallSessionHostsCertificate(rdsServer); + ((ModalPopupExtender)asyncTasks.FindControl("ModalPopupProperties")).Hide(); + ShowSuccessMessage("RDSSESSIONHOST_CERTIFICATE_INSTALLED"); + } + catch(Exception ex) + { + ShowErrorMessage("RDSSESSIONHOST_CERTIFICATE_NOT_INSTALLED", ex); + } + + messageBoxPanel.Update(); +// Response.Redirect(Request.Url.ToString(), true); + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx.designer.cs index 2c725f52..4dbf154c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx.designer.cs @@ -1,31 +1,3 @@ -// Copyright (c) 2015, Outercurve Foundation. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// - Neither the name of the Outercurve Foundation nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - //------------------------------------------------------------------------------ // // This code was generated by a tool. @@ -41,13 +13,22 @@ namespace WebsitePanel.Portal { public partial class RDSServers { /// - /// updatePanelUsers control. + /// asyncTasks control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.UpdatePanel updatePanelUsers; + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// messageBoxPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel messageBoxPanel; /// /// messageBox control. @@ -112,6 +93,24 @@ namespace WebsitePanel.Portal { /// protected global::System.Web.UI.WebControls.ImageButton cmdSearch; + /// + /// odsRDSServersPaged control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ObjectDataSource odsRDSServersPaged; + + /// + /// updatePanelUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel updatePanelUsers; + /// /// gvRDSServers control. /// @@ -122,12 +121,174 @@ namespace WebsitePanel.Portal { protected global::System.Web.UI.WebControls.GridView gvRDSServers; /// - /// odsRDSServersPaged control. + /// ServerInfoPanel control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.ObjectDataSource odsRDSServersPaged; + protected global::System.Web.UI.WebControls.Panel ServerInfoPanel; + + /// + /// Localize1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize Localize1; + + /// + /// serverInfoUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel serverInfoUpdatePanel; + + /// + /// secServerInfo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secServerInfo; + + /// + /// panelHardwareInfo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel panelHardwareInfo; + + /// + /// locProcessor control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal locProcessor; + + /// + /// litProcessor control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litProcessor; + + /// + /// locLoadPercentage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal locLoadPercentage; + + /// + /// litLoadPercentage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litLoadPercentage; + + /// + /// locMemoryAllocated control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal locMemoryAllocated; + + /// + /// litMemoryAllocated control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litMemoryAllocated; + + /// + /// locFreeMemory control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal locFreeMemory; + + /// + /// litFreeMemory control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litFreeMemory; + + /// + /// secRdsApplicationEdit control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secRdsApplicationEdit; + + /// + /// panelDiskDrives control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel panelDiskDrives; + + /// + /// rpServerDrives control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Repeater rpServerDrives; + + /// + /// btnCancelServerInfo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnCancelServerInfo; + + /// + /// btnViewInfoFake control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnViewInfoFake; + + /// + /// ViewInfoModal control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::AjaxControlToolkit.ModalPopupExtender ViewInfoModal; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServersAddserver.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServersAddserver.ascx index e7f20993..cd8f8054 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServersAddserver.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServersAddserver.ascx @@ -11,16 +11,16 @@
- + - +
- +
- +
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServersAddserver.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServersAddserver.ascx.cs index 56878a9e..a9758e28 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServersAddserver.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServersAddserver.ascx.cs @@ -62,8 +62,8 @@ namespace WebsitePanel.Portal ResultObject result = ES.Services.RDS.AddRdsServer(rdsServer); if (!result.IsSuccess && result.ErrorCodes.Count > 0) - { - messageBox.ShowMessage(result, "", ""); + { + messageBox.ShowMessage(result, "RDSSERVER_NOT_ADDED", ""); return; } @@ -71,7 +71,7 @@ namespace WebsitePanel.Portal } catch (Exception ex) { - messageBox.ShowErrorMessage("", ex); + ShowErrorMessage("RDSSERVER_NOT_ADDED", ex); } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServersAddserver.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServersAddserver.ascx.designer.cs index f9e8f578..7bf05979 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServersAddserver.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServersAddserver.ascx.designer.cs @@ -1,31 +1,3 @@ -// Copyright (c) 2015, Outercurve Foundation. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// - Neither the name of the Outercurve Foundation nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - //------------------------------------------------------------------------------ // // This code was generated by a tool. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx index 24542dbe..5fef4935 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx @@ -70,6 +70,18 @@ + + + + + + + +
+ + +
+
0) + { + ddlRdsController.SelectedValue = ddlRdsController.Items[0].Value; + } } private void SaveSettings() @@ -207,6 +227,16 @@ namespace WebsitePanel.Portal result = ES.Services.System.SetSystemSettings( WSP.SystemSettings.FILEMANAGER_SETTINGS, settings); + if (result < 0) + { + ShowResultMessage(result); + return; + } + + settings = new WSP.SystemSettings(); + settings[RDS_MAIN_CONTROLLER] = ddlRdsController.SelectedValue; + result = ES.Services.System.SetSystemSettings(WSP.SystemSettings.RDS_SETTINGS, settings); + if (result < 0) { ShowResultMessage(result); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx.designer.cs index 6b3cb964..d8358733 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx.designer.cs @@ -1,31 +1,3 @@ -// Copyright (c) 2015, Outercurve Foundation. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// - Neither the name of the Outercurve Foundation nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - //------------------------------------------------------------------------------ // // This code was generated by a tool. @@ -220,6 +192,42 @@ namespace WebsitePanel.Portal { /// protected global::System.Web.UI.WebControls.Literal litFileManagerEditableExtensions; + /// + /// RdsSettings control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel RdsSettings; + + /// + /// PanelRdsSettings control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel PanelRdsSettings; + + /// + /// lblRdsController control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize lblRdsController; + + /// + /// ddlRdsController control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlRdsController; + /// /// btnSaveSettings control. /// 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 c3f7651c..d7218b57 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -211,6 +211,20 @@ + + EnterpriseStorageFolderSettingsFolderPermissions.ascx + ASPXCodeBehind + + + EnterpriseStorageFolderSettingsFolderPermissions.ascx + + + EnterpriseStorageFolderSettingsOwaEditing.ascx + ASPXCodeBehind + + + EnterpriseStorageFolderSettingsOwaEditing.ascx + OrganizationDeletedUsers.ascx ASPXCodeBehind @@ -229,6 +243,20 @@ OrganizationDeletedUserGeneralSettings.ascx ASPXCodeBehind + + EnterpriseStorageEditFolderTabs.ascx + ASPXCodeBehind + + + EnterpriseStorageEditFolderTabs.ascx + + + EnterpriseStorageOwaUsersList.ascx + ASPXCodeBehind + + + EnterpriseStorageOwaUsersList.ascx + SmarterMail100_EditAccount.ascx ASPXCodeBehind @@ -4455,7 +4483,11 @@ + + + + @@ -4499,6 +4531,10 @@ Designer + + + + @@ -5678,7 +5714,9 @@ Designer - + + Designer + Designer @@ -5863,7 +5901,9 @@ - + + Designer + Designer