merge commit

This commit is contained in:
robvde 2015-03-07 08:03:25 +08:00
commit 6eb1661ca9
99 changed files with 4420 additions and 745 deletions

View file

@ -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
@ -8746,11 +8846,148 @@ AND ((@GroupName IS NULL) OR (@GroupName IS NOT NULL AND RG.GroupName = @GroupNa
RETURN
GO
-- Hyper-V 2012 R2
IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [ProviderName] = 'HyperV2012R2')
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
--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
-- Hyper-V 2012 R2
@ -8759,3 +8996,4 @@ 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

View file

@ -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 {
/// <remarks/>
public event SetEnterpriseFolderSettingsCompletedEventHandler SetEnterpriseFolderSettingsCompleted;
/// <remarks/>
public event SetEnterpriseFolderGeneralSettingsCompletedEventHandler SetEnterpriseFolderGeneralSettingsCompleted;
/// <remarks/>
public event SetEnterpriseFolderPermissionSettingsCompletedEventHandler SetEnterpriseFolderPermissionSettingsCompleted;
/// <remarks/>
public event GetFolderOwaAccountsCompletedEventHandler GetFolderOwaAccountsCompleted;
/// <remarks/>
public event SetFolderOwaAccountsCompletedEventHandler SetFolderOwaAccountsCompleted;
/// <remarks/>
public event GetUserEnterpriseFolderWithOwaEditPermissionCompletedEventHandler GetUserEnterpriseFolderWithOwaEditPermissionCompleted;
/// <remarks/>
public event GetStatisticsCompletedEventHandler GetStatisticsCompleted;
@ -1223,6 +1248,237 @@ namespace WebsitePanel.EnterpriseServer {
}
}
/// <remarks/>
[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});
}
/// <remarks/>
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);
}
/// <remarks/>
public void EndSetEnterpriseFolderGeneralSettings(System.IAsyncResult asyncResult) {
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void SetEnterpriseFolderGeneralSettingsAsync(int itemId, SystemFile folder, bool directoyBrowsingEnabled, int quota, QuotaType quotaType) {
this.SetEnterpriseFolderGeneralSettingsAsync(itemId, folder, directoyBrowsingEnabled, quota, quotaType, null);
}
/// <remarks/>
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));
}
}
/// <remarks/>
[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});
}
/// <remarks/>
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);
}
/// <remarks/>
public void EndSetEnterpriseFolderPermissionSettings(System.IAsyncResult asyncResult) {
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void SetEnterpriseFolderPermissionSettingsAsync(int itemId, SystemFile folder, ESPermission[] permissions) {
this.SetEnterpriseFolderPermissionSettingsAsync(itemId, folder, permissions, null);
}
/// <remarks/>
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));
}
}
/// <remarks/>
[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]));
}
/// <remarks/>
public System.IAsyncResult BeginGetFolderOwaAccounts(int itemId, SystemFile folder, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetFolderOwaAccounts", new object[] {
itemId,
folder}, callback, asyncState);
}
/// <remarks/>
public OrganizationUser[] EndGetFolderOwaAccounts(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((OrganizationUser[])(results[0]));
}
/// <remarks/>
public void GetFolderOwaAccountsAsync(int itemId, SystemFile folder) {
this.GetFolderOwaAccountsAsync(itemId, folder, null);
}
/// <remarks/>
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));
}
}
/// <remarks/>
[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});
}
/// <remarks/>
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);
}
/// <remarks/>
public void EndSetFolderOwaAccounts(System.IAsyncResult asyncResult) {
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void SetFolderOwaAccountsAsync(int itemId, SystemFile folder, OrganizationUser[] users) {
this.SetFolderOwaAccountsAsync(itemId, folder, users, null);
}
/// <remarks/>
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));
}
}
/// <remarks/>
[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]));
}
/// <remarks/>
public System.IAsyncResult BeginGetUserEnterpriseFolderWithOwaEditPermission(int itemId, int[] accountIds, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetUserEnterpriseFolderWithOwaEditPermission", new object[] {
itemId,
accountIds}, callback, asyncState);
}
/// <remarks/>
public string[] EndGetUserEnterpriseFolderWithOwaEditPermission(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((string[])(results[0]));
}
/// <remarks/>
public void GetUserEnterpriseFolderWithOwaEditPermissionAsync(int itemId, int[] accountIds) {
this.GetUserEnterpriseFolderWithOwaEditPermissionAsync(itemId, accountIds, null);
}
/// <remarks/>
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));
}
}
/// <remarks/>
[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);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void SetEnterpriseFolderGeneralSettingsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void SetEnterpriseFolderPermissionSettingsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetFolderOwaAccountsCompletedEventHandler(object sender, GetFolderOwaAccountsCompletedEventArgs e);
/// <remarks/>
[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;
}
/// <remarks/>
public OrganizationUser[] Result {
get {
this.RaiseExceptionIfNecessary();
return ((OrganizationUser[])(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void SetFolderOwaAccountsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetUserEnterpriseFolderWithOwaEditPermissionCompletedEventHandler(object sender, GetUserEnterpriseFolderWithOwaEditPermissionCompletedEventArgs e);
/// <remarks/>
[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;
}
/// <remarks/>
public string[] Result {
get {
this.RaiseExceptionIfNecessary();
return ((string[])(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetStatisticsCompletedEventHandler(object sender, GetStatisticsCompletedEventArgs e);

View file

@ -120,6 +120,12 @@ namespace WebsitePanel.EnterpriseServer {
private System.Threading.SendOrPostCallback InstallSessionHostsCertificateOperationCompleted;
private System.Threading.SendOrPostCallback GetRdsCertificateByServiceIdOperationCompleted;
private System.Threading.SendOrPostCallback GetRdsCertificateByItemIdOperationCompleted;
private System.Threading.SendOrPostCallback AddRdsCertificateOperationCompleted;
/// <remarks/>
public esRemoteDesktopServices() {
this.Url = "http://localhost:9002/esRemoteDesktopServices.asmx";
@ -260,6 +266,15 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/>
public event InstallSessionHostsCertificateCompletedEventHandler InstallSessionHostsCertificateCompleted;
/// <remarks/>
public event GetRdsCertificateByServiceIdCompletedEventHandler GetRdsCertificateByServiceIdCompleted;
/// <remarks/>
public event GetRdsCertificateByItemIdCompletedEventHandler GetRdsCertificateByItemIdCompleted;
/// <remarks/>
public event AddRdsCertificateCompletedEventHandler AddRdsCertificateCompleted;
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsCollection", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public RdsCollection GetRdsCollection(int collectionId) {
@ -2245,20 +2260,16 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/>
[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]));
}
/// <remarks/>
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);
}
/// <remarks/>
@ -2268,19 +2279,17 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
public void InstallSessionHostsCertificateAsync(int collectionId, byte[] certificate, string password) {
this.InstallSessionHostsCertificateAsync(collectionId, certificate, password, null);
public void InstallSessionHostsCertificateAsync(RdsServer rdsServer) {
this.InstallSessionHostsCertificateAsync(rdsServer, null);
}
/// <remarks/>
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 +2299,129 @@ namespace WebsitePanel.EnterpriseServer {
}
}
/// <remarks/>
[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]));
}
/// <remarks/>
public System.IAsyncResult BeginGetRdsCertificateByServiceId(int serviceId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetRdsCertificateByServiceId", new object[] {
serviceId}, callback, asyncState);
}
/// <remarks/>
public RdsCertificate EndGetRdsCertificateByServiceId(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((RdsCertificate)(results[0]));
}
/// <remarks/>
public void GetRdsCertificateByServiceIdAsync(int serviceId) {
this.GetRdsCertificateByServiceIdAsync(serviceId, null);
}
/// <remarks/>
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));
}
}
/// <remarks/>
[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(int itemId) {
object[] results = this.Invoke("GetRdsCertificateByItemId", new object[] {
itemId});
return ((RdsCertificate)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetRdsCertificateByItemId(int itemId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetRdsCertificateByItemId", new object[] {
itemId}, callback, asyncState);
}
/// <remarks/>
public RdsCertificate EndGetRdsCertificateByItemId(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((RdsCertificate)(results[0]));
}
/// <remarks/>
public void GetRdsCertificateByItemIdAsync(int itemId) {
this.GetRdsCertificateByItemIdAsync(itemId, null);
}
/// <remarks/>
public void GetRdsCertificateByItemIdAsync(int 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));
}
}
/// <remarks/>
[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]));
}
/// <remarks/>
public System.IAsyncResult BeginAddRdsCertificate(RdsCertificate certificate, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("AddRdsCertificate", new object[] {
certificate}, callback, asyncState);
}
/// <remarks/>
public ResultObject EndAddRdsCertificate(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((ResultObject)(results[0]));
}
/// <remarks/>
public void AddRdsCertificateAsync(RdsCertificate certificate) {
this.AddRdsCertificateAsync(certificate, null);
}
/// <remarks/>
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));
}
}
/// <remarks/>
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
@ -3465,4 +3597,82 @@ namespace WebsitePanel.EnterpriseServer {
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetRdsCertificateByServiceIdCompletedEventHandler(object sender, GetRdsCertificateByServiceIdCompletedEventArgs e);
/// <remarks/>
[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;
}
/// <remarks/>
public RdsCertificate Result {
get {
this.RaiseExceptionIfNecessary();
return ((RdsCertificate)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetRdsCertificateByItemIdCompletedEventHandler(object sender, GetRdsCertificateByItemIdCompletedEventArgs e);
/// <remarks/>
[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;
}
/// <remarks/>
public RdsCertificate Result {
get {
this.RaiseExceptionIfNecessary();
return ((RdsCertificate)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void AddRdsCertificateCompletedEventHandler(object sender, AddRdsCertificateCompletedEventArgs e);
/// <remarks/>
[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;
}
/// <remarks/>
public ResultObject Result {
get {
this.RaiseExceptionIfNecessary();
return ((ResultObject)(this.results[0]));
}
}
}
}

View file

@ -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(

View file

@ -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;
}

View file

@ -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<OrganizationUser>(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<string> GetUserEnterpriseFolderWithOwaEditPermission(int itemId, List<int> accountIds)
{
try
{
var result = new List<string>();
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)

View file

@ -278,19 +278,33 @@ 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);
}
private static ResultObject InstallSessionHostsCertificateInternal(RdsServer rdsServer)
{
var result = TaskManager.StartResultTask<ResultObject>("REMOTE_DESKTOP_SERVICES", "INSTALL_CERTIFICATE");
try
{
var collection = ObjectUtils.FillObjectFromDataReader<RdsCollection>(DataProvider.GetRDSCollectionById(collectionId));
Organization org = OrganizationController.GetOrganization(collection.ItemId);
Organization org = OrganizationController.GetOrganization(rdsServer.ItemId.Value);
if (org == null)
{
@ -299,10 +313,17 @@ namespace WebsitePanel.EnterpriseServer
return result;
}
var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId));
var servers = ObjectUtils.CreateListFromDataReader<RdsServer>(DataProvider.GetRDSServersByCollectionId(collection.Id)).ToList();
int serviceId = GetRemoteDesktopServiceID(org.PackageId);
var rds = GetRemoteDesktopServices(serviceId);
var certificate = GetRdsCertificateByServiceIdInternal(serviceId);
rds.InstallCertificate(certificate, password, servers.Select(s => s.FqdName).ToArray());
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);
rds.InstallCertificate(content, password, new string[] {rdsServer.FqdName});
}
catch (Exception ex)
{
@ -323,6 +344,64 @@ namespace WebsitePanel.EnterpriseServer
return result;
}
private static RdsCertificate GetRdsCertificateByServiceIdInternal(int serviceId)
{
var result = ObjectUtils.FillObjectFromDataReader<RdsCertificate>(DataProvider.GetRdsCertificateByServiceId(serviceId));
return result;
}
private static RdsCertificate GetRdsCertificateByItemIdInternal(int itemId)
{
Organization org = OrganizationController.GetOrganization(itemId);
if (org == null)
{
return null;
}
int serviceId = GetRemoteDesktopServiceID(org.PackageId);
var result = ObjectUtils.FillObjectFromDataReader<RdsCertificate>(DataProvider.GetRdsCertificateByServiceId(serviceId));
return result;
}
private static ResultObject AddRdsCertificateInternal(RdsCertificate certificate)
{
var result = TaskManager.StartResultTask<ResultObject>("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<RdsCollection>(DataProvider.GetRDSCollectionById(collectionId));
@ -370,9 +449,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 +473,7 @@ namespace WebsitePanel.EnterpriseServer
var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId));
var servers = ObjectUtils.CreateListFromDataReader<RdsServer>(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,6 +499,8 @@ namespace WebsitePanel.EnterpriseServer
var collection = ObjectUtils.FillObjectFromDataReader<RdsCollection>(DataProvider.GetRDSCollectionById(collectionId));
var settings = ObjectUtils.FillObjectFromDataReader<RdsCollectionSettings>(DataProvider.GetRdsCollectionSettingsByCollectionId(collectionId));
if (settings != null)
{
if (settings.SecurityLayer == null)
{
settings.SecurityLayer = SecurityLayerValues.Negotiate.ToString();
@ -434,6 +515,7 @@ namespace WebsitePanel.EnterpriseServer
{
settings.AuthenticateUsingNLA = true;
}
}
return settings;
}
@ -453,9 +535,23 @@ namespace WebsitePanel.EnterpriseServer
private static int AddRdsCollectionInternal(int itemId, RdsCollection collection)
{
var result = TaskManager.StartResultTask<ResultObject>("REMOTE_DESKTOP_SERVICES", "ADD_RDS_COLLECTION");
var domainName = IPGlobalProperties.GetIPGlobalProperties().DomainName;
try
{
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 (!CheckRDSServerAvaliable(server.FqdName))
{
throw TaskManager.WriteError(new Exception(string.Format("Unable to connect to {0} server.", server.FqdName)));
}
}
// load organization
Organization org = OrganizationController.GetOrganization(itemId);
if (org == null)
@ -936,24 +1032,21 @@ namespace WebsitePanel.EnterpriseServer
try
{
if (CheckRDSServerAvaliable(rdsServer.FqdName))
{
var domainName = IPGlobalProperties.GetIPGlobalProperties().DomainName;
if (rdsServer.FqdName.EndsWith(domainName, StringComparison.CurrentCultureIgnoreCase))
{
rdsServer.Id = DataProvider.AddRDSServer(rdsServer.Name, rdsServer.FqdName, rdsServer.Description);
}
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("Fully Qualified Domain Name not valid."));
}
}
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);
throw TaskManager.WriteError(new Exception(string.Format("Unable to connect to {0} server. Please double check Server Full Name setting and retry.", rdsServer.FqdName)));
}
}
finally
@ -1684,7 +1777,6 @@ namespace WebsitePanel.EnterpriseServer
return result;
}
private static ResultObject DeleteRemoteDesktopServiceInternal(int itemId)
{
var result = TaskManager.StartResultTask<ResultObject>("REMOTE_DESKTOP_SERVICES", "CLEANUP");

View file

@ -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<string> GetUserEnterpriseFolderWithOwaEditPermission(int itemId, List<int> accountIds)
{
return EnterpriseStorageController.GetUserEnterpriseFolderWithOwaEditPermission(itemId, accountIds);
}
#endregion
#region Statistics

View file

@ -327,9 +327,27 @@ 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);
}
}
}

