diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 54df0493..270e1dcc 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -8729,3 +8729,147 @@ AND SI.ItemName = @ItemName AND ((@GroupName IS NULL) OR (@GroupName IS NOT NULL AND RG.GroupName = @GroupName)) RETURN 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.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.Code/Data/DataProvider.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs index 1d903a9c..49501ef1 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 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/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.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/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/Owa/WopiServer.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Owa/WopiServer.cs index 547f930c..dada9bab 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Owa/WopiServer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Owa/WopiServer.cs @@ -34,7 +34,9 @@ namespace WebsitePanel.WebDav.Core.Owa { var resource = _webDavManager.GetResource(path); - var readOnly = _webDavAuthorizationService.GetPermissions(WspContext.User, path).HasFlag(WebDavPermissions.Write) == false; + var permissions = _webDavAuthorizationService.GetPermissions(WspContext.User, path); + + var readOnly = permissions.HasFlag(WebDavPermissions.Write) == false || permissions.HasFlag(WebDavPermissions.OwaEdit) == false; var cFileInfo = new CheckFileInfo { 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/Controllers/FileSystemController.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs index c4c8591b..dbb50095 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs @@ -318,7 +318,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); } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Web.config b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Web.config index 265b5f6e..3f07e5e5 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Web.config +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Web.config @@ -52,6 +52,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/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..33677cf3 --- /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 + + + 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..5a88b08e --- /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..3d39c38c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx.cs @@ -0,0 +1,214 @@ +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() + { + OrganizationUser[] accounts = ES.Services.Organizations.GetOrganizationUsersPaged(PanelRequest.ItemID, ddlSearchColumn.SelectedValue, txtSearchValue.Text + "%", null, 0, Int32.MaxValue).PageUsers; + + 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(OrganizationUser user1, OrganizationUser 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/WebsitePanel.Portal.Modules.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj index e5fa35b0..f989847b 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 + + + +