View file

@ -145,6 +145,7 @@ namespace WebsitePanel.Providers.OS
}
public string RelativeUrl { get; set; }
public string Summary { get; set; }
public string DriveLetter
{

View file

@ -74,8 +74,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
string GetRdsServerStatus(string serverName);
void ShutDownRdsServer(string serverName);
void RestartRdsServer(string serverName);
void SaveRdsCollectionLocalAdmins(List<OrganizationUser> users, List<string> hosts);
List<string> GetRdsCollectionLocalAdmins(string hostName);
void SaveRdsCollectionLocalAdmins(List<string> users, List<string> hosts, string collectionName, string organizationId);
List<string> GetRdsCollectionLocalAdmins(string organizationId, string collectionName);
void MoveRdsServerToTenantOU(string hostName, string organizationId);
void RemoveRdsServerFromTenantOU(string hostName, string organizationId);
void InstallCertificate(byte[] certificate, string password, List<string> hostNames);

View file

@ -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; }
}
}

View file

@ -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; }
}
}

View file

@ -26,6 +26,7 @@
// (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

View file

@ -129,6 +129,7 @@
<Compile Include="OS\QuotaType.cs" />
<Compile Include="OS\SystemFilesPaged.cs" />
<Compile Include="RemoteDesktopServices\IRemoteDesktopServices.cs" />
<Compile Include="RemoteDesktopServices\RdsCertificate.cs" />
<Compile Include="RemoteDesktopServices\RdsCollection.cs" />
<Compile Include="RemoteDesktopServices\RdsCollectionPaged.cs" />
<Compile Include="RemoteDesktopServices\RdsCollectionSettings.cs" />

View file

@ -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<string>().ToList() : null;
var itemType = reader[5] as string ?? string.Empty;
@ -342,6 +342,8 @@ namespace WebsitePanel.Providers.EnterpriseStorage
}
}
file.Summary = reader[6] as string;
result.Add(file);
}
}

View file

@ -64,15 +64,16 @@ 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 RDSHelpDeskGroup = "WSP-HelpDeskAdministrators";
private const string RDSHelpDeskGroupDescription = "WSP Help Desk Administrators";
private const string LocalAdministratorsGroupName = "Administrators";
#endregion
@ -311,6 +312,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
}
CheckOrCreateHelpDeskComputerGroup();
string helpDeskGroupSamAccountName = CheckOrCreateAdGroup(GetHelpDeskGroupPath(RDSHelpDeskGroup), GetRootOUPath(), RDSHelpDeskGroup, RDSHelpDeskGroupDescription);
if (!ActiveDirectoryUtils.AdObjectExists(GetUsersGroupPath(organizationId, collection.Name)))
{
@ -342,12 +344,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
//add session servers to group
foreach (var rdsServer in collection.Servers)
{
if (!CheckLocalAdminsGroupExists(rdsServer.FqdName, runSpace))
{
CreateLocalAdministratorsGroup(rdsServer.FqdName, runSpace);
}
AddHelpDeskAdminsGroupToLocalAdmins(runSpace, rdsServer.FqdName);
AddAdGroupToLocalAdmins(runSpace, rdsServer.FqdName, helpDeskGroupSamAccountName);
AddComputerToCollectionAdComputerGroup(organizationId, collection.Name, rdsServer);
}
}
@ -513,11 +510,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(GetGroupPath(organizationId, collectionName, GetLocalAdminsGroupName(collectionName)));
}
catch (Exception e)
{
@ -531,18 +530,15 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
return result;
}
public List<string> GetCollectionUsers(string collectionName)
{
return GetUsersToCollectionAdGroup(collectionName);
}
public bool SetUsersInCollection(string organizationId, string collectionName, List<string> users)
{
var result = true;
try
{
SetUsersToCollectionAdGroup(collectionName, organizationId, users);
var usersGroupName = GetUsersGroupName(collectionName);
var usersGroupPath = GetUsersGroupPath(organizationId, collectionName);
SetUsersToCollectionAdGroup(collectionName, organizationId, users, usersGroupName, usersGroupPath);
}
catch (Exception e)
{
@ -574,18 +570,10 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
ExecuteShellCommand(runSpace, cmd, false);
CheckOrCreateHelpDeskComputerGroup();
string helpDeskGroupSamAccountName = CheckOrCreateAdGroup(GetHelpDeskGroupPath(RDSHelpDeskGroup), GetRootOUPath(), RDSHelpDeskGroup, RDSHelpDeskGroupDescription);
if (!CheckLocalAdminsGroupExists(server.FqdName, runSpace))
{
CreateLocalAdministratorsGroup(server.FqdName, runSpace);
}
AddHelpDeskAdminsGroupToLocalAdmins(runSpace, server.FqdName);
AddAdGroupToLocalAdmins(runSpace, server.FqdName, helpDeskGroupSamAccountName);
AddComputerToCollectionAdComputerGroup(organizationId, collectionName, server);
}
catch (Exception e)
{
}
finally
{
@ -616,6 +604,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
ExecuteShellCommand(runSpace, cmd, false);
RemoveGroupFromLocalAdmin(server.FqdName, server.Name, GetLocalAdminsGroupName(collectionName), runSpace);
RemoveComputerFromCollectionAdComputerGroup(organizationId, collectionName, server);
}
finally
@ -978,7 +967,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
#region Local Admins
public void SaveRdsCollectionLocalAdmins(List<OrganizationUser> users, List<string> hosts)
public void SaveRdsCollectionLocalAdmins(List<string> users, List<string> hosts, string collectionName, string organizationId)
{
Runspace runspace = null;
@ -987,6 +976,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)
{
@ -995,33 +988,10 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
foreach (var hostName in hosts)
{
if (!CheckLocalAdminsGroupExists(hostName, runspace))
{
var errors = CreateLocalAdministratorsGroup(hostName, runspace);
AddAdGroupToLocalAdmins(runspace, hostName, helpDeskGroupSamAccountName);
AddAdGroupToLocalAdmins(runspace, hostName, localAdminsGroupSamAccountName);
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));
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 +1000,23 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
}
}
public List<string> GetRdsCollectionLocalAdmins(string hostName)
public List<string> GetRdsCollectionLocalAdmins(string organizationId, string collectionName)
{
Runspace runspace = null;
var result = new List<string>();
try
{
runspace = OpenRunspace();
if (CheckLocalAdminsGroupExists(hostName, runspace))
{
result = GetExistingLocalAdmins(hostName, runspace);
}
}
finally
{
CloseRunspace(runspace);
string groupName = GetLocalAdminsGroupName(collectionName);
return GetUsersToCollectionAdGroup(collectionName, groupName, organizationId);
}
return result;
}
private bool CheckLocalAdminsGroupExists(string hostName, Runspace runspace)
private void RemoveGroupFromLocalAdmin(string fqdnName, string hostName, string groupName, Runspace runspace)
{
var scripts = new List<string>
{
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>
{
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>
{
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<string> GetExistingLocalAdmins(string hostName, Runspace runspace)
{
var result = new List<string>();
var scripts = new List<string>
{
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>
{
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>
{
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 +1044,22 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
}
}
private void AddHelpDeskAdminsGroupToLocalAdmins(Runspace runspace, string hostName)
private string CheckOrCreateAdGroup(string groupPath, string rootPath, string groupName, string description)
{
var helpDeskAdminsGroupPath = GetHelpDeskGroupPath(RDSHelpDeskGroup);
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 +1067,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>
{
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)
};
@ -1355,21 +1224,17 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
return false;
}
private void SetUsersToCollectionAdGroup(string collectionName, string organizationId, IEnumerable<string> users)
private void SetUsersToCollectionAdGroup(string collectionName, string organizationId, IEnumerable<string> users, string groupName, string groupPath)
{
var usersGroupName = GetUsersGroupName(collectionName);
var usersGroupPath = GetUsersGroupPath(organizationId, collectionName);
var orgPath = GetOrganizationPath(organizationId);
var orgEntry = ActiveDirectoryUtils.GetADObject(orgPath);
var groupUsers = ActiveDirectoryUtils.GetGroupObjects(usersGroupName, "user", orgEntry);
var groupUsers = ActiveDirectoryUtils.GetGroupObjects(groupName, "user", orgEntry);
//remove all users from group
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);
@ -1378,19 +1243,18 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
{
var userObject = ActiveDirectoryUtils.GetADObject(userPath);
var samName = (string)ActiveDirectoryUtils.GetADObjectProperty(userObject, "sAMAccountName");
var userGroupsPath = GetUsersGroupPath(organizationId, collectionName);
ActiveDirectoryUtils.AddObjectToGroup(userPath, userGroupsPath);
ActiveDirectoryUtils.AddObjectToGroup(userPath, groupPath);
}
}
}
private List<string> GetUsersToCollectionAdGroup(string collectionName)
private List<string> GetUsersToCollectionAdGroup(string collectionName, string groupName, string organizationId)
{
var users = new List<string>();
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");
@ -1480,6 +1344,16 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
runSpace = OpenRunspace();
var feature = AddFeature(runSpace, hostName, "RDS-RD-Server", true, true);
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
{
@ -1738,6 +1612,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 +1645,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();

View file

@ -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<X509Extension>()
.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);

View file

@ -18,7 +18,6 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
using System.Web.Services.Protocols;
using System;
using System.Diagnostics;
using WebsitePanel.Providers.HostedSolution;
/// <remarks/>
@ -1515,17 +1514,21 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
/// <remarks/>
[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});
}
/// <remarks/>
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);
}
/// <remarks/>
@ -1534,18 +1537,20 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
}
/// <remarks/>
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);
}
/// <remarks/>
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 +1563,18 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
/// <remarks/>
[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]));
}
/// <remarks/>
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);
}
/// <remarks/>
@ -1577,17 +1584,18 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
}
/// <remarks/>
public void GetRdsCollectionLocalAdminsAsync(string hostName) {
this.GetRdsCollectionLocalAdminsAsync(hostName, null);
public void GetRdsCollectionLocalAdminsAsync(string organizationId, string collectionName) {
this.GetRdsCollectionLocalAdminsAsync(organizationId, collectionName, null);
}
/// <remarks/>
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) {

View file

@ -566,12 +566,12 @@ namespace WebsitePanel.Server
}
[WebMethod, SoapHeader("settings")]
public void SaveRdsCollectionLocalAdmins(List<OrganizationUser> users, List<string> hosts)
public void SaveRdsCollectionLocalAdmins(List<string> users, List<string> 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<string> GetRdsCollectionLocalAdmins(string hostName)
public List<string> 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;

View file

@ -5,17 +5,6 @@
<section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3"/>
<section name="websitepanel.server" type="WebsitePanel.Server.ServerConfiguration, WebsitePanel.Server"/>
<section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings,Microsoft.Practices.EnterpriseLibrary.Caching"/>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
</sectionGroup>
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
</sectionGroup>
</sectionGroup>
</configSections>
<appSettings>
<add key="WebsitePanel.HyperV.UseDiskPartClearReadOnlyFlag" value="false"/>

View file

@ -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

View file

@ -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

View file

@ -3,7 +3,7 @@ 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)
{

View file

@ -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)

View file

@ -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();

View file

@ -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; }
/// <summary>
/// Downloads content of the resource to a file specified by filename
/// </summary>

View file

@ -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);
}
}

View file

@ -51,8 +51,8 @@ namespace WebsitePanel.WebDav.Core.Managers
{
Href = new Uri(x.Url),
ItemType = ItemType.Folder,
ContentLength = x.Size,
AllocatedSpace = x.FRSMQuotaMB,
ContentLength = x.Size * 1024 * 1024,
AllocatedSpace = 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);
@ -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('/');

View file

@ -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
{

View file

@ -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
}
}

View file

@ -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<string> GetOwaFoldersWithEditPermission(WspPrincipal principal)
{
var folders = HttpContext.Current.Session != null ? HttpContext.Current.Session[WebDavAppConfigManager.Instance.SessionKeys.OwaEditFoldersSessionKey] as IEnumerable<string> : null;
if (folders != null)
{
return folders;
}
var accountsIds = new List<int>();
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<string>();
}
if (HttpContext.Current.Session != null)
{
HttpContext.Current.Session[WebDavAppConfigManager.Instance.SessionKeys.OwaEditFoldersSessionKey] = folders;
}
return folders;
}
}
}

View file

@ -46,6 +46,18 @@ namespace WebsitePanel.WebDavPortal
#region Enterprise storage
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}",

View file

@ -21,5 +21,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";
}
}

View file

@ -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,11 @@ tr.selected-file {
height: 32px;
}
#summary.summary {
font-size: 11px;
color: rgb(152, 152, 152);
}
.drag-and-drop-area input {
/* IE 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
@ -252,16 +270,29 @@ tr.selected-file {
width: 200px;
}
.search-block {
float: right;
.breadcrumb-wsp {
display: inline-block;
padding-top: 5px;
}
.search-block input, .search-block label {
.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 +326,16 @@ tr.selected-file {
display: block;
}
.column-name {
position: relative;
}
.column-name #quota {
position: absolute;
right: 0px;
top: 20%;
}
/* Theme Mods */
input,div{border-radius:0px!important;}
@ -362,3 +403,9 @@ div#breadcrumb_wrapper a:last-child {
float: none;
display: inline-block;
}
@media (min-width: 768px) {
.navbar-right {
margin-right: 0;
}
}

View file

@ -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<WebDavResource>();
}
else
{
folderItems = _webdavManager.OpenFolder(pathPart).Select(x=>new WebDavResource(null, x));
folderItems = _webdavManager.OpenFolder(pathPart).Cast<WebDavResource>();
}
var tableItems = Mapper.Map<IEnumerable<WebDavResource>, IEnumerable<ResourceTableItemModel>>(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)
{
@ -318,7 +336,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);
}
@ -329,17 +347,17 @@ namespace WebsitePanel.WebDavPortal.Controllers
}
#endregion
private void FillContentModel(IEnumerable<ResourceTableItemModel> items)
private void FillContentModel(IEnumerable<ResourceTableItemModel> items, string organizationId)
{
foreach (var item in items)
{
var opener = _openerManager[Path.GetExtension(item.DisplayName)];
var pathPart = item.Href.AbsolutePath.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 +368,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;

View file

@ -45,7 +45,10 @@ namespace WebsitePanel.WebDavPortal.Mapping.Profiles.Webdav
.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.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));
}
}

View file

@ -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]
{

View file

@ -150,6 +150,15 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to File.
/// </summary>
public static string File {
get {
return ResourceManager.GetString("File", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to File Upload.
/// </summary>
@ -168,6 +177,15 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Info.
/// </summary>
public static string Info {
get {
return ResourceManager.GetString("Info", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} items was removed..
/// </summary>
@ -258,6 +276,24 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Search Documents.
/// </summary>
public static string SearchDocuments {
get {
return ResourceManager.GetString("SearchDocuments", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Search Results.
/// </summary>
public static string SearchResults {
get {
return ResourceManager.GetString("SearchResults", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Select files to upload.
/// </summary>

View file

@ -147,12 +147,18 @@
<data name="Error" xml:space="preserve">
<value>Error</value>
</data>
<data name="File" xml:space="preserve">
<value>File</value>
</data>
<data name="FileUpload" xml:space="preserve">
<value>File Upload</value>
</data>
<data name="GigabyteShort" xml:space="preserve">
<value>Gb</value>
</data>
<data name="Info" xml:space="preserve">
<value>Info</value>
</data>
<data name="ItemsWasRemovedFormat" xml:space="preserve">
<value>{0} items was removed.</value>
</data>
@ -183,6 +189,12 @@
<data name="Search" xml:space="preserve">
<value>Search</value>
</data>
<data name="SearchDocuments" xml:space="preserve">
<value>Search Documents</value>
</data>
<data name="SearchResults" xml:space="preserve">
<value>Search Results</value>
</data>
<data name="SelectFilesToUpload" xml:space="preserve">
<value>Select files to upload</value>
</data>

View file

@ -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);
}

View file

@ -1,6 +1,12 @@
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",
textDateModified: "Date modified",
textSize: "Size"
};
this.itemsTable = null;
this.searchTable = null;
}
WspFileBrowser.prototype = {
@ -34,7 +40,8 @@ WspFileBrowser.prototype = {
}).get();
},
deleteSelectedItems: function(e) {
deleteSelectedItems: function (e) {
$.ajax({
type: 'POST',
url: wsp.fileBrowser.settings.deletionUrl,
@ -45,7 +52,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 +60,7 @@ WspFileBrowser.prototype = {
wsp.messages.addErrorMessage(errorThrown);
wsp.fileBrowser.refreshDeletionBlock();
wsp.fileBrowser.refreshDataTable();
wsp.fileBrowser.refreshDataTable(wsp.fileBrowser.itemsTable);
wsp.dialogs.hideProcessDialog();
}
@ -79,17 +86,19 @@ WspFileBrowser.prototype = {
},
initDataTable: function (tableId, ajaxUrl) {
this.table = $(tableId).dataTable({
this.itemsTable = $(tableId).dataTable({
"ajax": ajaxUrl,
"processing": false,
"serverSide": true,
"dom": 'rtlp',
"columnDefs": [
{
"render": function(data, type, row) {
return '<img class="table-icon" src="' + row.IconHref + '"/>' +
'<a href="' + row.Url + '" ' + (row.IsTargetBlank ? 'target="_blank"' : '') + ' class="file-link ' + (row.IsFolder ? 'processing-dialog':'') + '" title="' + row.DisplayName + '">' +
return '<div class="column-name"><img class="table-icon" src="' + row.IconHref + '"/>' +
'<a href="' + row.Url + '" ' + (row.IsTargetBlank ? 'target="_blank"' : '') + ' class="file-link" title="' + row.DisplayName + '">' +
row.DisplayName +
'</a>';
'</a>' + (row.IsRoot ? '<span id="quota">' + wsp.fileBrowser.bytesToSize(row.Size) + ' / ' + wsp.fileBrowser.bytesToSize(row.Quota) + '</span>' : '')
+'</div>';
},
"targets": 0
},
@ -127,18 +136,87 @@ WspFileBrowser.prototype = {
$(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": false,
"serverSide": true,
"oSearch": { "sSearch": initSearch },
"dom": 'rtlp',
"columnDefs": [
{
"render": function (data, type, row) {
return '<div class="column-name">' +
'<img class="table-icon search" src="' + row.IconHref + '"/>' +
'<div class="file-info">' +
'<a href="' + row.Url + '" ' + (row.IsTargetBlank ? 'target="_blank"' : '') + ' class="file-link" title="' + row.DisplayName + '">' +
row.DisplayName +
'</a>' +
'<div id="summary" class="summary">' + (row.Summary ? (row.Summary + '').substring(0, 500) + '...' : '') + '</div>' +
'<div>' +
'<a href="' + row.FolderUrlLocalString + '" ' + 'target="_blank" class="file-link" >' +
row.FolderUrlAbsoluteString +
'</a>' +
'</div>' +
'</div>' +
'</div>';
},
"targets": 0
},
{
"render": function (data, type, row) {
return '<div>' +settings.textDateModified+': '+ row.LastModifiedFormated+ '</div>' +
'<div>' + settings.textSize + ': ' + classThis.bytesToSize(row.Size) + '</div>';
},
"orderable": false,
"width": "25%",
"targets": 1
}
],
"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();
}
});
$(tableId).removeClass('dataTable');
},
refreshDataTable: function (table) {
if (table != null) {
table.fnDraw(false);
}
},
@ -186,6 +264,14 @@ 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];
}
};

View file

@ -53,9 +53,3 @@ else
</script>
}
}
@section popups
{
@Html.Partial("_ProcessDialog", null)
@Html.Partial("_ConfirmDialog")
}

View file

@ -0,0 +1,28 @@
@using WebsitePanel.WebDavPortal.Resources
@using WebsitePanel.WebDavPortal.UI.Routes
@model WebsitePanel.WebDavPortal.Models.ModelForWebDav
@Html.Partial("_ShowContentTopMenu", Model)
<div class="prevent-deselect container">
<table id="search-items-table" class="display table table-striped table-bordered noselect" cellspacing="0" width="100%">
<thead>
<tr>
<th>@UI.File</th>
<th>@UI.Details</th>
</tr>
</thead>
</table>
</div>
@section scripts
{
<script>
$(document).ready(function() {
wsp.fileBrowser.setSettings({ deletionUrl: "@Url.RouteUrl(FileSystemRouteNames.DeleteFiles)" });
wsp.fileBrowser.initSearchDataTable('#search-items-table', '@Url.RouteUrl(FileSystemRouteNames.ShowContentDetails)', '@Model.SearchValue');
});
</script>
}

View file

@ -3,21 +3,6 @@
@using WebsitePanel.WebDavPortal.UI.Routes
@model WebsitePanel.WebDavPortal.Models.ModelForWebDav
<div class="container">
<div class="search-block navbar-right">
<div>
@using (Html.BeginRouteForm(FileSystemRouteNames.ShowContentPath))
{
<label>
@UI.Search:
</label>
@Html.TextBoxFor(x => x.SearchValue, new { @class = "form-control input-sm"})
}
</div>
</div>
</div>
<div class="container">

View file

@ -15,8 +15,3 @@
</table>
</div>
@section popups
{
@Html.Partial("_ProcessDialog", null)
@Html.Partial("_ConfirmDialog")
}

View file

@ -10,16 +10,43 @@
@if (Model != null)
{
string header = WspContext.User.OrganizationId;
string[] elements = string.IsNullOrEmpty(Model.UrlSuffix)? new string[0]: Model.UrlSuffix.Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
<div class="breadcrumb-wsp">
@if (String.IsNullOrEmpty(Model.SearchValue))
{
<a href="/@header/" class="processing-dialog">@header</a>
string[] elements = Model.UrlSuffix.Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < elements.Length; i++)
{
<span style="top: 2px;"> / </span>
<a href="@string.Concat("/" + header + "/", string.Join("/", elements.Take(i + 1)))" class="processing-dialog">@elements[i]</a>
}
}
else
{
<a href="@Url.RouteUrl(FileSystemRouteNames.ShowContentPath)" class="processing-dialog">@UI.SearchResults</a>
}
</div>
<div class="search-block navbar-right">
<div>
@using (Html.BeginRouteForm(FileSystemRouteNames.SearchFiles, FormMethod.Post))
{
<div>
<label>
@UI.SearchDocuments:
</label>
@Html.TextBox("searchValue", Model.SearchValue, new { @class = "form-control input-sm" })
</div>
}
</div>
</div>
}
</div>
<div class="container file-actions-menu prevent-deselect">
@if (string.IsNullOrEmpty(Model.SearchValue))
{
<div class="container file-actions-menu prevent-deselect">
@if (Model.Permissions.HasFlag(WebDavPermissions.Write))
{
<div class="file-deletion navbar-left">
@ -36,8 +63,8 @@
{
<div class="btn-toolbar change-view-block" role="toolbar">
<div class="btn-group">
<a class="btn btn-default" title="@UI.Details" href="@Url.RouteUrl(FileSystemRouteNames.ChangeWebDavViewType, new { viewType = FolderViewTypes.BigIcons, org = WspContext.User.OrganizationId, pathPart = Model.UrlSuffix })"><span class="glyphicon glyphicon-th-large" aria-hidden="true"></span></a>
<a class="btn btn-default" title="@UI.Table" href="@Url.RouteUrl(FileSystemRouteNames.ChangeWebDavViewType, new { viewType = FolderViewTypes.Table, org = WspContext.User.OrganizationId, pathPart = Model.UrlSuffix })"><span class="glyphicon glyphicon-th-list" aria-hidden="true"></span></a>
<a class="btn btn-default" title="@UI.Details" href="@Url.RouteUrl(FileSystemRouteNames.ChangeWebDavViewType, new {viewType = FolderViewTypes.BigIcons, org = WspContext.User.OrganizationId, pathPart = Model.UrlSuffix})"><span class="glyphicon glyphicon-th-large" aria-hidden="true"></span></a>
<a class="btn btn-default" title="@UI.Table" href="@Url.RouteUrl(FileSystemRouteNames.ChangeWebDavViewType, new {viewType = FolderViewTypes.Table, org = WspContext.User.OrganizationId, pathPart = Model.UrlSuffix})"><span class="glyphicon glyphicon-th-list" aria-hidden="true"></span></a>
</div>
</div>
}
@ -47,5 +74,5 @@
<a id="upload-button" class="btn btn-success btn-sm active" href="@Url.RouteUrl(FileSystemRouteNames.UploadFile)" role="button">@UI.FileUpload</a>
}
</div>
</div>
</div>
}

View file

@ -47,6 +47,9 @@
</div>
<div class="prevent-deselect">
@Html.Partial("_ProcessDialog", null)
@Html.Partial("_ConfirmDialog")
@RenderSection("popups", required: false)
</div>
@ -62,8 +65,8 @@
@Scripts.Render("~/bundles/authScripts")
<script>
$(document).ready(function() {
StartAuthExpirationCheckTimer("@WebDavAppConfigManager.Instance.AuthTimeoutCookieName", "@Url.RouteUrl(AccountRouteNames.Logout)");
$(document).ready(function () {
StartAuthExpirationCheckTimer("@WebDavAppConfigManager.Instance.AuthTimeoutCookieName", "@FormsAuthentication.FormsCookieName", "@Url.RouteUrl(AccountRouteNames.Logout)");
});
</script>
}

View file

@ -52,6 +52,7 @@
<add key="ResourseRenderCountSessionKey" value="ResourseRenderCount" />
<add key="ItemIdSessionKey" value="ItemId" />
<add key="UserGroupsKey" value="UserGroups" />
<add key="OwaEditFoldersSession" value="OwaEditFolders"/>
</sessionKeys>
<fileIcons defaultPath="~/Content/Images/other-icon.png" folderPath="~/Content/Images/folder_100x100.png">
<add extension=".txt" path="~/Content/Images/txt-icon.png" />

View file

@ -459,6 +459,7 @@
<Content Include="Views\FileSystem\_ShowContentTopMenu.cshtml" />
<Content Include="Views\FileSystem\_ShowContentBigIcons.cshtml" />
<Content Include="Views\FileSystem\UploadFiles.cshtml" />
<Content Include="Views\FileSystem\ShowContentSearchResultTable.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="Models\FileSystem\Enums\" />

View file

@ -135,6 +135,7 @@
<Control key="enterprisestorage_folders" />
<Control key="create_enterprisestorage_folder" general_key="enterprisestorage_folders" />
<Control key="enterprisestorage_folder_settings" general_key="enterprisestorage_folders" />
<Control key="enterprisestorage_folder_settings_general" general_key="enterprisestorage_folders" />
<Control key="enterprisestorage_drive_maps" />
<Control key="create_enterprisestorage_drive_map" general_key="enterprisestorage_drive_maps" />

View file

@ -563,6 +563,9 @@
<Control key="enterprisestorage_folders" src="WebsitePanel/ExchangeServer/EnterpriseStorageFolders.ascx" title="Enterprise Storage Folders" type="View" />
<Control key="create_enterprisestorage_folder" src="WebsitePanel/ExchangeServer/EnterpriseStorageCreateFolder.ascx" title="Create New ES Folder" type="View" />
<Control key="enterprisestorage_folder_settings" src="WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx" title="Edit ES Folder" type="View" />
<Control key="enterprisestorage_folder_settings_folder_permissions" src="WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx" title="Edit ES Folder" type="View" />
<Control key="enterprisestorage_folder_settings_owa_editing" src="WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx" title="Edit ES Folder" type="View" />
<Control key="enterprisestorage_drive_maps" src="WebsitePanel/ExchangeServer/EnterpriseStorageDriveMaps.ascx" title="Enterprise Storage Drive Maps" type="View" />
<Control key="create_enterprisestorage_drive_map" src="WebsitePanel/ExchangeServer/EnterpriseStorageCreateDriveMap.ascx" title="Create New ES Drive Map" type="View" />

View file

@ -5656,6 +5656,12 @@
<data name="ERROR.RDSSESSIONHOST_CERTIFICATE_NOT_INSTALLED" xml:space="preserve">
<value>Session host certificate not installed</value>
</data>
<data name="ERROR.RDSSERVER_NOT_ADDED" xml:space="preserve">
<value>RDS Server not added</value>
</data>
<data name="Success.RDSSESSIONHOST_CERTIFICATE_INSTALLED" xml:space="preserve">
<value>Session host certificate has been installed</value>
</data>
<data name="ERROR.RDSCOLLECTIONSETTINGS_NOT_UPDATES" xml:space="preserve">
<value>RDS Collection settings not updated</value>
</data>

View file

@ -120,6 +120,9 @@
<data name="btnAddRDSServer.Text" xml:space="preserve">
<value>Add RDS Server</value>
</data>
<data name="gvPopupStatus.HeaderText" xml:space="preserve">
<value>Status</value>
</data>
<data name="gvRDSServers.Empty" xml:space="preserve">
<value>The list of RDS Servers is empty.&lt;br&gt;&lt;br&gt;To add a new Server click "Add RDS Sever" button.</value>
</data>

View file

@ -52,11 +52,16 @@ namespace WebsitePanel.Portal
{
rdsServers = ES.Services.RDS.GetRdsServersPaged("", filterValue, sortColumn, startRowIndex, maximumRows);
foreach (var rdsServer in rdsServers.Servers)
{
if (rdsServer.ItemId.HasValue)
{
rdsServer.Status = ES.Services.RDS.GetRdsServerStatus(rdsServer.ItemId.Value, rdsServer.FqdName);
rdsServer.SslAvailable = ES.Services.RDS.GetRdsCertificateByItemId(rdsServer.ItemId.Value) != null;
}
}
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" }};
}
public int GetOrganizationRdsServersPagedCount(int itemId, string filterValue)

View file

@ -168,4 +168,7 @@
<data name="rbtnQuotaSoft" xml:space="preserve">
<value>Soft</value>
</data>
<data name="colFolderGeneralSettings.Text" xml:space="preserve">
<value>General Settings</value>
</data>
</root>

View file

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="btnSave.OnClientClick" xml:space="preserve">
<value>ShowProgressDialog('Updating folder settings...');</value>
</data>
<data name="btnSave.Text" xml:space="preserve">
<value>Save Changes</value>
</data>
<data name="colFolderPermissions.Text" xml:space="preserve">
<value>Folder Permissions</value>
</data>
<data name="locPermissionsSection.Text" xml:space="preserve">
<value>Permissions</value>
</data>
<data name="locTitle.Text" xml:space="preserve">
<value>Edit Folder</value>
</data>
</root>

View file

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="btnSave.OnClientClick" xml:space="preserve">
<value>ShowProgressDialog('Updating folder settings...');</value>
</data>
<data name="btnSave.Text" xml:space="preserve">
<value>Save Changes</value>
</data>
<data name="colOwaEditing.Text" xml:space="preserve">
<value>Office Web App Editing</value>
</data>
<data name="locOwaEditingSection.Text" xml:space="preserve">
<value>Users And Groups</value>
</data>
<data name="locTitle.Text" xml:space="preserve">
<value>Edit Folder</value>
</data>
</root>

View file

@ -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" %>
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
@ -16,10 +19,17 @@
<asp:Image ID="Image1" SkinID="ExchangeList48" runat="server" />
<asp:Localize ID="locTitle" runat="server" meta:resourcekey="locTitle" Text="Edit Folder"></asp:Localize>
<asp:Literal ID="litFolderName" runat="server" Text="Folder" />
<asp:Literal ID="litFolderName" runat="server" Text="Folder 32" />
</div>
<div class="FormBody">
<wsp:CollectionTabs id="tabs" runat="server" SelectedTab="enterprisestorage_folder_settings" />
<wsp:SimpleMessageBox id="messageBox" runat="server" />
<wsp:CollapsiblePanel id="colFolderGeneralSettings" runat="server"
TargetControlID="panelFolderGeneralSettings" meta:resourcekey="colFolderGeneralSettings" Text="">
</wsp:CollapsiblePanel>
<asp:Panel runat="server" ID="panelFolderGeneralSettings">
<table>
<tr>
<td class="FormLabel150"><asp:Localize ID="locFolderName" runat="server" meta:resourcekey="locFolderName" Text="Folder Name:"></asp:Localize></td>
@ -60,17 +70,10 @@
<asp:CheckBox id="chkDirectoryBrowsing" runat="server"></asp:CheckBox>
</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td colspan="2">
<fieldset id="PermissionsPanel" runat="server">
<legend><asp:Localize ID="PermissionsSection" runat="server" meta:resourcekey="locPermissionsSection" Text="Permissions"></asp:Localize></legend>
<wsp:ESPermissions id="permissions" runat="server" />
</fieldset>
</tr>
<tr><td>&nbsp;</td></tr>
</table>
</asp:Panel>
<div class="FormFooterClean">
<asp:Button id="btnSave" runat="server" Text="Save Changes" CssClass="Button1" meta:resourcekey="btnSave" ValidationGroup="EditFolder" OnClick="btnSave_Click"></asp:Button>

View file

@ -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);

View file

@ -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.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@ -76,6 +48,15 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litFolderName;
/// <summary>
/// tabs control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStorageEditFolderTabs tabs;
/// <summary>
/// messageBox control.
/// </summary>
@ -85,6 +66,24 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks>
protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox;
/// <summary>
/// colFolderGeneralSettings control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel colFolderGeneralSettings;
/// <summary>
/// panelFolderGeneralSettings control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel panelFolderGeneralSettings;
/// <summary>
/// locFolderName control.
/// </summary>
@ -211,33 +210,6 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkDirectoryBrowsing;
/// <summary>
/// PermissionsPanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl PermissionsPanel;
/// <summary>
/// PermissionsSection control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize PermissionsSection;
/// <summary>
/// permissions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStoragePermissions permissions;
/// <summary>
/// btnSave control.
/// </summary>

View file

@ -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" %>
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
<div id="ExchangeContainer">
<div class="Module">
<div class="Left">
</div>
<div class="Content">
<div class="Center">
<div class="Title">
<asp:Image ID="Image1" SkinID="ExchangeList48" runat="server" />
<asp:Localize ID="locTitle" runat="server" meta:resourcekey="locTitle" Text="Edit Folder"></asp:Localize>
<asp:Literal ID="litFolderName" runat="server" Text="Folder" />
</div>
<div class="FormBody">
<wsp:CollectionTabs id="tabs" runat="server" SelectedTab="enterprisestorage_folder_settings_folder_permissions" />
<wsp:SimpleMessageBox id="messageBox" runat="server" />
<wsp:CollapsiblePanel id="colFolderPermissions" runat="server"
TargetControlID="panelFolderPermissions" meta:resourcekey="colFolderPermissions" Text="">
</wsp:CollapsiblePanel>
<asp:Panel runat="server" ID="panelFolderPermissions">
<table>
<tr>
<td colspan="2">
<fieldset id="PermissionsPanel" runat="server">
<legend><asp:Localize ID="PermissionsSection" runat="server" meta:resourcekey="locPermissionsSection" Text="Permissions"></asp:Localize></legend>
<wsp:ESPermissions id="permissions" runat="server" />
</fieldset>
</tr>
<tr><td>&nbsp;</td></tr>
</table>
</asp:Panel>
<div class="FormFooterClean">
<asp:Button id="btnSave" runat="server" Text="Save Changes" CssClass="Button1" meta:resourcekey="btnSave" ValidationGroup="EditFolder" OnClick="btnSave_Click"></asp:Button>
<asp:ValidationSummary ID="valSummary" runat="server" ShowMessageBox="True" ShowSummary="False" ValidationGroup="EditFolder" />
</div>
</div>
</div>
</div>
</div>
</div>

View file

@ -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);
}
}
}
}

View file

@ -0,0 +1,132 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal.ExchangeServer {
public partial class EnterpriseStorageFolderSettingsFolderPermissions {
/// <summary>
/// asyncTasks control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks;
/// <summary>
/// Image1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Image Image1;
/// <summary>
/// locTitle control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locTitle;
/// <summary>
/// litFolderName control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litFolderName;
/// <summary>
/// tabs control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStorageEditFolderTabs tabs;
/// <summary>
/// messageBox control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox;
/// <summary>
/// colFolderPermissions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel colFolderPermissions;
/// <summary>
/// panelFolderPermissions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel panelFolderPermissions;
/// <summary>
/// PermissionsPanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl PermissionsPanel;
/// <summary>
/// PermissionsSection control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize PermissionsSection;
/// <summary>
/// permissions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStoragePermissions permissions;
/// <summary>
/// btnSave control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnSave;
/// <summary>
/// valSummary control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ValidationSummary valSummary;
}
}

View file

@ -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" %>
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
<div id="ExchangeContainer">
<div class="Module">
<div class="Left">
</div>
<div class="Content">
<div class="Center">
<div class="Title">
<asp:Image ID="Image1" SkinID="ExchangeList48" runat="server" />
<asp:Localize ID="locTitle" runat="server" meta:resourcekey="locTitle" Text="Edit Folder"></asp:Localize>
<asp:Literal ID="litFolderName" runat="server" Text="Folder" />
</div>
<div class="FormBody">
<wsp:CollectionTabs id="tabs" runat="server" SelectedTab="enterprisestorage_folder_settings_owa_editing" />
<wsp:SimpleMessageBox id="messageBox" runat="server" />
<wsp:CollapsiblePanel id="colOwaEditing" runat="server"
TargetControlID="panelFolderPermissions" meta:resourcekey="colOwaEditing" Text="">
</wsp:CollapsiblePanel>
<asp:Panel runat="server" ID="panelFolderPermissions">
<table>
<tr>
<td colspan="2">
<fieldset id="OwaUsersPanel" runat="server">
<legend><asp:Localize ID="locOwaEditingSection" runat="server" meta:resourcekey="locOwaEditingSection" Text="Users And Groups"></asp:Localize></legend>
<wsp:OwaUsers id="owaUsers" runat="server" />
</fieldset>
</tr>
<tr><td>&nbsp;</td></tr>
</table>
</asp:Panel>
<div class="FormFooterClean">
<asp:Button id="btnSave" runat="server" Text="Save Changes" CssClass="Button1" meta:resourcekey="btnSave" ValidationGroup="EditFolder" OnClick="btnSave_Click"></asp:Button>
<asp:ValidationSummary ID="valSummary" runat="server" ShowMessageBox="True" ShowSummary="False" ValidationGroup="EditFolder" />
</div>
</div>
</div>
</div>
</div>
</div>

View file

@ -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);
}
}
}
}

View file

@ -0,0 +1,132 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal.ExchangeServer {
public partial class EnterpriseStorageFolderSettingsOwaEditing {
/// <summary>
/// asyncTasks control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks;
/// <summary>
/// Image1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Image Image1;
/// <summary>
/// locTitle control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locTitle;
/// <summary>
/// litFolderName control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litFolderName;
/// <summary>
/// tabs control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStorageEditFolderTabs tabs;
/// <summary>
/// messageBox control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox;
/// <summary>
/// colOwaEditing control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel colOwaEditing;
/// <summary>
/// panelFolderPermissions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel panelFolderPermissions;
/// <summary>
/// OwaUsersPanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl OwaUsersPanel;
/// <summary>
/// locOwaEditingSection control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locOwaEditingSection;
/// <summary>
/// owaUsers control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStorageOwaUsersList owaUsers;
/// <summary>
/// btnSave control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnSave;
/// <summary>
/// valSummary control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ValidationSummary valSummary;
}
}

View file

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Tab.FolderPermissions" xml:space="preserve">
<value>Folder Permissions</value>
</data>
<data name="Tab.GeneralSettings" xml:space="preserve">
<value>General Settings</value>
</data>
<data name="Tab.OwaEditPermissions" xml:space="preserve">
<value>Office Web App Editing</value>
</data>
</root>

View file

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="btnAdd.Text" xml:space="preserve">
<value>Add...</value>
</data>
<data name="btnAddSelected.Text" xml:space="preserve">
<value>Add Accounts</value>
</data>
<data name="btnCancel.Text" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="btnDelete.Text" xml:space="preserve">
<value>Delete</value>
</data>
<data name="ddlSearchColumnDisplayName.Text" xml:space="preserve">
<value>Display Name</value>
</data>
<data name="ddlSearchColumnEmail.Text" xml:space="preserve">
<value>E-mail Address</value>
</data>
<data name="gvAccountsDisplayName.HeaderText" xml:space="preserve">
<value>Display Name</value>
</data>
<data name="gvAccountsEmail.HeaderText" xml:space="preserve">
<value>Email</value>
</data>
<data name="gvPopupAccounts.EmptyDataText" xml:space="preserve">
<value>No accounts found.</value>
</data>
<data name="gvUsers.EmptyDataText" xml:space="preserve">
<value>The list of users is empty. Click "Add..." button.</value>
</data>
<data name="gvUsersAccount.HeaderText" xml:space="preserve">
<value>Users</value>
</data>
<data name="headerAddAccounts.Text" xml:space="preserve">
<value>Enabled Users</value>
</data>
</root>

View file

@ -0,0 +1,31 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EnterpriseStorageEditFolderTabs.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStorageEditFolderTabs" %>
<table width="100%" cellpadding="0" cellspacing="1">
<tr>
<td class="Tabs">
<asp:DataList ID="esTabs" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" EnableViewState="false">
<ItemStyle Wrap="False" />
<ItemTemplate >
<asp:HyperLink ID="lnkTab" runat="server" CssClass="Tab" NavigateUrl='<%# Eval("Url") %>' OnClick="return tabClicked();">
<%# Eval("Name") %>
</asp:HyperLink>
</ItemTemplate>
<SelectedItemStyle Wrap="False" />
<SelectedItemTemplate>
<asp:HyperLink ID="lnkSelTab" runat="server" CssClass="ActiveTab" NavigateUrl='<%# Eval("Url") %>' OnClick="return tabClicked;">
<%# Eval("Name") %>
</asp:HyperLink>
</SelectedItemTemplate>
</asp:DataList>
</td>
</tr>
</table>
<br />
<script type="text/javascript">
function tabClicked() {
ShowProgressDialog('Loading');
ShowProgressDialogInternal();
return true;
}
</script>

View file

@ -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<Tab> tabsList = new List<Tab>();
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));
}
}
}

View file

@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal.ExchangeServer.UserControls {
public partial class EnterpriseStorageEditFolderTabs {
/// <summary>
/// esTabs control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DataList esTabs;
}
}

View file

@ -0,0 +1,114 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EnterpriseStorageOwaUsersList.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStorageOwaUsersList" %>
<asp:UpdatePanel ID="UsersUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<div class="FormButtonsBarClean">
<asp:Button ID="btnAdd" runat="server" Text="Add..." CssClass="Button1" OnClick="btnAdd_Click" meta:resourcekey="btnAdd" />
<asp:Button ID="btnDelete" runat="server" Text="Delete" CssClass="Button1" OnClick="btnDelete_Click" meta:resourcekey="btnDelete"/>
</div>
<asp:GridView ID="gvUsers" runat="server" meta:resourcekey="gvUsers" AutoGenerateColumns="False"
Width="600px" CssSelectorClass="NormalGridView"
DataKeyNames="AccountName">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="chkSelectAll" runat="server" onclick="javascript:SelectAllCheckboxes(this);" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
</ItemTemplate>
<ItemStyle Width="10px" />
</asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvUsersAccount" HeaderText="gvUsersAccount">
<ItemStyle Width="96%" Wrap="false" HorizontalAlign="Left">
</ItemStyle>
<ItemTemplate>
<asp:Literal ID="litAccount" runat="server" Text='<%# Eval("DisplayName") %>'></asp:Literal>
<asp:HiddenField ID="hdnAccountId" runat="server" Value='<%# Eval("AccountId") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
<asp:Panel ID="AddAccountsPanel" runat="server" CssClass="Popup" style="display:none">
<table class="Popup-Header" cellpadding="0" cellspacing="0">
<tr>
<td class="Popup-HeaderLeft"></td>
<td class="Popup-HeaderTitle">
<asp:Localize ID="headerAddAccounts" runat="server" meta:resourcekey="headerAddAccounts"></asp:Localize>
</td>
<td class="Popup-HeaderRight"></td>
</tr>
</table>
<div class="Popup-Content">
<div class="Popup-Body">
<br />
<asp:UpdatePanel ID="AddAccountsUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<div class="FormButtonsBarClean">
<div class="FormButtonsBarCleanRight">
<asp:Panel ID="SearchPanel" runat="server" DefaultButton="cmdSearch">
<asp:DropDownList ID="ddlSearchColumn" runat="server" CssClass="NormalTextBox">
<asp:ListItem Value="DisplayName" meta:resourcekey="ddlSearchColumnDisplayName">DisplayName</asp:ListItem>
<asp:ListItem Value="PrimaryEmailAddress" meta:resourcekey="ddlSearchColumnEmail">Email</asp:ListItem>
</asp:DropDownList><asp:TextBox ID="txtSearchValue" runat="server" CssClass="NormalTextBox" Width="100"></asp:TextBox><asp:ImageButton ID="cmdSearch" Runat="server" meta:resourcekey="cmdSearch" SkinID="SearchButton"
CausesValidation="false" OnClick="cmdSearch_Click"/>
</asp:Panel>
</div>
</div>
<div class="Popup-Scroll">
<asp:GridView ID="gvPopupAccounts" runat="server" meta:resourcekey="gvPopupAccounts" AutoGenerateColumns="False"
Width="100%" CssSelectorClass="NormalGridView"
DataKeyNames="AccountName">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="chkSelectAll" runat="server" onclick="javascript:SelectAllCheckboxes(this);" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
<asp:Literal ID="litAccountType" runat="server" Visible="false" Text='<%# Eval("AccountType") %>'></asp:Literal>
</ItemTemplate>
<ItemStyle Width="10px" />
</asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvAccountsDisplayName">
<ItemStyle Width="50%" HorizontalAlign="Left"></ItemStyle>
<ItemTemplate>
<asp:Image ID="imgAccount" runat="server" ImageUrl='<%# GetAccountImage((int)Eval("AccountType")) %>' ImageAlign="AbsMiddle" />
<asp:Literal ID="litDisplayName" runat="server" Text='<%# Eval("DisplayName") %>'></asp:Literal>
<asp:HiddenField ID="hdnAccountId" runat="server" Value='<%# Eval("AccountId") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvAccountsEmail">
<ItemStyle Width="50%" HorizontalAlign="Left"></ItemStyle>
<ItemTemplate>
<asp:Literal ID="litPrimaryEmailAddress" runat="server" Text='<%# Eval("PrimaryEmailAddress") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<br />
</div>
<div class="FormFooter">
<asp:Button ID="btnAddSelected" runat="server" CssClass="Button1" meta:resourcekey="btnAddSelected" Text="Add Accounts" OnClick="btnAddSelected_Click" />
<asp:Button ID="btnCancelAdd" runat="server" CssClass="Button1" meta:resourcekey="btnCancel" Text="Cancel" CausesValidation="false" />
</div>
</div>
</asp:Panel>
<asp:Button ID="btnAddAccountsFake" runat="server" style="display:none;" />
<ajaxToolkit:ModalPopupExtender ID="AddAccountsModal" runat="server"
TargetControlID="btnAddAccountsFake" PopupControlID="AddAccountsPanel"
BackgroundCssClass="modalBackground" DropShadow="false" CancelControlID="btnCancelAdd" />
</ContentTemplate>
</asp:UpdatePanel>

View file

@ -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<OrganizationUser> selectedAccounts = GetGridViewUsers(EnterpriseStorageOwaUsersList.SelectedState.Unselected);
BindAccounts(selectedAccounts.ToArray(), false);
}
protected void btnAddSelected_Click(object sender, EventArgs e)
{
List<OrganizationUser> 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<OrganizationUser> users = new List<OrganizationUser>();
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<OrganizationUser> GetGridViewUsers(EnterpriseStorageOwaUsersList.SelectedState state)
{
List<OrganizationUser> users = new List<OrganizationUser>();
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<OrganizationUser> GetGridViewAccounts()
{
List<OrganizationUser> accounts = new List<OrganizationUser>();
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);
}
}
}

View file

@ -0,0 +1,159 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal.ExchangeServer.UserControls {
public partial class EnterpriseStorageOwaUsersList {
/// <summary>
/// UsersUpdatePanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel UsersUpdatePanel;
/// <summary>
/// btnAdd control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnAdd;
/// <summary>
/// btnDelete control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnDelete;
/// <summary>
/// gvUsers control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.GridView gvUsers;
/// <summary>
/// AddAccountsPanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel AddAccountsPanel;
/// <summary>
/// headerAddAccounts control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize headerAddAccounts;
/// <summary>
/// AddAccountsUpdatePanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel AddAccountsUpdatePanel;
/// <summary>
/// SearchPanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel SearchPanel;
/// <summary>
/// ddlSearchColumn control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList ddlSearchColumn;
/// <summary>
/// txtSearchValue control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtSearchValue;
/// <summary>
/// cmdSearch control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ImageButton cmdSearch;
/// <summary>
/// gvPopupAccounts control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.GridView gvPopupAccounts;
/// <summary>
/// btnAddSelected control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnAddSelected;
/// <summary>
/// btnCancelAdd control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnCancelAdd;
/// <summary>
/// btnAddAccountsFake control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnAddAccountsFake;
/// <summary>
/// AddAccountsModal control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::AjaxControlToolkit.ModalPopupExtender AddAccountsModal;
}
}

View file

@ -126,4 +126,22 @@
<data name="ServerNameColumn.HeaderText" xml:space="preserve">
<value>Server Name</value>
</data>
<data name="lblPFXInstallPassword.Text" xml:space="preserve">
<value>Certificate Password:</value>
</data>
<data name="secCertificateSettings.Text" xml:space="preserve">
<value>SSL Certificate</value>
</data>
<data name="lblSelectFile.Text" xml:space="preserve">
<value>Select Certificate:</value>
</data>
<data name="lblExpiryDate.Text" xml:space="preserve">
<value>Expiry Date:</value>
</data>
<data name="lblIssuedBy.Text" xml:space="preserve">
<value>Issued By:</value>
</data>
<data name="lblSanName.Text" xml:space="preserve">
<value>SAN Name:</value>
</data>
</root>

View file

@ -1,4 +1,62 @@
<%@ 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" %>
<fieldset>
<legend>
<asp:Label ID="secCertificateSettings" runat="server" meta:resourcekey="secServiceSettings" Text="SSL Certificate" CssClass="NormalBold"></asp:Label>&nbsp;
</legend>
<table>
<tr>
<td class="SubHead" style="width:200px" nowrap>
<asp:Localize runat="server" meta:resourcekey="lblSelectFile" />
</td>
<td style="padding: 10px 0 10px 0;"><asp:FileUpload ID="upPFX" runat="server"/></td>
</tr>
<tr><td></td></tr>
<tr>
<td class="SubHead" style="width:200px" nowrap>
<asp:Localize runat="server" meta:resourcekey="lblPFXInstallPassword" />
</td>
<td>
<asp:TextBox ID="txtPFXInstallPassword" runat="server" TextMode="Password" Width="200px" />
</td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>
<asp:Label ID="currentCertificate" runat="server" meta:resourcekey="currentCertificate" Text="Current Certificate" CssClass="NormalBold"></asp:Label>&nbsp;
</legend>
<asp:Panel ID="plCertificateInfo" Visible="false" runat="server">
<table>
<tr>
<td class="SubHead" style="width:200px" nowrap>
<asp:Localize runat="server" meta:resourcekey="lblIssuedBy" />
</td>
<td class="SubHead">
<asp:Label ID="lblIssuedBy" runat="server"/>
</td>
</tr>
<tr>
<td class="SubHead" style="width:200px" nowrap>
<asp:Localize runat="server" meta:resourcekey="lblSanName" />
</td>
<td class="SubHead">
<asp:Label ID="lblSanName" runat="server"/>
</td>
</tr>
<tr>
<td class="SubHead" style="width:200px" nowrap>
<asp:Localize runat="server" meta:resourcekey="lblExpiryDate" />
</td>
<td class="SubHead">
<asp:Label ID="lblExpiryDate" runat="server"/>
</td>
</tr>
</table>
</asp:Panel>
</fieldset>
<fieldset>
<table>
<tr>
<td class="SubHead" width="200" nowrap>
@ -73,3 +131,5 @@
</td>
</tr>
</table>
</fieldset>
<br />

View file

@ -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,12 +56,30 @@ namespace WebsitePanel.Portal.ProviderControls
}
}
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"];
@ -87,6 +108,25 @@ namespace WebsitePanel.Portal.ProviderControls
settings["CentralNPS"] = chkUseCentralNPS.Checked ? txtCentralNPS.Text : string.Empty;
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)

View file

@ -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.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@ -40,6 +12,78 @@ namespace WebsitePanel.Portal.ProviderControls {
public partial class RDS_Settings {
/// <summary>
/// secCertificateSettings control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label secCertificateSettings;
/// <summary>
/// upPFX control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.FileUpload upPFX;
/// <summary>
/// txtPFXInstallPassword control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtPFXInstallPassword;
/// <summary>
/// currentCertificate control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label currentCertificate;
/// <summary>
/// plCertificateInfo control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel plCertificateInfo;
/// <summary>
/// lblIssuedBy control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblIssuedBy;
/// <summary>
/// lblSanName control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblSanName;
/// <summary>
/// lblExpiryDate control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblExpiryDate;
/// <summary>
/// lblConnectionBroker control.
/// </summary>

View file

@ -153,4 +153,10 @@
<data name="locLblApplicationName" xml:space="preserve">
<value>Application Name</value>
</data>
<data name="btnExit.Text" xml:space="preserve">
<value>Back to Applications List</value>
</data>
<data name="btnSaveExit.Text" xml:space="preserve">
<value>Save Changes and Exit</value>
</data>
</root>

View file

@ -30,26 +30,6 @@
</tr>
</table>
<wsp:CollapsiblePanel id="secSelectSertificate" runat="server"
TargetControlID="panelSelectSertificate" meta:resourcekey="secSelectSertificate" Text="">
</wsp:CollapsiblePanel>
<asp:Panel runat="server" ID="panelSelectSertificate">
<div style="padding: 10px;">
<div class="FormBody">
<div class="FormField">
<asp:FileUpload ID="upPFX" runat="server"/>
</div>
<div class="FormFieldDescription">
<asp:Localize runat="server" meta:resourcekey="lblPFXInstallPassword" />
</div>
<div class="FormField">
<asp:TextBox ID="txtPFXInstallPassword" runat="server" TextMode="Password" CssClass="NormalTextBox" />
</div>
</div>
</div>
</asp:Panel>
<fieldset id="RDSServersPanel" runat="server">
<legend><asp:Localize ID="locRDSServersSection" runat="server" meta:resourcekey="locRDSServersSection" Text="RDS Servers"></asp:Localize></legend>
<div style="padding: 10px;">

View file

@ -65,25 +65,11 @@ 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);
}
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);
}
}
}

View file

@ -75,42 +75,6 @@ namespace WebsitePanel.Portal.RDS {
/// </remarks>
protected global::System.Web.UI.WebControls.RequiredFieldValidator valCollectionName;
/// <summary>
/// secSelectSertificate control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secSelectSertificate;
/// <summary>
/// panelSelectSertificate control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel panelSelectSertificate;
/// <summary>
/// upPFX control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.FileUpload upPFX;
/// <summary>
/// txtPFXInstallPassword control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtPFXInstallPassword;
/// <summary>
/// RDSServersPanel control.
/// </summary>

View file

@ -55,8 +55,12 @@
</div>
</asp:Panel>
<div class="FormFooterClean">
<wsp:ItemButtonPanel id="buttonPanel" runat="server" ValidationGroup="SaveRDSCollection"
OnSaveClick="btnSave_Click" OnSaveExitClick="btnSaveExit_Click" />
<asp:Button id="btnSave" runat="server" Text="Save Changes" CssClass="Button1" meta:resourcekey="btnSave"
OnClick="btnSave_Click" OnClientClick="ShowProgressDialog('Updating ...');"></asp:Button>
<asp:Button id="btnSaveExit" runat="server" Text="Save Changes and Exit" CssClass="Button1" meta:resourcekey="btnSaveExit"
OnClick="btnSaveExit_Click" OnClientClick="ShowProgressDialog('Updating ...');"></asp:Button>
<asp:Button id="btnExit" runat="server" Text="Back to Applications List" CssClass="Button1" meta:resourcekey="btnExit"
OnClick="btnExit_Click" OnClientClick="ShowProgressDialog('Loading ...');"></asp:Button>
</div>
</div>
</div>

View file

@ -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));
}
}
}

View file

@ -139,12 +139,30 @@ namespace WebsitePanel.Portal.RDS {
protected global::WebsitePanel.Portal.RDS.UserControls.RDSCollectionUsers users;
/// <summary>
/// buttonPanel control.
/// btnSave control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ItemButtonPanel buttonPanel;
protected global::System.Web.UI.WebControls.Button btnSave;
/// <summary>
/// btnSaveExit control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnSaveExit;
/// <summary>
/// btnExit control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnExit;
}
}

View file

@ -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);

View file

@ -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);
}
}

View file

@ -28,6 +28,7 @@
<asp:LinkButton id="lnkDisplayName" meta:resourcekey="lnkDisplayName" runat="server" Text='<%# Eval("DisplayName")%>' CommandName="EditApplication" CommandArgument='<%# Eval("Alias") %>' OnClientClick="ShowProgressDialog('Loading ...');return true;"/>
<asp:HiddenField ID="hfFilePath" runat="server" Value='<%# Eval("FilePath") %>'/>
<asp:HiddenField ID="hfRequiredCommandLine" runat="server" Value='<%# Eval("RequiredCommandLine") %>'/>
<asp:HiddenField ID="hfUsers" runat="server" Value='<%# Eval("Users") != null ? "New" : null %>'/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>

View file

@ -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 (users != null)
{
app.Users = new string[]{"New"};
}
if (state == SelectedState.All ||
(state == SelectedState.Selected && chkSelect.Checked) ||

View file

@ -25,6 +25,7 @@
</ItemStyle>
<ItemTemplate>
<asp:Literal ID="litAccount" runat="server" Text='<%# Eval("DisplayName") %>'></asp:Literal>
<asp:Image ID="Image1" runat="server" ImageUrl='<%# GetThemedImage("Exchange/admin_16.png") %>' Visible='<%# Convert.ToBoolean(Eval("IsVIP")) %>' ImageAlign="AbsMiddle" />
<asp:HiddenField ID="hdnSamAccountName" runat="server" Value='<%# Eval("SamAccountName") %>' />
</ItemTemplate>
</asp:TemplateField>
@ -81,6 +82,7 @@
<asp:Image ID="imgAccount" runat="server" ImageUrl='<%# GetAccountImage((int)Eval("AccountType")) %>' ImageAlign="AbsMiddle" />
<asp:Literal ID="litDisplayName" runat="server" Text='<%# Eval("DisplayName") %>'></asp:Literal>
<asp:HiddenField ID="hdnSamName" runat="server" Value='<%# Eval("SamAccountName") %>' />
<asp:HiddenField ID="hdnLocalAdmin" runat="server" Value='<%# Eval("IsVIP").ToString() %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvAccountsEmail">

View file

@ -132,6 +132,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 +234,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)
});
}
}

View file

@ -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" %>
<asp:UpdatePanel runat="server" ID="updatePanelUsers">
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
<asp:UpdatePanel runat="server" ID="messageBoxPanel" UpdateMode="Conditional">
<ContentTemplate>
<wsp:SimpleMessageBox id="messageBox" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
<div class="FormButtonsBar">
<div class="FormButtonsBar">
<div class="Left">
<asp:Button ID="btnAddRDSServer" runat="server"
meta:resourcekey="btnAddRDSServer" Text="Add RDS Server" CssClass="Button3"
@ -28,11 +33,20 @@
<asp:ListItem>100</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="txtSearchValue" runat="server" CssClass="NormalTextBox" Width="100">
</asp:TextBox><asp:ImageButton ID="cmdSearch" Runat="server" meta:resourcekey="cmdSearch" SkinID="SearchButton" CausesValidation="false"/>
<asp:TextBox ID="txtSearchValue" runat="server" CssClass="NormalTextBox" Width="100"/>
<asp:ImageButton ID="cmdSearch" Runat="server" meta:resourcekey="cmdSearch" SkinID="SearchButton" CausesValidation="false"/>
</asp:Panel>
</div>
</div>
<asp:ObjectDataSource ID="odsRDSServersPaged" runat="server" EnablePaging="True" SelectCountMethod="GetRDSServersPagedCount"
SelectMethod="GetRDSServersPaged" SortParameterName="sortColumn" TypeName="WebsitePanel.Portal.RDSHelper" OnSelected="odsRDSServersPaged_Selected">
<SelectParameters>
<asp:ControlParameter Name="filterValue" ControlID="txtSearchValue" PropertyName="Text" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:UpdatePanel runat="server" ID="updatePanelUsers" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView id="gvRDSServers" runat="server" AutoGenerateColumns="False"
AllowPaging="True" AllowSorting="True"
@ -43,11 +57,45 @@
<Columns>
<asp:BoundField DataField="Name" HtmlEncode="true" SortExpression="Name" HeaderText="Server name">
<HeaderStyle Wrap="false" />
<ItemStyle Wrap="False" Width="25%"/>
<ItemStyle Wrap="False" Width="15%"/>
</asp:BoundField>
<asp:BoundField DataField="Address" HeaderText="IP Address"><ItemStyle Width="15%"/></asp:BoundField>
<asp:BoundField DataField="ItemName" HeaderText="Organization"><ItemStyle Width="20%"/></asp:BoundField>
<asp:BoundField DataField="Description" HeaderText="Comments"><ItemStyle Width="30%"/></asp:BoundField>
<asp:BoundField DataField="Address" HeaderText="IP Address"><ItemStyle Width="10%"/></asp:BoundField>
<asp:BoundField DataField="ItemName" HeaderText="Organization"><ItemStyle Width="10%"/></asp:BoundField>
<asp:BoundField DataField="Description" HeaderText="Comments"><ItemStyle Width="20%"/></asp:BoundField>
<asp:TemplateField meta:resourcekey="gvPopupStatus">
<ItemStyle Width="20%" HorizontalAlign="Left" />
<ItemTemplate>
<asp:Literal ID="litStatus" runat="server" Text='<%# Eval("Status") %>'></asp:Literal>
<asp:HiddenField ID="hdnRdsCollectionId" runat="server" Value='<%# Eval("RdsCollectionId") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvViewInfo">
<ItemStyle Width="8%" HorizontalAlign="Right"/>
<ItemTemplate>
<asp:LinkButton OnClientClick="ShowProgressDialog('Getting Server Info ...');return true;" Visible='<%# Eval("Status") != null && Eval("Status").ToString().StartsWith("Online") %>' CommandName="ViewInfo" CommandArgument='<%# Eval("Id")%>' ID="lbViewInfo" runat="server" Text="View Info"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvRestart">
<ItemStyle HorizontalAlign="Right"/>
<ItemTemplate>
<asp:LinkButton ID="lbRestart" CommandName="Restart" CommandArgument='<%# Eval("Id")%>' Visible='<%# Eval("Status") != null && Eval("Status").ToString().StartsWith("Online") %>'
runat="server" Text="Restart" OnClientClick="if(confirm('Are you sure you want to restart selected server?')) ShowProgressDialog('Loading...'); else return false;"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvShutdown">
<ItemStyle Width="9%" HorizontalAlign="Right"/>
<ItemTemplate>
<asp:LinkButton ID="lbShutdown" CommandName="ShutDown" CommandArgument='<%# Eval("Id")%>' Visible='<%# Eval("Status") != null && Eval("Status").ToString().StartsWith("Online") %>'
runat="server" Text="Shut Down" OnClientClick="if(confirm('Are you sure you want to shut down selected server?')) ShowProgressDialog('Loading...'); else return false;"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkInstallCertificate" runat="server" Text="Certificate" Visible='<%# Convert.ToBoolean(Eval("SslAvailable")) && Eval("ItemId") != null && Eval("Status") != null && Eval("Status").ToString().StartsWith("Online") %>'
CommandName="InstallCertificate" CommandArgument='<%# Eval("Id") %>' ToolTip="Repair Certificate"
OnClientClick="if(confirm('Are you sure you want to install certificate?')) ShowProgressDialog('Installing certificate...'); else return false;"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkRemove" runat="server" Text="Remove" Visible='<%# Eval("ItemId") == null %>'
@ -57,11 +105,104 @@
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="odsRDSServersPaged" runat="server" EnablePaging="True" SelectCountMethod="GetRDSServersPagedCount"
SelectMethod="GetRDSServersPaged" SortParameterName="sortColumn" TypeName="WebsitePanel.Portal.RDSHelper" OnSelected="odsRDSServersPaged_Selected">
<SelectParameters>
<asp:ControlParameter Name="filterValue" ControlID="txtSearchValue" PropertyName="Text" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:Panel ID="ServerInfoPanel" runat="server" CssClass="Popup" style="display:none">
<table class="Popup-Header" cellpadding="0" cellspacing="0">
<tr>
<td class="Popup-HeaderLeft"/>
<td class="Popup-HeaderTitle">
<asp:Localize ID="Localize1" runat="server" meta:resourcekey="headerServerInfo"/>
</td>
<td class="Popup-HeaderRight"/>
</tr>
</table>
<div class="Popup-Content">
<div class="Popup-Body">
<br />
<asp:UpdatePanel ID="serverInfoUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<div class="Popup-Scroll" style="height:auto;">
<wsp:CollapsiblePanel id="secServerInfo" runat="server" TargetControlID="panelHardwareInfo" meta:resourcekey="secRdsApplicationEdit" Text=""/>
<asp:Panel runat="server" ID="panelHardwareInfo">
<table>
<tr>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="locProcessor" runat="server" Text="Processor:"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litProcessor" runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="locLoadPercentage" Text="Load Percentage:" runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litLoadPercentage" runat="server"/>
</td>
</tr>
<tr>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="locMemoryAllocated" runat="server" Text="Allocated Memory:"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litMemoryAllocated" runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="locFreeMemory" Text="Free Memory:" runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litFreeMemory" runat="server"/>
</td>
</tr>
</table>
</asp:Panel>
<wsp:CollapsiblePanel id="secRdsApplicationEdit" runat="server" TargetControlID="panelDiskDrives" meta:resourcekey="secRdsApplicationEdit" Text="Disk Drives"/>
<asp:Panel runat="server" ID="panelDiskDrives">
<table>
<asp:Repeater ID="rpServerDrives" runat="server" EnableViewState="false">
<ItemTemplate>
<tr>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litDeviceId" runat="server" Text='<%# Eval("DeviceId") %>'/>
</td>
<td class="FormLabel150" style="width: 150px;"/>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="locVolumeName" Text="Volume Name:" runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litVolumeName" Text='<%# Eval("VolumeName") %>' runat="server"/>
</td>
</tr>
<tr>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="locSize" Text="Size:" runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litSize" Text='<%# Eval("SizeMb") + " MB" %>' runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="locFreeSpace" Text="Free Space:" runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litFreeSpace" Text='<%# Eval("FreeSpaceMb") + " MB" %>' runat="server"/>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</asp:Panel>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<br />
</div>
<div class="FormFooter">
<asp:Button ID="btnCancelServerInfo" runat="server" CssClass="Button1" meta:resourcekey="btnServerInfoCancel" Text="Cancel" CausesValidation="false" />
</div>
</div>
</asp:Panel>
<asp:Button ID="btnViewInfoFake" runat="server" style="display:none;" />
<ajaxToolkit:ModalPopupExtender ID="ViewInfoModal" runat="server" TargetControlID="btnViewInfoFake" PopupControlID="ServerInfoPanel"
BackgroundCssClass="modalBackground" DropShadow="false" CancelControlID="btnCancelServerInfo"/>
</ContentTemplate>
</asp:UpdatePanel>

View file

@ -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,6 +40,7 @@ using System.Web.UI.HtmlControls;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.Common;
using AjaxControlToolkit;
namespace WebsitePanel.Portal
{
@ -99,6 +101,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 +131,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(rdsServer.ItemId.Value, 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(rdsServer.ItemId.Value, 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(rdsServer.ItemId.Value, 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);
}
}
}

View file

@ -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.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@ -41,13 +13,22 @@ namespace WebsitePanel.Portal {
public partial class RDSServers {
/// <summary>
/// updatePanelUsers control.
/// asyncTasks control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel updatePanelUsers;
protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks;
/// <summary>
/// messageBoxPanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel messageBoxPanel;
/// <summary>
/// messageBox control.
@ -112,6 +93,24 @@ namespace WebsitePanel.Portal {
/// </remarks>
protected global::System.Web.UI.WebControls.ImageButton cmdSearch;
/// <summary>
/// odsRDSServersPaged control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource odsRDSServersPaged;
/// <summary>
/// updatePanelUsers control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel updatePanelUsers;
/// <summary>
/// gvRDSServers control.
/// </summary>
@ -122,12 +121,174 @@ namespace WebsitePanel.Portal {
protected global::System.Web.UI.WebControls.GridView gvRDSServers;
/// <summary>
/// odsRDSServersPaged control.
/// ServerInfoPanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource odsRDSServersPaged;
protected global::System.Web.UI.WebControls.Panel ServerInfoPanel;
/// <summary>
/// Localize1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize Localize1;
/// <summary>
/// serverInfoUpdatePanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel serverInfoUpdatePanel;
/// <summary>
/// secServerInfo control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secServerInfo;
/// <summary>
/// panelHardwareInfo control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel panelHardwareInfo;
/// <summary>
/// locProcessor control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal locProcessor;
/// <summary>
/// litProcessor control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litProcessor;
/// <summary>
/// locLoadPercentage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal locLoadPercentage;
/// <summary>
/// litLoadPercentage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litLoadPercentage;
/// <summary>
/// locMemoryAllocated control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal locMemoryAllocated;
/// <summary>
/// litMemoryAllocated control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litMemoryAllocated;
/// <summary>
/// locFreeMemory control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal locFreeMemory;
/// <summary>
/// litFreeMemory control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litFreeMemory;
/// <summary>
/// secRdsApplicationEdit control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secRdsApplicationEdit;
/// <summary>
/// panelDiskDrives control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel panelDiskDrives;
/// <summary>
/// rpServerDrives control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Repeater rpServerDrives;
/// <summary>
/// btnCancelServerInfo control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnCancelServerInfo;
/// <summary>
/// btnViewInfoFake control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnViewInfoFake;
/// <summary>
/// ViewInfoModal control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::AjaxControlToolkit.ModalPopupExtender ViewInfoModal;
}
}

View file

@ -11,16 +11,16 @@
<div class="FormContentRDSConf">
<table>
<tr>
<td class="FormLabel150"><asp:Localize ID="locServerName" runat="server" meta:resourcekey="locServerName" Text="Server Full Name:"></asp:Localize></td>
<td class="FormLabel260"><asp:Localize ID="locServerName" runat="server" meta:resourcekey="locServerName" Text="Server Fully Qualified Domain Name:"></asp:Localize></td>
<td>
<asp:TextBox ID="txtServerName" runat="server" CssClass="NormalTextBox" Width="145px"></asp:TextBox>
<asp:TextBox ID="txtServerName" runat="server" CssClass="NormalTextBox" Width="300px"></asp:TextBox>
<asp:RequiredFieldValidator ID="valServerName" runat="server" ErrorMessage="*" ControlToValidate="txtServerName"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="FormLabel150"><asp:Localize ID="locServerComments" runat="server" meta:resourcekey="locServerComments" Text="Server Comments:"></asp:Localize></td>
<td class="FormLabel260"><asp:Localize ID="locServerComments" runat="server" meta:resourcekey="locServerComments" Text="Server Comments:"></asp:Localize></td>
<td>
<asp:TextBox ID="txtServerComments" runat="server" CssClass="NormalTextBox" Width="145px"></asp:TextBox>
<asp:TextBox ID="txtServerComments" runat="server" CssClass="NormalTextBox" Width="300px"></asp:TextBox>
</td>
</tr>
</table>

View file

@ -63,7 +63,7 @@ namespace WebsitePanel.Portal
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);
}
}

View file

@ -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.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.

View file

@ -211,6 +211,20 @@
<Compile Include="Code\ReportingServices\IResourceStorage.cs" />
<Compile Include="Code\ReportingServices\ReportingServicesUtils.cs" />
<Compile Include="Code\UserControls\Tab.cs" />
<Compile Include="ExchangeServer\EnterpriseStorageFolderSettingsFolderPermissions.ascx.cs">
<DependentUpon>EnterpriseStorageFolderSettingsFolderPermissions.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ExchangeServer\EnterpriseStorageFolderSettingsFolderPermissions.ascx.designer.cs">
<DependentUpon>EnterpriseStorageFolderSettingsFolderPermissions.ascx</DependentUpon>
</Compile>
<Compile Include="ExchangeServer\EnterpriseStorageFolderSettingsOwaEditing.ascx.cs">
<DependentUpon>EnterpriseStorageFolderSettingsOwaEditing.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ExchangeServer\EnterpriseStorageFolderSettingsOwaEditing.ascx.designer.cs">
<DependentUpon>EnterpriseStorageFolderSettingsOwaEditing.ascx</DependentUpon>
</Compile>
<Compile Include="ExchangeServer\OrganizationDeletedUsers.ascx.cs">
<DependentUpon>OrganizationDeletedUsers.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@ -229,6 +243,20 @@
<DependentUpon>OrganizationDeletedUserGeneralSettings.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ExchangeServer\UserControls\EnterpriseStorageEditFolderTabs.ascx.cs">
<DependentUpon>EnterpriseStorageEditFolderTabs.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ExchangeServer\UserControls\EnterpriseStorageEditFolderTabs.ascx.designer.cs">
<DependentUpon>EnterpriseStorageEditFolderTabs.ascx</DependentUpon>
</Compile>
<Compile Include="ExchangeServer\UserControls\EnterpriseStorageOwaUsersList.ascx.cs">
<DependentUpon>EnterpriseStorageOwaUsersList.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ExchangeServer\UserControls\EnterpriseStorageOwaUsersList.ascx.designer.cs">
<DependentUpon>EnterpriseStorageOwaUsersList.ascx</DependentUpon>
</Compile>
<Compile Include="ProviderControls\SmarterMail100_EditAccount.ascx.cs">
<DependentUpon>SmarterMail100_EditAccount.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@ -4455,7 +4483,11 @@
</ItemGroup>
<ItemGroup>
<Content Include="ApplyEnableHardQuotaFeature.ascx" />
<Content Include="ExchangeServer\EnterpriseStorageFolderSettingsFolderPermissions.ascx" />
<Content Include="ExchangeServer\EnterpriseStorageFolderSettingsOwaEditing.ascx" />
<Content Include="ExchangeServer\ExchangeCheckDomainName.ascx" />
<Content Include="ExchangeServer\UserControls\EnterpriseStorageEditFolderTabs.ascx" />
<Content Include="ExchangeServer\UserControls\EnterpriseStorageOwaUsersList.ascx" />
<Content Include="ProviderControls\SmarterMail100_EditAccount.ascx" />
<Content Include="ProviderControls\SmarterMail100_EditDomain.ascx" />
<Content Include="ProviderControls\SmarterMail100_EditDomain_Features.ascx" />
@ -4499,6 +4531,10 @@
<Content Include="ProviderControls\App_LocalResources\SmarterMail100_EditList.ascx.resx">
<SubType>Designer</SubType>
</Content>
<Content Include="ExchangeServer\UserControls\App_LocalResources\EnterpriseStorageEditFolderTabs.ascx.resx" />
<Content Include="ExchangeServer\App_LocalResources\EnterpriseStorageFolderSettingsFolderPermissions.ascx.resx" />
<Content Include="ExchangeServer\UserControls\App_LocalResources\EnterpriseStorageOwaUsersList.ascx.resx" />
<Content Include="ExchangeServer\App_LocalResources\EnterpriseStorageFolderSettingsOwaEditing.ascx.resx" />
<EmbeddedResource Include="RDS\App_LocalResources\RDSEditCollectionSettings.ascx.resx" />
<Content Include="RDS\AssignedRDSServers.ascx" />
<Content Include="RDS\AddRDSServer.ascx" />
@ -5678,7 +5714,9 @@
<Content Include="VPSForPC\App_LocalResources\VpsDetailsGeneral.ascx.resx">
<SubType>Designer</SubType>
</Content>
<Content Include="App_LocalResources\WebsitesSSL.ascx.resx" />
<Content Include="App_LocalResources\WebsitesSSL.ascx.resx">
<SubType>Designer</SubType>
</Content>
<Content Include="VPSForPC\App_LocalResources\VpsDetailsHelp.ascx.resx">
<SubType>Designer</SubType>
</Content>
@ -5864,7 +5902,9 @@
</Content>
<Content Include="RDS\UserControls\App_LocalResources\RDSCollectionUsers.ascx.resx" />
<Content Include="RDS\UserControls\App_LocalResources\RDSCollectionServers.ascx.resx" />
<Content Include="RDS\UserControls\App_LocalResources\RDSCollectionApps.ascx.resx" />
<Content Include="RDS\UserControls\App_LocalResources\RDSCollectionApps.ascx.resx">
<SubType>Designer</SubType>
</Content>
<Content Include="ProviderControls\App_LocalResources\RDS_Settings.ascx.resx" />
<Content Include="UserControls\App_LocalResources\DomainControl.ascx.resx">
<SubType>Designer</SubType>