added functionality of drive mapping

This commit is contained in:
vfedosevich 2014-06-10 04:00:51 +03:00
parent a07c04a187
commit c2ef09c26e
35 changed files with 3196 additions and 11 deletions

View file

@ -4338,3 +4338,9 @@ WHERE
RETURN
GO
IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'EnterpriseStorage.DriveMaps')
BEGIN
INSERT [dbo].[Quotas] ([QuotaID], [GroupID],[QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID]) VALUES (468, 44, 2, N'EnterpriseStorage.DriveMaps', N'Use Drive Maps', 1, 0, NULL)
END
GO

View file

@ -250,7 +250,8 @@ order by rg.groupOrder
public const string HELICON_ZOO = "HeliconZoo.*";
public const string ENTERPRISESTORAGE_DISKSTORAGESPACE = "EnterpriseStorage.DiskStorageSpace";
public const string ENTERPRISESTORAGE_FOLDERS = "EnterpriseStorage.Folders";
public const string ENTERPRISESTORAGE_FOLDERS = "EnterpriseStorage.Folders";
public const string ENTERPRICESTORAGE_DRIVEMAPS = "EnterpriseStorage.DriveMaps";
}
}

View file

@ -92,6 +92,16 @@ namespace WebsitePanel.EnterpriseServer
private System.Threading.SendOrPostCallback GetStatisticsByOrganizationOperationCompleted;
private System.Threading.SendOrPostCallback CreateMappedDriveOperationCompleted;
private System.Threading.SendOrPostCallback DeleteMappedDriveOperationCompleted;
private System.Threading.SendOrPostCallback GetDriveMapsPagedOperationCompleted;
private System.Threading.SendOrPostCallback GetUsedDriveLettersOperationCompleted;
private System.Threading.SendOrPostCallback GetNotMappedEnterpriseFoldersOperationCompleted;
/// <remarks/>
public esEnterpriseStorage()
{
@ -152,6 +162,21 @@ namespace WebsitePanel.EnterpriseServer
/// <remarks/>
public event GetStatisticsByOrganizationCompletedEventHandler GetStatisticsByOrganizationCompleted;
/// <remarks/>
public event CreateMappedDriveCompletedEventHandler CreateMappedDriveCompleted;
/// <remarks/>
public event DeleteMappedDriveCompletedEventHandler DeleteMappedDriveCompleted;
/// <remarks/>
public event GetDriveMapsPagedCompletedEventHandler GetDriveMapsPagedCompleted;
/// <remarks/>
public event GetUsedDriveLettersCompletedEventHandler GetUsedDriveLettersCompleted;
/// <remarks/>
public event GetNotMappedEnterpriseFoldersCompletedEventHandler GetNotMappedEnterpriseFoldersCompleted;
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/CheckFileServicesInstallation", 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 bool CheckFileServicesInstallation(int serviceId)
@ -1115,6 +1140,278 @@ namespace WebsitePanel.EnterpriseServer
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/CreateMappedDrive", 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 CreateMappedDrive(int packageId, int itemId, string driveLetter, string labelAs, string folderName)
{
object[] results = this.Invoke("CreateMappedDrive", new object[] {
packageId,
itemId,
driveLetter,
labelAs,
folderName});
return ((ResultObject)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginCreateMappedDrive(int packageId, int itemId, string driveLetter, string labelAs, string folderName, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("CreateMappedDrive", new object[] {
packageId,
itemId,
driveLetter,
labelAs,
folderName}, callback, asyncState);
}
/// <remarks/>
public ResultObject EndCreateMappedDrive(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((ResultObject)(results[0]));
}
/// <remarks/>
public void CreateMappedDriveAsync(int packageId, int itemId, string driveLetter, string labelAs, string folderName)
{
this.CreateMappedDriveAsync(packageId, itemId, driveLetter, labelAs, folderName, null);
}
/// <remarks/>
public void CreateMappedDriveAsync(int packageId, int itemId, string driveLetter, string labelAs, string folderName, object userState)
{
if ((this.CreateMappedDriveOperationCompleted == null))
{
this.CreateMappedDriveOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateMappedDriveOperationCompleted);
}
this.InvokeAsync("CreateMappedDrive", new object[] {
packageId,
itemId,
driveLetter,
labelAs,
folderName}, this.CreateMappedDriveOperationCompleted, userState);
}
private void OnCreateMappedDriveOperationCompleted(object arg)
{
if ((this.CreateMappedDriveCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.CreateMappedDriveCompleted(this, new CreateMappedDriveCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/DeleteMappedDrive", 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 DeleteMappedDrive(int itemId, string driveLetter)
{
object[] results = this.Invoke("DeleteMappedDrive", new object[] {
itemId,
driveLetter});
return ((ResultObject)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginDeleteMappedDrive(int itemId, string driveLetter, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("DeleteMappedDrive", new object[] {
itemId,
driveLetter}, callback, asyncState);
}
/// <remarks/>
public ResultObject EndDeleteMappedDrive(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((ResultObject)(results[0]));
}
/// <remarks/>
public void DeleteMappedDriveAsync(int itemId, string driveLetter)
{
this.DeleteMappedDriveAsync(itemId, driveLetter, null);
}
/// <remarks/>
public void DeleteMappedDriveAsync(int itemId, string driveLetter, object userState)
{
if ((this.DeleteMappedDriveOperationCompleted == null))
{
this.DeleteMappedDriveOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteMappedDriveOperationCompleted);
}
this.InvokeAsync("DeleteMappedDrive", new object[] {
itemId,
driveLetter}, this.DeleteMappedDriveOperationCompleted, userState);
}
private void OnDeleteMappedDriveOperationCompleted(object arg)
{
if ((this.DeleteMappedDriveCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.DeleteMappedDriveCompleted(this, new DeleteMappedDriveCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetDriveMapsPaged", 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 MappedDrivesPaged GetDriveMapsPaged(int itemId, string filterValue, string sortColumn, int startRow, int maximumRows)
{
object[] results = this.Invoke("GetDriveMapsPaged", new object[] {
itemId,
filterValue,
sortColumn,
startRow,
maximumRows});
return ((MappedDrivesPaged)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetDriveMapsPaged(int itemId, string filterValue, string sortColumn, int startRow, int maximumRows, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("GetDriveMapsPaged", new object[] {
itemId,
filterValue,
sortColumn,
startRow,
maximumRows}, callback, asyncState);
}
/// <remarks/>
public MappedDrivesPaged EndGetDriveMapsPaged(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((MappedDrivesPaged)(results[0]));
}
/// <remarks/>
public void GetDriveMapsPagedAsync(int itemId, string filterValue, string sortColumn, int startRow, int maximumRows)
{
this.GetDriveMapsPagedAsync(itemId, filterValue, sortColumn, startRow, maximumRows, null);
}
/// <remarks/>
public void GetDriveMapsPagedAsync(int itemId, string filterValue, string sortColumn, int startRow, int maximumRows, object userState)
{
if ((this.GetDriveMapsPagedOperationCompleted == null))
{
this.GetDriveMapsPagedOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetDriveMapsPagedOperationCompleted);
}
this.InvokeAsync("GetDriveMapsPaged", new object[] {
itemId,
filterValue,
sortColumn,
startRow,
maximumRows}, this.GetDriveMapsPagedOperationCompleted, userState);
}
private void OnGetDriveMapsPagedOperationCompleted(object arg)
{
if ((this.GetDriveMapsPagedCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetDriveMapsPagedCompleted(this, new GetDriveMapsPagedCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetUsedDriveLetters", 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[] GetUsedDriveLetters(int itemId)
{
object[] results = this.Invoke("GetUsedDriveLetters", new object[] {
itemId});
return ((string[])(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetUsedDriveLetters(int itemId, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("GetUsedDriveLetters", new object[] {
itemId}, callback, asyncState);
}
/// <remarks/>
public string[] EndGetUsedDriveLetters(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((string[])(results[0]));
}
/// <remarks/>
public void GetUsedDriveLettersAsync(int itemId)
{
this.GetUsedDriveLettersAsync(itemId, null);
}
/// <remarks/>
public void GetUsedDriveLettersAsync(int itemId, object userState)
{
if ((this.GetUsedDriveLettersOperationCompleted == null))
{
this.GetUsedDriveLettersOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetUsedDriveLettersOperationCompleted);
}
this.InvokeAsync("GetUsedDriveLetters", new object[] {
itemId}, this.GetUsedDriveLettersOperationCompleted, userState);
}
private void OnGetUsedDriveLettersOperationCompleted(object arg)
{
if ((this.GetUsedDriveLettersCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetUsedDriveLettersCompleted(this, new GetUsedDriveLettersCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetNotMappedEnterpriseFolders", 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 SystemFile[] GetNotMappedEnterpriseFolders(int itemId)
{
object[] results = this.Invoke("GetNotMappedEnterpriseFolders", new object[] {
itemId});
return ((SystemFile[])(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetNotMappedEnterpriseFolders(int itemId, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("GetNotMappedEnterpriseFolders", new object[] {
itemId}, callback, asyncState);
}
/// <remarks/>
public SystemFile[] EndGetNotMappedEnterpriseFolders(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((SystemFile[])(results[0]));
}
/// <remarks/>
public void GetNotMappedEnterpriseFoldersAsync(int itemId)
{
this.GetNotMappedEnterpriseFoldersAsync(itemId, null);
}
/// <remarks/>
public void GetNotMappedEnterpriseFoldersAsync(int itemId, object userState)
{
if ((this.GetNotMappedEnterpriseFoldersOperationCompleted == null))
{
this.GetNotMappedEnterpriseFoldersOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetNotMappedEnterpriseFoldersOperationCompleted);
}
this.InvokeAsync("GetNotMappedEnterpriseFolders", new object[] {
itemId}, this.GetNotMappedEnterpriseFoldersOperationCompleted, userState);
}
private void OnGetNotMappedEnterpriseFoldersOperationCompleted(object arg)
{
if ((this.GetNotMappedEnterpriseFoldersCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetNotMappedEnterpriseFoldersCompleted(this, new GetNotMappedEnterpriseFoldersCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
public new void CancelAsync(object userState)
{
@ -1609,4 +1906,154 @@ namespace WebsitePanel.EnterpriseServer
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void CreateMappedDriveCompletedEventHandler(object sender, CreateMappedDriveCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class CreateMappedDriveCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal CreateMappedDriveCompletedEventArgs(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]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void DeleteMappedDriveCompletedEventHandler(object sender, DeleteMappedDriveCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class DeleteMappedDriveCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal DeleteMappedDriveCompletedEventArgs(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]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetDriveMapsPagedCompletedEventHandler(object sender, GetDriveMapsPagedCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetDriveMapsPagedCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal GetDriveMapsPagedCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public MappedDrivesPaged Result
{
get
{
this.RaiseExceptionIfNecessary();
return ((MappedDrivesPaged)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetUsedDriveLettersCompletedEventHandler(object sender, GetUsedDriveLettersCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetUsedDriveLettersCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal GetUsedDriveLettersCompletedEventArgs(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 GetNotMappedEnterpriseFoldersCompletedEventHandler(object sender, GetNotMappedEnterpriseFoldersCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetNotMappedEnterpriseFoldersCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal GetNotMappedEnterpriseFoldersCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public SystemFile[] Result
{
get
{
this.RaiseExceptionIfNecessary();
return ((SystemFile[])(this.results[0]));
}
}
}
}

View file

@ -305,7 +305,7 @@ namespace WebsitePanel.EnterpriseServer
EnterpriseStorageController.DeleteWebDavDirectory(packageId, usersDomain, org.OrganizationId);
EnterpriseStorageController.DeleteFolder(itemId);
EnterpriseStorageController.DeleteMappedDrivesGPO(itemId);
}
}
catch (Exception ex)
@ -577,6 +577,12 @@ namespace WebsitePanel.EnterpriseServer
es.DeleteFolder(org.OrganizationId, folderName, webDavSetting);
string path = string.Format(@"\\{0}@SSL\{1}\{2}", webDavSetting.Domain.Split('.')[0], org.OrganizationId, folderName);
Organizations orgProxy = OrganizationController.GetOrganizationProxy(org.ServiceId);
orgProxy.DeleteMappedDriveByPath(org.OrganizationId, path);
DataProvider.DeleteEnterpriseFolder(itemId, folderName);
}
catch (Exception ex)
@ -659,6 +665,21 @@ namespace WebsitePanel.EnterpriseServer
List<SystemFile> folders = es.GetFolders(org.OrganizationId, webDavSettings).Where(x => x.Name.Contains(filterValue)).ToList();
Organizations orgProxy = OrganizationController.GetOrganizationProxy(org.ServiceId);
List<MappedDrive> mappedDrives = orgProxy.GetDriveMaps(org.OrganizationId).ToList();
foreach (MappedDrive drive in mappedDrives)
{
foreach (SystemFile folder in folders)
{
if (drive.Path.Split('\\').Last() == folder.Name)
{
folder.DriveLetter = drive.DriveLetter;
}
}
}
switch (sortColumn)
{
case "Size":
@ -786,6 +807,8 @@ namespace WebsitePanel.EnterpriseServer
DataProvider.GetEnterpriseFolder(itemId, folder));
es.SetFolderWebDavRules(org.OrganizationId, folder, webDavSetting, rules);
EnterpriseStorageController.SetDriveMapsTargetingFilter(org, permission, folder);
}
catch (Exception ex)
{
@ -890,6 +913,7 @@ namespace WebsitePanel.EnterpriseServer
|| account.AccountType == ExchangeAccountType.DefaultSecurityGroup)
{
rule.Roles.Add(permission.Account);
permission.IsGroup = true;
}
else
{
@ -1196,5 +1220,331 @@ namespace WebsitePanel.EnterpriseServer
}
#endregion
#region Drive Mapping
public static ResultObject CreateMappedDrive(int packageId, int itemId, string driveLetter, string labelAs, string folderName)
{
return CreateMappedDriveInternal(packageId, itemId, driveLetter, labelAs, folderName);
}
protected static ResultObject CreateMappedDriveInternal(int packageId, int itemId, string driveLetter, string labelAs, string folderName)
{
ResultObject result = TaskManager.StartResultTask<ResultObject>("ENTERPRISE_STORAGE", "CREATE_MAPPED_DRIVE", itemId);
try
{
// load organization
Organization org = OrganizationController.GetOrganization(itemId);
if (org == null)
{
result.IsSuccess = false;
result.AddError("", new NullReferenceException("Organization not found"));
return result;
}
int esServiceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.EnterpriseStorage);
if (esServiceId != 0)
{
var webDavSetting = ObjectUtils.FillObjectFromDataReader<WebDavSetting>(
DataProvider.GetEnterpriseFolder(itemId, folderName));
string path = string.Format(@"\\{0}@SSL\{1}\{2}", webDavSetting.Domain.Split('.')[0], org.OrganizationId, folderName);
Organizations orgProxy = OrganizationController.GetOrganizationProxy(org.ServiceId);
if (orgProxy.CreateMappedDrive(org.OrganizationId, driveLetter, labelAs, path) == 0)
{
var folder = GetFolder(itemId, folderName);
EnterpriseStorageController.SetDriveMapsTargetingFilter(org, ConvertToESPermission(itemId, folder.Rules), folderName);
}
else
{
result.AddError("", new Exception("Organization already has mapped drive for this folder"));
return result;
}
}
}
catch (Exception ex)
{
result.AddError("ENTERPRISE_STORAGE_CREATE_MAPPED_DRIVE", ex);
}
finally
{
if (!result.IsSuccess)
{
TaskManager.CompleteResultTask(result);
}
else
{
TaskManager.CompleteResultTask();
}
}
return result;
}
public static ResultObject DeleteMappedDrive(int itemId, string driveLetter)
{
return DeleteMappedDriveInternal(itemId, driveLetter);
}
protected static ResultObject DeleteMappedDriveInternal(int itemId, string driveLetter)
{
ResultObject result = TaskManager.StartResultTask<ResultObject>("ENTERPRISE_STORAGE", "DELETE_MAPPED_DRIVE", itemId);
try
{
// load organization
Organization org = OrganizationController.GetOrganization(itemId);
if (org == null)
{
result.IsSuccess = false;
result.AddError("", new NullReferenceException("Organization not found"));
return result;
}
Organizations orgProxy = OrganizationController.GetOrganizationProxy(org.ServiceId);
orgProxy.DeleteMappedDrive(org.OrganizationId, driveLetter);
}
catch (Exception ex)
{
result.AddError("ENTERPRISE_STORAGE_DELETE_MAPPED_DRIVE", ex);
}
finally
{
if (!result.IsSuccess)
{
TaskManager.CompleteResultTask(result);
}
else
{
TaskManager.CompleteResultTask();
}
}
return result;
}
public static MappedDrivesPaged GetDriveMapsPaged(int itemId, string filterValue, string sortColumn, int startRow, int maximumRows)
{
return GetDriveMapsPagedInternal(itemId, filterValue, sortColumn, startRow, maximumRows);
}
protected static MappedDrivesPaged GetDriveMapsPagedInternal(int itemId, string filterValue, string sortColumn, int startRow, int maximumRows)
{
MappedDrivesPaged result = new MappedDrivesPaged();
try
{
// load organization
Organization org = OrganizationController.GetOrganization(itemId);
if (org == null)
{
return null;
}
EnterpriseStorage es = GetEnterpriseStorage(GetEnterpriseStorageServiceID(org.PackageId));
var webDavSettings = ObjectUtils.CreateListFromDataReader<WebDavSetting>(
DataProvider.GetEnterpriseFolders(itemId)).ToArray();
List<SystemFile> folders = es.GetFolders(org.OrganizationId, webDavSettings).ToList();
Organizations orgProxy = OrganizationController.GetOrganizationProxy(org.ServiceId);
List<MappedDrive> mappedDrives = orgProxy.GetDriveMaps(org.OrganizationId).Where(x => x.LabelAs.Contains(filterValue)).ToList();
List<MappedDrive> resultItems = new List<MappedDrive>();
foreach (MappedDrive drive in mappedDrives)
{
foreach (SystemFile folder in folders)
{
if (drive.Path.Split('\\').Last() == folder.Name)
{
drive.Folder = folder;
resultItems.Add(drive);
}
}
}
mappedDrives = resultItems;
switch (sortColumn)
{
case "Label":
mappedDrives = mappedDrives.OrderBy(x => x.LabelAs).ToList();
break;
default:
mappedDrives = mappedDrives.OrderBy(x => x.DriveLetter).ToList();
break;
}
result.RecordsCount = mappedDrives.Count;
result.PageItems = mappedDrives.Skip(startRow).Take(maximumRows).ToArray();
}
catch (Exception ex) { throw ex; }
return result;
}
public static string[] GetUsedDriveLetters(int itemId)
{
return GetUsedDriveLettersInternal(itemId);
}
protected static string[] GetUsedDriveLettersInternal(int itemId)
{
List<string> driveLetters = new List<string>();
try
{
// load organization
Organization org = OrganizationController.GetOrganization(itemId);
if (org == null)
{
return null;
}
Organizations orgProxy = OrganizationController.GetOrganizationProxy(org.ServiceId);
driveLetters = orgProxy.GetDriveMaps(org.OrganizationId).Select(x => x.DriveLetter).ToList();
}
catch (Exception ex) { throw ex; }
return driveLetters.ToArray();
}
public static SystemFile[] GetNotMappedEnterpriseFolders(int itemId)
{
return GetNotMappedEnterpriseFoldersInternal(itemId);
}
protected static SystemFile[] GetNotMappedEnterpriseFoldersInternal(int itemId)
{
List<SystemFile> folders = new List<SystemFile>();
try
{
// load organization
Organization org = OrganizationController.GetOrganization(itemId);
if (org == null)
{
return null;
}
if (CheckUsersDomainExistsInternal(itemId, org.PackageId))
{
EnterpriseStorage es = GetEnterpriseStorage(GetEnterpriseStorageServiceID(org.PackageId));
var webDavSettings = ObjectUtils.CreateListFromDataReader<WebDavSetting>(
DataProvider.GetEnterpriseFolders(itemId)).ToArray();
folders = es.GetFolders(org.OrganizationId, webDavSettings).ToList();
Organizations orgProxy = OrganizationController.GetOrganizationProxy(org.ServiceId);
List<MappedDrive> drives = orgProxy.GetDriveMaps(org.OrganizationId).ToList();
foreach (MappedDrive drive in drives)
{
foreach (SystemFile folder in folders)
{
if (drive.Path.Split('\\').Last() == folder.Name)
{
folders.Remove(folder);
break;
}
}
}
}
}
catch (Exception ex) { throw ex; }
return folders.ToArray();
}
private static ResultObject SetDriveMapsTargetingFilter(Organization org, ESPermission[] permissions, string folderName)
{
ResultObject result = TaskManager.StartResultTask<ResultObject>("ENTERPRISE_STORAGE", "SET_MAPPED_DRIVE_TARGETING_FILTER");
try
{
Organizations orgProxy = OrganizationController.GetOrganizationProxy(org.ServiceId);
List<ExchangeAccount> accounts = new List<ExchangeAccount>();
foreach (var permission in permissions)
{
accounts.Add(ObjectUtils.FillObjectFromDataReader<ExchangeAccount>(DataProvider.GetExchangeAccountByAccountName(org.Id, permission.Account)));
}
orgProxy.SetDriveMapsTargetingFilter(org.OrganizationId, accounts.ToArray(), folderName);
}
catch (Exception ex)
{
result.AddError("ENTERPRISE_STORAGE_SET_MAPPED_DRIVE_TARGETING_FILTER", ex);
}
finally
{
if (!result.IsSuccess)
{
TaskManager.CompleteResultTask(result);
}
else
{
TaskManager.CompleteResultTask();
}
}
return result;
}
private static ResultObject DeleteMappedDrivesGPO(int itemId)
{
ResultObject result = TaskManager.StartResultTask<ResultObject>("ENTERPRISE_STORAGE", "DELETE_MAPPED_DRIVES_GPO", itemId);
try
{
// load organization
Organization org = OrganizationController.GetOrganization(itemId);
if (org == null)
{
result.IsSuccess = false;
result.AddError("", new NullReferenceException("Organization not found"));
return result;
}
Organizations orgProxy = OrganizationController.GetOrganizationProxy(org.ServiceId);
orgProxy.DeleteMappedDrivesGPO(org.OrganizationId);
}
catch (Exception ex)
{
result.AddError("ENTERPRISE_STORAGE_DELETE_MAPPED_DRIVES_GPO", ex);
}
finally
{
if (!result.IsSuccess)
{
TaskManager.CompleteResultTask(result);
}
else
{
TaskManager.CompleteResultTask();
}
}
return result;
}
#endregion
}
}

View file

@ -174,5 +174,39 @@ namespace WebsitePanel.EnterpriseServer
}
#endregion
#region Drive Mapping
[WebMethod]
public ResultObject CreateMappedDrive(int packageId, int itemId, string driveLetter, string labelAs, string folderName)
{
return EnterpriseStorageController.CreateMappedDrive(packageId, itemId, driveLetter, labelAs, folderName);
}
[WebMethod]
public ResultObject DeleteMappedDrive(int itemId, string driveLetter)
{
return EnterpriseStorageController.DeleteMappedDrive(itemId, driveLetter);
}
[WebMethod]
public MappedDrivesPaged GetDriveMapsPaged(int itemId, string filterValue, string sortColumn, int startRow, int maximumRows)
{
return EnterpriseStorageController.GetDriveMapsPaged(itemId, filterValue, sortColumn, startRow, maximumRows);
}
[WebMethod]
public string[] GetUsedDriveLetters(int itemId)
{
return EnterpriseStorageController.GetUsedDriveLetters(itemId);
}
[WebMethod]
public SystemFile[] GetNotMappedEnterpriseFolders(int itemId)
{
return EnterpriseStorageController.GetNotMappedEnterpriseFolders(itemId);
}
#endregion
}
}

View file

@ -32,5 +32,6 @@ namespace WebsitePanel.Providers.HostedSolution
{
public const int OK = 0;
public const int AD_OBJECT_ALREADY_EXISTS = -1;
public const int MAPPED_DRIVE_ALREADY_EXISTS = -2;
}
}

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.
using WebsitePanel.Providers.OS;
using WebsitePanel.Providers.ResultObjects;
namespace WebsitePanel.Providers.HostedSolution
@ -78,5 +79,17 @@ namespace WebsitePanel.Providers.HostedSolution
string GetSamAccountNameByUserPrincipalName(string organizationId, string userPrincipalName);
bool DoesSamAccountNameExist(string accountName);
MappedDrive[] GetDriveMaps(string organizationId);
int CreateMappedDrive(string organizationId, string drive, string labelAs, string path);
void DeleteMappedDrive(string organizationId, string drive);
void DeleteMappedDriveByPath(string organizationId, string path);
void DeleteMappedDrivesGPO(string organizationId);
void SetDriveMapsTargetingFilter(string organizationId, ExchangeAccount[] accounts, string folderName);
}
}

View file

@ -0,0 +1,80 @@
// Copyright (c) 2014, 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.
using System;
namespace WebsitePanel.Providers.OS
{
/// <summary>
/// Summary description for MappedDrive.
/// </summary>
[Serializable]
public class MappedDrive
{
private string path;
private string labelAs;
private string driveLetter;
private SystemFile folder;
public MappedDrive()
{
}
public MappedDrive(string path, string labelAs, string driveLetter)
{
this.Path = path;
this.LabelAs = labelAs;
this.DriveLetter = driveLetter;
SystemFile folder = null;
}
public string Path
{
get { return this.path; }
set { this.path = value; }
}
public string LabelAs
{
get { return this.labelAs; }
set { this.labelAs = value; }
}
public string DriveLetter
{
get { return this.driveLetter; }
set { this.driveLetter = value; }
}
public SystemFile Folder
{
get { return this.folder; }
set { this.folder = value; }
}
}
}

View file

@ -0,0 +1,20 @@
namespace WebsitePanel.Providers.OS
{
public class MappedDrivesPaged
{
int recordsCount;
MappedDrive[] pageItems;
public int RecordsCount
{
get { return this.recordsCount; }
set { this.recordsCount = value; }
}
public MappedDrive[] PageItems
{
get { return this.pageItems; }
set { this.pageItems = value; }
}
}
}

View file

@ -49,6 +49,7 @@ namespace WebsitePanel.Providers.OS
private int fsrmQuotaMB;
private int frsmQuotaGB;
private QuotaType fsrmQuotaType = QuotaType.Soft;
private string driveLetter;
public SystemFile()
{
@ -142,5 +143,11 @@ namespace WebsitePanel.Providers.OS
get { return this.url; }
set { this.url = value; }
}
public string DriveLetter
{
get { return this.driveLetter; }
set { this.driveLetter = value; }
}
}
}

View file

@ -117,6 +117,8 @@
<Compile Include="HostedSolution\LyncVoicePolicyType.cs" />
<Compile Include="HostedSolution\OrganizationSecurityGroup.cs" />
<Compile Include="HostedSolution\TransactionAction.cs" />
<Compile Include="OS\MappedDrivesPaged.cs" />
<Compile Include="OS\MappedDrive.cs" />
<Compile Include="OS\Quota.cs" />
<Compile Include="OS\QuotaType.cs" />
<Compile Include="OS\SystemFilesPaged.cs" />

View file

@ -27,17 +27,35 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.IO;
using System.Xml;
using System.Linq;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.DirectoryServices;
using System.Globalization;
using System.Text;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.ResultObjects;
using WebsitePanel.Providers.OS;
namespace WebsitePanel.Providers.HostedSolution
{
public class OrganizationProvider : HostingServiceProviderBase, IOrganization
{
#region Constants
private const string GROUP_POLICY_MAPPED_DRIVES_FILE_PATH_TEMPLATE = @"\\{0}\SYSVOL\{0}\Policies\{1}\User\Preferences\Drives";
private const string DRIVES_CLSID = "{8FDDCC1A-0C3C-43cd-A6B4-71A6DF20DA8C}";
private const string DRIVE_CLSID = "{935D1B74-9CB8-4e3c-9914-7DD559B7A417}";
#endregion
#region Properties
private string RootOU
@ -61,6 +79,36 @@ namespace WebsitePanel.Providers.HostedSolution
#region Helpers
private string GetObjectTargetAccountName(string accountName, string domain)
{
string part = domain.Split('.')[0].ToUpperInvariant();
return string.Format("{0}\\{1}", part, accountName);
}
private string GetOrganizationTargetPath(string organizationId)
{
StringBuilder sb = new StringBuilder();
// append provider
AppendOUPath(sb, organizationId);
AppendOUPath(sb, RootOU);
AppendDomainPath(sb, RootDomain);
return sb.ToString();
}
private string GetObjectTargetPath(string organizationId, string objName)
{
StringBuilder sb = new StringBuilder();
// append provider
AppendCNPath(sb, objName);
AppendOUPath(sb, organizationId);
AppendOUPath(sb, RootOU);
AppendDomainPath(sb, RootDomain);
return sb.ToString();
}
private string GetOrganizationPath(string organizationId)
{
StringBuilder sb = new StringBuilder();
@ -1097,6 +1145,702 @@ namespace WebsitePanel.Providers.HostedSolution
#endregion
#region Drive Mapping
public MappedDrive[] GetDriveMaps(string organizationId)
{
return GetDriveMapsInternal(organizationId);
}
internal MappedDrive[] GetDriveMapsInternal(string organizationId)
{
HostedSolutionLog.LogStart("GetDriveMapsInternal");
HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId);
if (string.IsNullOrEmpty(organizationId))
throw new ArgumentNullException("organizationId");
string gpoId;
if (!CheckMappedDriveGpoExists(organizationId, out gpoId))
{
CreateAndLinkMappedDrivesGPO(organizationId, out gpoId);
}
ArrayList items = new ArrayList();
if (!string.IsNullOrEmpty(gpoId))
{
string path = string.Format("{0}\\{1}",
string.Format(GROUP_POLICY_MAPPED_DRIVES_FILE_PATH_TEMPLATE, RootDomain, gpoId),
"Drives.xml");
// open xml document
XmlDocument xml = new XmlDocument();
xml.Load(path);
HostedSolutionLog.LogEnd("GetDriveMapsInternal");
return GetDrivesFromXML(xml, items);
}
HostedSolutionLog.LogEnd("GetDriveMapsInternal");
return (MappedDrive[])items.ToArray(typeof(MappedDrive));
}
public int CreateMappedDrive(string organizationId, string drive, string labelAs, string path)
{
return CreateMappedDriveInternal(organizationId, drive, labelAs, path);
}
internal int CreateMappedDriveInternal(string organizationId, string drive, string labelAs, string path)
{
HostedSolutionLog.LogStart("CreateMappedDriveInternal");
HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId);
HostedSolutionLog.DebugInfo("driveLetter : {0}:", drive);
if (string.IsNullOrEmpty(organizationId))
throw new ArgumentNullException("organizationId");
if (string.IsNullOrEmpty(drive))
throw new ArgumentNullException("driveLetter");
string gpoId;
if (!CheckMappedDriveGpoExists(organizationId, out gpoId))
{
CreateAndLinkMappedDrivesGPO(organizationId, out gpoId);
}
if (CheckMappedDriveExists(organizationId, path))
{
return Errors.MAPPED_DRIVE_ALREADY_EXISTS;
}
if (!string.IsNullOrEmpty(gpoId))
{
string drivesXmlPath = string.Format("{0}\\{1}",
string.Format(GROUP_POLICY_MAPPED_DRIVES_FILE_PATH_TEMPLATE, RootDomain, gpoId),
"Drives.xml");
// open xml document
XmlDocument xml = new XmlDocument();
xml.Load(drivesXmlPath);
XmlNode drivesNode = xml.SelectSingleNode("(/*)");
XmlNode driveNode = CreateDriveNode(xml, drive, labelAs, path);
drivesNode.AppendChild(driveNode);
xml.Save(drivesXmlPath);
}
HostedSolutionLog.LogEnd("CreateMappedDriveInternal");
return Errors.OK;
}
public void DeleteMappedDriveByPath(string organizationId, string path)
{
DeleteMappedDriveByPathInternal(organizationId, path);
}
internal void DeleteMappedDriveByPathInternal(string organizationId, string path)
{
MappedDrive drive = GetDriveMaps(organizationId).Where(x => x.Path == path).FirstOrDefault();
if (drive != null)
{
DeleteMappedDriveInternal(organizationId, drive.DriveLetter);
}
}
public void DeleteMappedDrive(string organizationId, string drive)
{
DeleteMappedDriveInternal(organizationId, drive);
}
internal void DeleteMappedDriveInternal(string organizationId, string drive)
{
HostedSolutionLog.LogStart("DeleteMappedDriveInternal");
HostedSolutionLog.DebugInfo("driveLetter : {0}:", drive);
HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId);
if (string.IsNullOrEmpty(organizationId))
throw new ArgumentNullException("organizationId");
if (string.IsNullOrEmpty(drive))
throw new ArgumentNullException("driveLetter");
string gpoId;
if (!CheckMappedDriveGpoExists(organizationId, out gpoId))
{
CreateAndLinkMappedDrivesGPO(organizationId, out gpoId);
}
if (!string.IsNullOrEmpty(gpoId))
{
string path = string.Format("{0}\\{1}",
string.Format(GROUP_POLICY_MAPPED_DRIVES_FILE_PATH_TEMPLATE, RootDomain, gpoId),
"Drives.xml");
// open xml document
XmlDocument xml = new XmlDocument();
xml.Load(path);
XmlNode x = xml.SelectSingleNode(string.Format("/Drives/Drive[@name='{0}:']", drive));
if (x != null)
{
x.ParentNode.RemoveChild(x);
}
xml.Save(path);
}
HostedSolutionLog.LogEnd("DeleteMappedDriveInternal");
}
public void DeleteMappedDrivesGPO(string organizationId)
{
DeleteMappedDrivesGPOInternal(organizationId);
}
internal void DeleteMappedDrivesGPOInternal(string organizationId)
{
HostedSolutionLog.LogStart("DeleteMappedDrivesGPOInternal");
HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId);
Runspace runSpace = null;
try
{
runSpace = OpenRunspace();
ImportGroupPolicyMolude(runSpace);
string gpoName = string.Format("{0}-mapped-drives", organizationId);
//create new gpo
Command cmd = new Command("Remove-GPO");
cmd.Parameters.Add("Name", gpoName);
ExecuteShellCommand(runSpace, cmd);
}
catch (Exception ex)
{
CloseRunspace(runSpace);
}
finally
{
CloseRunspace(runSpace);
HostedSolutionLog.LogEnd("DeleteMappedDrivesGPOInternal");
}
}
public void SetDriveMapsTargetingFilter(string organizationId, ExchangeAccount[] accounts, string folderName)
{
SetDriveMapsTargetingFilterInternal(organizationId, accounts, folderName);
}
internal void SetDriveMapsTargetingFilterInternal(string organizationId, ExchangeAccount[] accounts, string folderName)
{
HostedSolutionLog.LogStart("SetDriveMapsTargetingFilterInternal");
HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId);
HostedSolutionLog.DebugInfo("folderName : {0}", folderName);
if (string.IsNullOrEmpty(organizationId))
throw new ArgumentNullException("organizationId");
if (string.IsNullOrEmpty(folderName))
throw new ArgumentNullException("folderName");
Runspace runSpace = null;
try
{
runSpace = OpenRunspace();
//import grouppolicy module
ImportGroupPolicyMolude(runSpace);
Dictionary<string, ExchangeAccount> sidAccountPairs = new Dictionary<string, ExchangeAccount>();
Command cmd;
foreach (var account in accounts)
{
string pathObj = GetObjectTargetPath(organizationId, account.AccountName);
if (IsGroup(account))
{
//get group sid
cmd = new Command("Get-ADGroup");
cmd.Parameters.Add("SearchBase", pathObj);
cmd.Parameters.Add("Filter", "*");
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd);
if (result != null && result.Count > 0)
{
PSObject group = result[0];
sidAccountPairs.Add(GetPSObjectProperty(group, "SID").ToString(), account);
}
}
else
{
//get user sid
cmd = new Command("Get-ADUser");
cmd.Parameters.Add("SearchBase", pathObj);
cmd.Parameters.Add("Filter", "*");
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd);
if (result != null && result.Count > 0)
{
PSObject user = result[0];
sidAccountPairs.Add(GetPSObjectProperty(user, "SID").ToString(), account);
}
}
}
string gpoId;
if (!CheckMappedDriveGpoExists(organizationId, out gpoId))
{
CreateAndLinkMappedDrivesGPO(organizationId, out gpoId);
}
if (!string.IsNullOrEmpty(gpoId))
{
string drivesXmlPath = string.Format("{0}\\{1}",
string.Format(GROUP_POLICY_MAPPED_DRIVES_FILE_PATH_TEMPLATE, RootDomain, gpoId),
"Drives.xml");
// open xml document
XmlDocument xml = new XmlDocument();
xml.Load(drivesXmlPath);
XmlNodeList drives = xml.SelectNodes(string.Format("./Drives/Drive[contains(Properties/@path,'{0}')]", folderName));
foreach (XmlNode driveNode in drives)
{
XmlNodeList childNodes = driveNode.ChildNodes;
if (childNodes.Count > 1)
{
//delete existing filters
driveNode.LastChild.ParentNode.RemoveChild(driveNode.LastChild);
}
XmlNode newFiltersNode = CreateFiltersNode(xml, sidAccountPairs);
driveNode.AppendChild(newFiltersNode);
}
xml.Save(drivesXmlPath);
}
}
catch (Exception ex)
{
}
finally
{
CloseRunspace(runSpace);
HostedSolutionLog.LogEnd("SetDriveMapsTargetingFilterInternal");
}
}
private void CreateAndLinkMappedDrivesGPO(string organizationId, out string gpoId)
{
Runspace runSpace = null;
try
{
runSpace = OpenRunspace();
ImportGroupPolicyMolude(runSpace);
string gpoName = string.Format("{0}-mapped-drives", organizationId);
string pathOU = GetOrganizationTargetPath(organizationId);
//create new gpo
Command cmd = new Command("New-GPO");
cmd.Parameters.Add("Name", gpoName);
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd);
gpoId = null;
if (result != null && result.Count > 0)
{
PSObject gpo = result[0];
//get gpo id
gpoId = ((Guid)GetPSObjectProperty(gpo, "Id")).ToString("B");
}
//create gpo link
cmd = new Command("New-GPLink");
cmd.Parameters.Add("Name", gpoName);
cmd.Parameters.Add("Target", pathOU);
ExecuteShellCommand(runSpace, cmd);
//create empty drives.xml file for for gpo drives mapping
CreateDrivesXmlEmpty(string.Format(GROUP_POLICY_MAPPED_DRIVES_FILE_PATH_TEMPLATE, RootDomain, gpoId), "Drives.xml");
}
catch (Exception ex)
{
gpoId = null;
CloseRunspace(runSpace);
}
finally
{
CloseRunspace(runSpace);
}
}
private bool CheckMappedDriveGpoExists(string organizationId, out string gpoId)
{
Runspace runSpace = null;
try
{
runSpace = OpenRunspace();
ImportGroupPolicyMolude(runSpace);
string gpoName = string.Format("{0}-mapped-drives", organizationId);
Command cmd = new Command("Get-GPO");
cmd.Parameters.Add("Name", gpoName);
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd);
gpoId = null;
if (result != null && result.Count > 0)
{
PSObject gpo = result[0];
gpoId = ((Guid)GetPSObjectProperty(gpo, "Id")).ToString("B");
}
}
finally
{
CloseRunspace(runSpace);
}
return string.IsNullOrEmpty(gpoId) ? false : true;
}
private bool CheckMappedDriveExists(string organizationId, string path)
{
bool exists = false;
MappedDrive[] drives = GetDriveMapsInternal(organizationId);
foreach (var item in drives)
{
if (item.Path == path)
{
exists = true;
break;
}
}
return exists;
}
#region Drive Mapping Helpers
private void ImportGroupPolicyMolude(Runspace runSpace)
{
Command cmd = new Command("Import-Module");
cmd.Parameters.Add("Name", "grouppolicy");
ExecuteShellCommand(runSpace, cmd);
}
private void CreateDrivesXmlEmpty(string path, string fileName)
{
DirectoryInfo drivesDirectory = new DirectoryInfo(path);
if (!drivesDirectory.Exists)
{
drivesDirectory.Create();
}
XmlDocument doc = new XmlDocument();
XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
doc.AppendChild(docNode);
XmlNode drivesNode = doc.CreateElement("Drives");
XmlAttribute drivesAttribute = doc.CreateAttribute("clsid");
drivesAttribute.Value = DRIVES_CLSID;
drivesNode.Attributes.Append(drivesAttribute);
doc.AppendChild(drivesNode);
doc.Save(string.Format("{0}\\{1}", path, fileName));
}
private XmlNode CreateDriveNode(XmlDocument xml, string drive, string labelAs, string path)
{
XmlNode driveNode = xml.CreateElement("Drive");
XmlNode propertiesNode = xml.CreateElement("Properties");;
XmlAttribute clsidAttr = xml.CreateAttribute("clsid");
XmlAttribute nameAttr = xml.CreateAttribute("name");
XmlAttribute statusAttr = xml.CreateAttribute("status");
XmlAttribute imageAttr = xml.CreateAttribute("image");
XmlAttribute changedAttr = xml.CreateAttribute("changed");
XmlAttribute uidAttr = xml.CreateAttribute("uid");
XmlAttribute bypassErrorsAttr = xml.CreateAttribute("bypassErrors");
XmlAttribute actionPropAttr = xml.CreateAttribute("action");
XmlAttribute thisDrivePropAttr = xml.CreateAttribute("thisDrive");
XmlAttribute allDrivesPropAttr = xml.CreateAttribute("allDrives");
XmlAttribute userNamePropAttr = xml.CreateAttribute("userName");
XmlAttribute pathPropAttr = xml.CreateAttribute("path");
XmlAttribute labelPropAttr = xml.CreateAttribute("label");
XmlAttribute persistentPropAttr = xml.CreateAttribute("persistent");
XmlAttribute useLetterPropAttr = xml.CreateAttribute("useLetter");
XmlAttribute letterPropAttr = xml.CreateAttribute("letter");
clsidAttr.Value = DRIVE_CLSID;
nameAttr.Value = string.Format("{0}:", drive);
statusAttr.Value = string.Format("{0}:", drive);
imageAttr.Value = (1).ToString();
changedAttr.Value = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
uidAttr.Value = Guid.NewGuid().ToString("B");
bypassErrorsAttr.Value = (1).ToString();
actionPropAttr.Value = "R";
thisDrivePropAttr.Value = "NOCHANGE";
allDrivesPropAttr.Value = "NOCHANGE";
userNamePropAttr.Value = string.Empty;
pathPropAttr.Value = path;
labelPropAttr.Value = labelAs;
persistentPropAttr.Value = (1).ToString();
useLetterPropAttr.Value = (1).ToString();
letterPropAttr.Value = drive;
driveNode.Attributes.Append(clsidAttr);
driveNode.Attributes.Append(nameAttr);
driveNode.Attributes.Append(statusAttr);
driveNode.Attributes.Append(imageAttr);
driveNode.Attributes.Append(changedAttr);
driveNode.Attributes.Append(uidAttr);
driveNode.Attributes.Append(bypassErrorsAttr);
propertiesNode.Attributes.Append(actionPropAttr);
propertiesNode.Attributes.Append(thisDrivePropAttr);
propertiesNode.Attributes.Append(allDrivesPropAttr);
propertiesNode.Attributes.Append(userNamePropAttr);
propertiesNode.Attributes.Append(pathPropAttr);
propertiesNode.Attributes.Append(labelPropAttr);
propertiesNode.Attributes.Append(persistentPropAttr);
propertiesNode.Attributes.Append(useLetterPropAttr);
propertiesNode.Attributes.Append(letterPropAttr);
driveNode.AppendChild(propertiesNode);
return driveNode;
}
private XmlNode CreateFiltersNode(XmlDocument xml, Dictionary<string, ExchangeAccount> accounts)
{
XmlNode filtersNode = xml.CreateElement("Filters");
foreach (var pair in accounts)
{
XmlAttribute boolAttr = xml.CreateAttribute("bool");
XmlAttribute notAttr = xml.CreateAttribute("not");
XmlAttribute userContextAttr = xml.CreateAttribute("userContext");
XmlAttribute primaryGroupAttr = xml.CreateAttribute("primaryGroup");
XmlAttribute localGroupAttr = xml.CreateAttribute("localGroup");
XmlAttribute nameAttr = xml.CreateAttribute("name");
XmlAttribute sidAttr = xml.CreateAttribute("sid");
boolAttr.Value = "AND";
notAttr.Value = (0).ToString();
userContextAttr.Value = (1).ToString();
primaryGroupAttr.Value = (0).ToString();
localGroupAttr.Value = (0).ToString();
if (IsGroup(pair.Value))
{
XmlNode filterGroupNode = xml.CreateElement("FilterGroup");
nameAttr.Value = GetObjectTargetAccountName(pair.Value.AccountName, RootDomain);
sidAttr.Value = pair.Key;
filterGroupNode.Attributes.Append(boolAttr);
filterGroupNode.Attributes.Append(notAttr);
filterGroupNode.Attributes.Append(nameAttr);
filterGroupNode.Attributes.Append(sidAttr);
filterGroupNode.Attributes.Append(userContextAttr);
filterGroupNode.Attributes.Append(primaryGroupAttr);
filterGroupNode.Attributes.Append(localGroupAttr);
filtersNode.AppendChild(filterGroupNode);
}
else
{
XmlNode filterUserNode = xml.CreateElement("FilterUser");
nameAttr.Value = GetObjectTargetAccountName(pair.Value.AccountName, RootDomain);
sidAttr.Value = pair.Key;
filterUserNode.Attributes.Append(boolAttr);
filterUserNode.Attributes.Append(notAttr);
filterUserNode.Attributes.Append(nameAttr);
filterUserNode.Attributes.Append(sidAttr);
filtersNode.AppendChild(filterUserNode);
}
}
return filtersNode;
}
private MappedDrive[] GetDrivesFromXML(XmlDocument xml, ArrayList items)
{
XmlNodeList drives = xml.SelectNodes("./Drives/Drive");
foreach (XmlNode driveNode in drives)
{
XmlNode props = driveNode.ChildNodes[0];
MappedDrive item = new MappedDrive(props.Attributes["path"].Value,
props.Attributes["label"].Value,
props.Attributes["letter"].Value);
items.Add(item);
}
return (MappedDrive[])items.ToArray(typeof(MappedDrive));
}
private bool IsGroup(ExchangeAccount account)
{
return (account.AccountType == ExchangeAccountType.SecurityGroup || account.AccountType == ExchangeAccountType.DefaultSecurityGroup);
}
#endregion
#endregion
#region PowerShell integration
private static RunspaceConfiguration runspaceConfiguration = null;
internal virtual Runspace OpenRunspace()
{
HostedSolutionLog.LogStart("OpenRunspace");
if (runspaceConfiguration == null)
{
runspaceConfiguration = RunspaceConfiguration.Create();
}
Runspace runSpace = RunspaceFactory.CreateRunspace(runspaceConfiguration);
//
runSpace.Open();
//
runSpace.SessionStateProxy.SetVariable("ConfirmPreference", "none");
HostedSolutionLog.LogEnd("OpenRunspace");
return runSpace;
}
internal void CloseRunspace(Runspace runspace)
{
try
{
if (runspace != null && runspace.RunspaceStateInfo.State == RunspaceState.Opened)
{
runspace.Close();
}
}
catch (Exception ex)
{
HostedSolutionLog.LogError("Runspace error", ex);
}
}
internal Collection<PSObject> ExecuteShellCommand(Runspace runSpace, Command cmd)
{
return ExecuteShellCommand(runSpace, cmd, false);
}
internal Collection<PSObject> ExecuteShellCommand(Runspace runSpace, Command cmd, bool useDomainController)
{
object[] errors;
return ExecuteShellCommand(runSpace, cmd, useDomainController, out errors);
}
internal Collection<PSObject> ExecuteShellCommand(Runspace runSpace, Command cmd, out object[] errors)
{
return ExecuteShellCommand(runSpace, cmd, true, out errors);
}
internal Collection<PSObject> ExecuteShellCommand(Runspace runSpace, Command cmd, bool useDomainController, out object[] errors)
{
HostedSolutionLog.LogStart("ExecuteShellCommand");
List<object> errorList = new List<object>();
if (useDomainController)
{
CommandParameter dc = new CommandParameter("DomainController", PrimaryDomainController);
if (!cmd.Parameters.Contains(dc))
{
cmd.Parameters.Add(dc);
}
}
HostedSolutionLog.DebugCommand(cmd);
Collection<PSObject> results = null;
// Create a pipeline
Pipeline pipeLine = runSpace.CreatePipeline();
using (pipeLine)
{
// Add the command
pipeLine.Commands.Add(cmd);
// Execute the pipeline and save the objects returned.
results = pipeLine.Invoke();
// Log out any errors in the pipeline execution
// NOTE: These errors are NOT thrown as exceptions!
// Be sure to check this to ensure that no errors
// happened while executing the command.
if (pipeLine.Error != null && pipeLine.Error.Count > 0)
{
foreach (object item in pipeLine.Error.ReadToEnd())
{
errorList.Add(item);
string errorMessage = string.Format("Invoke error: {0}", item);
HostedSolutionLog.LogWarning(errorMessage);
}
}
}
pipeLine = null;
errors = errorList.ToArray();
HostedSolutionLog.LogEnd("ExecuteShellCommand");
return results;
}
internal object GetPSObjectProperty(PSObject obj, string name)
{
return obj.Members[name].Value;
}
#endregion
public override bool IsInstalled()
{
return Environment.UserDomainName != Environment.MachineName;

View file

@ -50,6 +50,7 @@ namespace WebsitePanel.Providers.HostedSolution
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.ResultObjects;
using WebsitePanel.Providers.OS;
@ -105,6 +106,18 @@ namespace WebsitePanel.Providers.HostedSolution
private System.Threading.SendOrPostCallback DoesSamAccountNameExistOperationCompleted;
private System.Threading.SendOrPostCallback GetDriveMapsOperationCompleted;
private System.Threading.SendOrPostCallback CreateMappedDriveOperationCompleted;
private System.Threading.SendOrPostCallback DeleteMappedDriveOperationCompleted;
private System.Threading.SendOrPostCallback DeleteMappedDriveByPathOperationCompleted;
private System.Threading.SendOrPostCallback DeleteMappedDrivesGPOOperationCompleted;
private System.Threading.SendOrPostCallback SetDriveMapsTargetingFilterOperationCompleted;
/// <remarks/>
public Organizations()
{
@ -171,6 +184,24 @@ namespace WebsitePanel.Providers.HostedSolution
/// <remarks/>
public event DoesSamAccountNameExistCompletedEventHandler DoesSamAccountNameExistCompleted;
/// <remarks/>
public event GetDriveMapsCompletedEventHandler GetDriveMapsCompleted;
/// <remarks/>
public event CreateMappedDriveCompletedEventHandler CreateMappedDriveCompleted;
/// <remarks/>
public event DeleteMappedDriveCompletedEventHandler DeleteMappedDriveCompleted;
/// <remarks/>
public event DeleteMappedDriveByPathCompletedEventHandler DeleteMappedDriveByPathCompleted;
/// <remarks/>
public event DeleteMappedDrivesGPOCompletedEventHandler DeleteMappedDrivesGPOCompleted;
/// <remarks/>
public event SetDriveMapsTargetingFilterCompletedEventHandler SetDriveMapsTargetingFilterCompleted;
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/OrganizationExists", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
@ -1414,6 +1445,319 @@ namespace WebsitePanel.Providers.HostedSolution
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetDriveMaps", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public MappedDrive[] GetDriveMaps(string organizationId)
{
object[] results = this.Invoke("GetDriveMaps", new object[] {
organizationId});
return ((MappedDrive[])(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetDriveMaps(string organizationId, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("GetDriveMaps", new object[] {
organizationId}, callback, asyncState);
}
/// <remarks/>
public MappedDrive[] EndGetDriveMaps(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((MappedDrive[])(results[0]));
}
/// <remarks/>
public void GetDriveMapsAsync(string organizationId)
{
this.GetDriveMapsAsync(organizationId, null);
}
/// <remarks/>
public void GetDriveMapsAsync(string organizationId, object userState)
{
if ((this.GetDriveMapsOperationCompleted == null))
{
this.GetDriveMapsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetDriveMapsOperationCompleted);
}
this.InvokeAsync("GetDriveMaps", new object[] {
organizationId}, this.GetDriveMapsOperationCompleted, userState);
}
private void OnGetDriveMapsOperationCompleted(object arg)
{
if ((this.GetDriveMapsCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetDriveMapsCompleted(this, new GetDriveMapsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/CreateMappedDrive", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int CreateMappedDrive(string organizationId, string drive, string labelAs, string path)
{
object[] results = this.Invoke("CreateMappedDrive", new object[] {
organizationId,
drive,
labelAs,
path});
return ((int)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginCreateMappedDrive(string organizationId, string drive, string labelAs, string path, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("CreateMappedDrive", new object[] {
organizationId,
drive,
labelAs,
path}, callback, asyncState);
}
/// <remarks/>
public int EndCreateMappedDrive(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
/// <remarks/>
public void CreateMappedDriveAsync(string organizationId, string drive, string labelAs, string path)
{
this.CreateMappedDriveAsync(organizationId, drive, labelAs, path, null);
}
/// <remarks/>
public void CreateMappedDriveAsync(string organizationId, string drive, string labelAs, string path, object userState)
{
if ((this.CreateMappedDriveOperationCompleted == null))
{
this.CreateMappedDriveOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateMappedDriveOperationCompleted);
}
this.InvokeAsync("CreateMappedDrive", new object[] {
organizationId,
drive,
labelAs,
path}, this.CreateMappedDriveOperationCompleted, userState);
}
private void OnCreateMappedDriveOperationCompleted(object arg)
{
if ((this.CreateMappedDriveCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.CreateMappedDriveCompleted(this, new CreateMappedDriveCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/DeleteMappedDrive", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void DeleteMappedDrive(string organizationId, string drive)
{
this.Invoke("DeleteMappedDrive", new object[] {
organizationId,
drive});
}
/// <remarks/>
public System.IAsyncResult BeginDeleteMappedDrive(string organizationId, string drive, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("DeleteMappedDrive", new object[] {
organizationId,
drive}, callback, asyncState);
}
/// <remarks/>
public void EndDeleteMappedDrive(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void DeleteMappedDriveAsync(string organizationId, string drive)
{
this.DeleteMappedDriveAsync(organizationId, drive, null);
}
/// <remarks/>
public void DeleteMappedDriveAsync(string organizationId, string drive, object userState)
{
if ((this.DeleteMappedDriveOperationCompleted == null))
{
this.DeleteMappedDriveOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteMappedDriveOperationCompleted);
}
this.InvokeAsync("DeleteMappedDrive", new object[] {
organizationId,
drive}, this.DeleteMappedDriveOperationCompleted, userState);
}
private void OnDeleteMappedDriveOperationCompleted(object arg)
{
if ((this.DeleteMappedDriveCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.DeleteMappedDriveCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/DeleteMappedDriveByPath", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void DeleteMappedDriveByPath(string organizationId, string path)
{
this.Invoke("DeleteMappedDriveByPath", new object[] {
organizationId,
path});
}
/// <remarks/>
public System.IAsyncResult BeginDeleteMappedDriveByPath(string organizationId, string path, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("DeleteMappedDriveByPath", new object[] {
organizationId,
path}, callback, asyncState);
}
/// <remarks/>
public void EndDeleteMappedDriveByPath(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void DeleteMappedDriveByPathAsync(string organizationId, string path)
{
this.DeleteMappedDriveByPathAsync(organizationId, path, null);
}
/// <remarks/>
public void DeleteMappedDriveByPathAsync(string organizationId, string path, object userState)
{
if ((this.DeleteMappedDriveByPathOperationCompleted == null))
{
this.DeleteMappedDriveByPathOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteMappedDriveByPathOperationCompleted);
}
this.InvokeAsync("DeleteMappedDriveByPath", new object[] {
organizationId,
path}, this.DeleteMappedDriveByPathOperationCompleted, userState);
}
private void OnDeleteMappedDriveByPathOperationCompleted(object arg)
{
if ((this.DeleteMappedDriveByPathCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.DeleteMappedDriveByPathCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/DeleteMappedDrivesGPO", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void DeleteMappedDrivesGPO(string organizationId)
{
this.Invoke("DeleteMappedDrivesGPO", new object[] {
organizationId});
}
/// <remarks/>
public System.IAsyncResult BeginDeleteMappedDrivesGPO(string organizationId, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("DeleteMappedDrivesGPO", new object[] {
organizationId}, callback, asyncState);
}
/// <remarks/>
public void EndDeleteMappedDrivesGPO(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void DeleteMappedDrivesGPOAsync(string organizationId)
{
this.DeleteMappedDrivesGPOAsync(organizationId, null);
}
/// <remarks/>
public void DeleteMappedDrivesGPOAsync(string organizationId, object userState)
{
if ((this.DeleteMappedDrivesGPOOperationCompleted == null))
{
this.DeleteMappedDrivesGPOOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteMappedDrivesGPOOperationCompleted);
}
this.InvokeAsync("DeleteMappedDrivesGPO", new object[] {
organizationId}, this.DeleteMappedDrivesGPOOperationCompleted, userState);
}
private void OnDeleteMappedDrivesGPOOperationCompleted(object arg)
{
if ((this.DeleteMappedDrivesGPOCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.DeleteMappedDrivesGPOCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/SetDriveMapsTargetingFilter", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void SetDriveMapsTargetingFilter(string organizationId, ExchangeAccount[] accounts, string folderName)
{
this.Invoke("SetDriveMapsTargetingFilter", new object[] {
organizationId,
accounts,
folderName});
}
/// <remarks/>
public System.IAsyncResult BeginSetDriveMapsTargetingFilter(string organizationId, ExchangeAccount[] accounts, string folderName, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("SetDriveMapsTargetingFilter", new object[] {
organizationId,
accounts,
folderName}, callback, asyncState);
}
/// <remarks/>
public void EndSetDriveMapsTargetingFilter(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void SetDriveMapsTargetingFilterAsync(string organizationId, ExchangeAccount[] accounts, string folderName)
{
this.SetDriveMapsTargetingFilterAsync(organizationId, accounts, folderName, null);
}
/// <remarks/>
public void SetDriveMapsTargetingFilterAsync(string organizationId, ExchangeAccount[] accounts, string folderName, object userState)
{
if ((this.SetDriveMapsTargetingFilterOperationCompleted == null))
{
this.SetDriveMapsTargetingFilterOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetDriveMapsTargetingFilterOperationCompleted);
}
this.InvokeAsync("SetDriveMapsTargetingFilter", new object[] {
organizationId,
accounts,
folderName}, this.SetDriveMapsTargetingFilterOperationCompleted, userState);
}
private void OnSetDriveMapsTargetingFilterOperationCompleted(object arg)
{
if ((this.SetDriveMapsTargetingFilterCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.SetDriveMapsTargetingFilterCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
public new void CancelAsync(object userState)
{
@ -1734,4 +2078,80 @@ namespace WebsitePanel.Providers.HostedSolution
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetDriveMapsCompletedEventHandler(object sender, GetDriveMapsCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetDriveMapsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal GetDriveMapsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public MappedDrive[] Result
{
get
{
this.RaiseExceptionIfNecessary();
return ((MappedDrive[])(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void CreateMappedDriveCompletedEventHandler(object sender, CreateMappedDriveCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class CreateMappedDriveCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal CreateMappedDriveCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public int Result
{
get
{
this.RaiseExceptionIfNecessary();
return ((int)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void DeleteMappedDriveCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void DeleteMappedDriveByPathCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void DeleteMappedDrivesGPOCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void SetDriveMapsTargetingFilterCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
}

View file

@ -32,6 +32,7 @@ using System.Web.Services;
using System.Web.Services.Protocols;
using WebsitePanel.Providers;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.OS;
using WebsitePanel.Providers.ResultObjects;
using WebsitePanel.Server.Utils;
@ -205,5 +206,40 @@ namespace WebsitePanel.Server
return Organization.DoesSamAccountNameExist(accountName);
}
[WebMethod, SoapHeader("settings")]
public MappedDrive[] GetDriveMaps(string organizationId)
{
return Organization.GetDriveMaps(organizationId);
}
[WebMethod, SoapHeader("settings")]
public int CreateMappedDrive(string organizationId, string drive, string labelAs, string path)
{
return Organization.CreateMappedDrive(organizationId, drive, labelAs, path);
}
[WebMethod, SoapHeader("settings")]
public void DeleteMappedDrive(string organizationId, string drive)
{
Organization.DeleteMappedDrive(organizationId, drive);
}
[WebMethod, SoapHeader("settings")]
public void DeleteMappedDriveByPath(string organizationId, string path)
{
Organization.DeleteMappedDriveByPath(organizationId, path);
}
[WebMethod, SoapHeader("settings")]
public void DeleteMappedDrivesGPO(string organizationId)
{
Organization.DeleteMappedDrivesGPO(organizationId);
}
[WebMethod, SoapHeader("settings")]
public void SetDriveMapsTargetingFilter(string organizationId, ExchangeAccount[] accounts, string folderName)
{
Organization.SetDriveMapsTargetingFilter(organizationId, accounts, folderName);
}
}
}

View file

@ -556,6 +556,8 @@
<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_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" />
<Control key="lync_phonenumbers" src="WebsitePanel/Lync/LyncPhoneNumbers.ascx" title="LyncPhoneNumbers" type="View" />
<Control key="allocate_phonenumbers" src="WebsitePanel/Lync/LyncAllocatePhoneNumbers.ascx" title="LyncPhoneNumbers" type="View" />

View file

@ -5452,4 +5452,7 @@
<data name="Quota.Exchange2013.ArchivingMailboxes" xml:space="preserve">
<value>Archiving Mailboxes per Organization</value>
</data>
<data name="Quota.EnterpriseStorage.DriveMaps" xml:space="preserve">
<value>Use Drive Maps</value>
</data>
</root>

View file

@ -94,4 +94,5 @@ Default skin template. The following skins are provided as examples only.
<asp:Image SkinID="VLanNetwork" runat="server" ImageUrl="images/VPSForPC/vlan_icon.png" ImageAlign="AbsMiddle" Width="48" Height="48"></asp:Image>
<%-- Enterprise Storage Icons --%>
<asp:Image SkinID="EnterpriseStorageSpace48" runat="server" ImageUrl="images/Exchange/spaces48.png" ImageAlign="AbsMiddle" Width="48" Height="48"></asp:Image>
<asp:Image SkinID="EnterpriseStorageSpace48" runat="server" ImageUrl="images/Exchange/spaces48.png" ImageAlign="AbsMiddle" Width="48" Height="48"></asp:Image>
<asp:Image SkinID="EnterpriseStorageDriveMaps48" runat="server" ImageUrl="images/Exchange/net_drive48.png" ImageAlign="AbsMiddle" Width="48" Height="48"></asp:Image>

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -228,4 +228,7 @@
<data name="Text.RetentionPolicyTag" xml:space="preserve">
<value>Retention Policy Tag</value>
</data>
<data name="Text.EnterpriseStorageDriveMaps" xml:space="preserve">
<value>Drive Maps</value>
</data>
</root>

View file

@ -25,5 +25,27 @@ namespace WebsitePanel.Portal
}
#endregion
#region Drive Maps
MappedDrivesPaged mappedDrives;
public int GetEnterpriseDriveMapsPagedCount(int itemId, string filterValue)
{
return mappedDrives.RecordsCount;
}
public MappedDrive[] GetEnterpriseDriveMapsPaged(int itemId, string filterValue,
int maximumRows, int startRowIndex, string sortColumn)
{
filterValue = filterValue ?? string.Empty;
mappedDrives = ES.Services.EnterpriseStorage.GetDriveMapsPaged(itemId,
filterValue, sortColumn, startRowIndex, maximumRows);
return mappedDrives.PageItems;
}
#endregion
}
}

View file

@ -0,0 +1,162 @@
<?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="btnCreate.OnClientClick" xml:space="preserve">
<value>ShowProgressDialog('Creating drive map ...');</value>
</data>
<data name="btnCreate.Text" xml:space="preserve">
<value>Create Drive Map</value>
</data>
<data name="FormComments.Text" xml:space="preserve">
<value />
</data>
<data name="locDisplayName.Text" xml:space="preserve">
<value>Folder Name: *</value>
</data>
<data name="Text.PageName" xml:space="preserve">
<value>Drive Maps</value>
</data>
<data name="valRequireFolderName.ErrorMessage" xml:space="preserve">
<value>Enter Folder Name</value>
</data>
<data name="valRequireFolderName.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="locTitle" xml:space="preserve">
<value>Create New Drive Map</value>
</data>
<data name="locDriveLabel" xml:space="preserve">
<value>Label As:</value>
</data>
<data name="locFolder" xml:space="preserve">
<value>Storage Folder:</value>
</data>
<data name="rangeFolderSize" xml:space="preserve">
<value>*</value>
</data>
<data name="valRequireFolderSize" xml:space="preserve">
<value>valRequireFolderSize</value>
</data>
<data name="valRequireFolderSize.ErrorMessage" xml:space="preserve">
<value>Enter Folder Size</value>
</data>
<data name="locDriveLetter" xml:space="preserve">
<value>Select Drive Letter:</value>
</data>
</root>

View file

@ -0,0 +1,153 @@
<?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="btnAddDriveMap.Text" xml:space="preserve">
<value>Create New Drive Map</value>
</data>
<data name="cmdDelete.OnClientClick" xml:space="preserve">
<value>if(!confirm('Are you sure you want to delete selected drive map?')) return false; else ShowProgressDialog('Deleting Drive Map...');</value>
</data>
<data name="cmdDelete.Text" xml:space="preserve">
<value>Delete</value>
</data>
<data name="cmdDelete.ToolTip" xml:space="preserve">
<value>Delete Drive Map</value>
</data>
<data name="gvDriveMaps.Empty" xml:space="preserve">
<value>No drive maps have been added yet. To add a new folder click "Create New Drive Map" button.</value>
</data>
<data name="HSFormComments.Text" xml:space="preserve">
<value />
</data>
<data name="Text.PageName" xml:space="preserve">
<value>Drive Maps</value>
</data>
<data name="gvDrive.Header" xml:space="preserve">
<value>Drive</value>
</data>
<data name="locTitle.Text" xml:space="preserve">
<value>Drive Maps</value>
</data>
<data name="gvFolderUrl.Header" xml:space="preserve">
<value>Url</value>
</data>
<data name="gvLabelAs.Header" xml:space="preserve">
<value>Label</value>
</data>
</root>

View file

@ -162,4 +162,7 @@
<data name="locQuotaAvailableSpace.Text" xml:space="preserve">
<value>Used Diskspace (Mb):</value>
</data>
<data name="gvMappedDrive.Header" xml:space="preserve">
<value>Drive Map</value>
</data>
</root>

View file

@ -0,0 +1,74 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EnterpriseStorageCreateDriveMap.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.EnterpriseStorageCreateDriveMap" %>
<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %>
<%@ Register Src="UserControls/EmailAddress.ascx" TagName="EmailAddress" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
<script type="text/javascript" src="/JavaScript/jquery.min.js?v=1.4.4"></script>
<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="imgESDM" SkinID="EnterpriseStorageDriveMaps48" runat="server" />
<asp:Localize ID="locTitle" runat="server" meta:resourcekey="locTitle" Text="Create New Drive Map"></asp:Localize>
</div>
<div class="FormBody">
<wsp:SimpleMessageBox id="messageBox" runat="server" />
<table>
<tr>
<td class="FormLabel150"><asp:Localize ID="locDriveLetter" runat="server" meta:resourcekey="locDriveLetter" Text="Select Drive Letter:"></asp:Localize></td>
<td>
<asp:DropDownList ID="ddlLetters" runat="server" CssClass="NormalTextBox" Width="150px" style="vertical-align: middle;" />
</td>
</tr>
<tr>
<td class="FormLabel150"><asp:Localize ID="locFolder" runat="server" meta:resourcekey="locFolder" Text="Storage Folder:"></asp:Localize></td>
<td>
<div class="Folders" style="display:inline;">
<asp:DropDownList ID="ddlFolders" runat="server" CssClass="NormalTextBox" Width="150px" style="vertical-align: middle;" />
</div>
<div class="Url" style="display:inline;">
<asp:Literal ID="lbFolderUrl" runat="server"></asp:Literal>
</div>
</td>
</tr>
<tr>
<td class="FormLabel150"><asp:Localize ID="locDriveLabel" runat="server" meta:resourcekey="locDriveLabel" Text="Label As:"></asp:Localize></td>
<td>
<div class="LabelAs">
<asp:TextBox ID="txtLabelAs" runat="server" CssClass="NormalTextBox" Width="145px"></asp:TextBox>
</div>
</td>
</tr>
</table>
<div class="FormFooterClean">
<asp:Button id="btnCreate" runat="server" Text="Create Drive Map" CssClass="Button1" meta:resourcekey="btnCreate" ValidationGroup="CreateDriveMap" OnClick="btnCreate_Click"></asp:Button>
<asp:ValidationSummary ID="valSummary" runat="server" ShowMessageBox="True" ShowSummary="False" ValidationGroup="CreateDriveMap" />
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" >
$('document').ready(function () {
$('.LabelAs input').bind('click', function () { $('.LabelAs input').val(""); });
$('.LabelAs input').bind('focusout', function () {
if ($('.LabelAs input').val() == "") {
$('.LabelAs input').val($('.Folders select option:selected').text());
}
});
$('.Folders select').bind('change', function () {
$('.LabelAs input').val($('.Folders select option:selected').text());
$('.Url').text($('.Folders select option:selected').val());
});
});
</script>

View file

@ -0,0 +1,122 @@
// Copyright (c) 2014, 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.
using System;
using System.Web.UI.WebControls;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.OS;
namespace WebsitePanel.Portal.ExchangeServer
{
public partial class EnterpriseStorageCreateDriveMap : WebsitePanelModuleBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindLetters();
BindFolders();
}
if (ddlFolders.Items.Count < 1 || ddlLetters.Items.Count < 1)
{
btnCreate.Enabled = false;
}
}
private void BindFolders()
{
ddlFolders.DataSource = ES.Services.EnterpriseStorage.GetNotMappedEnterpriseFolders(PanelRequest.ItemID);
ddlFolders.DataTextField = "Name";
ddlFolders.DataValueField = "Url";
ddlFolders.DataBind();
if (ddlFolders.Items.Count > 0)
{
txtLabelAs.Text = ddlFolders.SelectedItem.Text;
lbFolderUrl.Text = ddlFolders.SelectedItem.Value;
}
}
private void BindLetters()
{
//for (int i = 65; i < 91; i++) // increment from ASCII values for A-Z
for (int i = 69; i < 91; i++) // E-Z
{
ddlLetters.Items.Add(new ListItem(Convert.ToChar(i).ToString() + ":", Convert.ToChar(i).ToString()));// Add uppercase letters to possible drive letters
}
string[] usedLetters = ES.Services.EnterpriseStorage.GetUsedDriveLetters(PanelRequest.ItemID);
foreach (string elem in usedLetters)
{
ListItem item = new ListItem(elem + ":", elem);
if (ddlLetters.Items.Contains(item))
{
ddlLetters.Items.Remove(item);
}
}
}
protected void btnCreate_Click(object sender, EventArgs e)
{
if (!Page.IsValid)
return;
try
{
if (!ES.Services.EnterpriseStorage.CheckEnterpriseStorageInitialization(PanelSecurity.PackageId, PanelRequest.ItemID))
{
ES.Services.EnterpriseStorage.CreateEnterpriseStorage(PanelSecurity.PackageId, PanelRequest.ItemID);
}
ResultObject result = ES.Services.EnterpriseStorage.CreateMappedDrive(
PanelSecurity.PackageId,
PanelRequest.ItemID,
ddlLetters.SelectedItem.Value,
txtLabelAs.Text,
ddlFolders.SelectedItem.Text);
if (!result.IsSuccess && result.ErrorCodes.Count > 0)
{
messageBox.ShowMessage(result, "ENTERPRISE_STORAGE_CREATE_MAPPED_DRIVE", "Enterprise Storage");
return;
}
Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "enterprisestorage_drive_maps",
"SpaceID=" + PanelSecurity.PackageId));
}
catch (Exception ex)
{
messageBox.ShowErrorMessage("ENTERPRISE_STORAGE_CREATE_MAPPED_DRIVE", 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 EnterpriseStorageCreateDriveMap {
/// <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>
/// imgESDM 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 imgESDM;
/// <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>
/// 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>
/// locDriveLetter 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 locDriveLetter;
/// <summary>
/// ddlLetters 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 ddlLetters;
/// <summary>
/// locFolder 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 locFolder;
/// <summary>
/// ddlFolders 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 ddlFolders;
/// <summary>
/// lbFolderUrl 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 lbFolderUrl;
/// <summary>
/// locDriveLabel 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 locDriveLabel;
/// <summary>
/// txtLabelAs 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 txtLabelAs;
/// <summary>
/// btnCreate 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 btnCreate;
/// <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,90 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EnterpriseStorageDriveMaps.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.EnterpriseStorageDriveMaps" %>
<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" 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="imgESDM" SkinID="EnterpriseStorageDriveMaps48" runat="server" />
<asp:Localize ID="locTitle" runat="server" meta:resourcekey="locTitle" Text="Drive Maps"></asp:Localize>
</div>
<div class="FormBody">
<wsp:SimpleMessageBox id="messageBox" runat="server" />
<div class="FormButtonsBarClean">
<div class="FormButtonsBarCleanLeft">
<asp:Button ID="btnAddDriveMap" runat="server" meta:resourcekey="btnAddDriveMap"
Text="Create New Drive Map" CssClass="Button1" OnClick="btnAddDriveMap_Click" />
</div>
<div class="FormButtonsBarCleanRight">
<asp:Panel ID="SearchPanel" runat="server" DefaultButton="cmdSearch">
<asp:Localize ID="locSearch" runat="server" meta:resourcekey="locSearch" Visible="false"></asp:Localize>
<asp:DropDownList ID="ddlPageSize" runat="server" AutoPostBack="True"
onselectedindexchanged="ddlPageSize_SelectedIndexChanged">
<asp:ListItem>10</asp:ListItem>
<asp:ListItem Selected="True">20</asp:ListItem>
<asp:ListItem>50</asp:ListItem>
<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:Panel>
</div>
</div>
<asp:GridView ID="gvDriveMaps" runat="server" AutoGenerateColumns="False" EnableViewState="true"
Width="100%" EmptyDataText="gvDriveMaps" CssSelectorClass="NormalGridView"
OnRowCommand="gvDriveMaps_RowCommand" AllowPaging="True" AllowSorting="True"
DataSourceID="odsEnterpriseDriveMapsPaged" PageSize="20">
<Columns>
<asp:TemplateField HeaderText="gvDrive">
<ItemStyle Width="25%"></ItemStyle>
<ItemTemplate>
<asp:Image ID="img1" runat="server" ImageUrl='<%# GetDriveImage() %>' ImageAlign="AbsMiddle" />
<asp:Literal id="litDrive" runat="server" Text='<%# string.Format("{0}:", Eval("DriveLetter")) %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvLabelAs">
<ItemStyle Width="25%"></ItemStyle>
<ItemTemplate>
<asp:Literal id="litLabelAs" runat="server" Text='<%# Eval("LabelAs") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvFolderUrl">
<ItemStyle Width="50%"></ItemStyle>
<ItemTemplate>
<asp:Literal id="litFolderUrl" runat="server" Text='<%# Eval("Folder.Url") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="imgDelDriveMap" runat="server" Text="Delete" SkinID="ExchangeDelete"
CommandName="DeleteItem" CommandArgument='<%# Eval("DriveLetter") %>'
meta:resourcekey="cmdDelete" OnClientClick="return confirm('Are you sure you want to delete selected map drive?')"></asp:ImageButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="odsEnterpriseDriveMapsPaged" runat="server" EnablePaging="True"
SelectCountMethod="GetEnterpriseDriveMapsPagedCount"
SelectMethod="GetEnterpriseDriveMapsPaged"
SortParameterName="sortColumn"
TypeName="WebsitePanel.Portal.EnterpriseStorageHelper">
<SelectParameters>
<asp:QueryStringParameter Name="itemId" QueryStringField="ItemID" DefaultValue="0" />
<asp:ControlParameter Name="filterValue" ControlID="txtSearchValue" PropertyName="Text" />
</SelectParameters>
</asp:ObjectDataSource>
<br />
</div>
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,97 @@
// Copyright (c) 2014, 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.
using System;
using System.Web.UI.WebControls;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.OS;
using WebsitePanel.WebPortal;
namespace WebsitePanel.Portal.ExchangeServer
{
public partial class EnterpriseStorageDriveMaps : WebsitePanelModuleBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (!ES.Services.EnterpriseStorage.CheckUsersDomainExists(PanelRequest.ItemID))
{
btnAddDriveMap.Enabled = false;
messageBox.ShowWarningMessage("WEB_SITE_IS_NOT_CREATED");
}
}
}
protected void btnAddDriveMap_Click(object sender, EventArgs e)
{
Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "create_enterprisestorage_drive_map",
"SpaceID=" + PanelSecurity.PackageId));
}
protected void gvDriveMaps_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "DeleteItem")
{
// delete drive map
string driveLetter = e.CommandArgument.ToString();
try
{
ResultObject result = ES.Services.EnterpriseStorage.DeleteMappedDrive(PanelRequest.ItemID, driveLetter);
if (!result.IsSuccess)
{
messageBox.ShowMessage(result, "ENTERPRISE_STORAGE_DRIVE_MAP", "EnterpriseStorage");
return;
}
gvDriveMaps.DataBind();
}
catch (Exception ex)
{
ShowErrorMessage("ENTERPRISE_STORAGE_DELETE_DRIVE_MAP", ex);
}
}
}
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
gvDriveMaps.PageSize = Convert.ToInt16(ddlPageSize.SelectedValue);
gvDriveMaps.DataBind();
}
protected string GetDriveImage()
{
return String.Concat("~/", DefaultPage.THEMES_FOLDER, "/", Page.Theme, "/", "Images/Exchange", "/", "net_drive16.png");
}
}
}

View file

@ -0,0 +1,123 @@
//------------------------------------------------------------------------------
// <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 EnterpriseStorageDriveMaps {
/// <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>
/// imgESDM 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 imgESDM;
/// <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>
/// 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>
/// btnAddDriveMap 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 btnAddDriveMap;
/// <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>
/// locSearch 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 locSearch;
/// <summary>
/// ddlPageSize 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 ddlPageSize;
/// <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>
/// gvDriveMaps 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 gvDriveMaps;
/// <summary>
/// odsEnterpriseDriveMapsPaged 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 odsEnterpriseDriveMapsPaged;
}
}

View file

@ -46,7 +46,7 @@
DataSourceID="odsEnterpriseFoldersPaged" PageSize="20">
<Columns>
<asp:TemplateField HeaderText="gvFolderName" SortExpression="Name">
<ItemStyle Width="30%"></ItemStyle>
<ItemStyle Width="20%"></ItemStyle>
<ItemTemplate>
<asp:hyperlink id="lnkFolderName" runat="server"
NavigateUrl='<%# GetFolderEditUrl(Eval("Name").ToString()) %>'>
@ -55,23 +55,30 @@
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvFolderQuota" SortExpression="FRSMQuotaGB">
<ItemStyle Width="20%"></ItemStyle>
<ItemStyle Width="15%"></ItemStyle>
<ItemTemplate>
<asp:Literal id="litFolderQuota" runat="server" Text='<%# ConvertMBytesToGB(Eval("FRSMQuotaMB")).ToString() + " Gb" %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvFolderSize" SortExpression="Size">
<ItemStyle Width="20%"></ItemStyle>
<ItemStyle Width="15%"></ItemStyle>
<ItemTemplate>
<asp:Literal id="litFolderSize" runat="server" Text='<%# (ConvertMBytesToGB(Eval("Size"))).ToString() + " Gb" %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvFolderUrl">
<ItemStyle Width="50%"></ItemStyle>
<ItemStyle Width="40%"></ItemStyle>
<ItemTemplate>
<asp:Literal id="litFolderUrl" runat="server" Text='<%# Eval("Url").ToString() %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvMappedDrive">
<ItemStyle Width="10%"></ItemStyle>
<ItemTemplate>
<asp:Image ID="img1" runat="server" ImageUrl='<%# GetDriveImage() %>' ImageAlign="AbsMiddle" Visible ='<%# Eval("DriveLetter") != null %>'/>
<asp:Literal id="litMappedDrive" runat="server" Text='<%# Eval("DriveLetter") != null? string.Format("{0}:", Eval("DriveLetter")) : "not mapped" %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="imgDelFolder" runat="server" Text="Delete" SkinID="ExchangeDelete"

View file

@ -32,6 +32,7 @@ using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.OS;
using WebsitePanel.WebPortal;
namespace WebsitePanel.Portal.ExchangeServer
{
@ -155,6 +156,11 @@ namespace WebsitePanel.Portal.ExchangeServer
gvFolders.PageSize = Convert.ToInt16(ddlPageSize.SelectedValue);
gvFolders.DataBind();
}
}
protected string GetDriveImage()
{
return String.Concat("~/", DefaultPage.THEMES_FOLDER, "/", Page.Theme, "/", "Images/Exchange", "/", "net_drive16.png");
}
}
}

View file

@ -143,7 +143,7 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
ExchangeAccount[] accounts = ES.Services.EnterpriseStorage.SearchESAccounts(PanelRequest.ItemID,
ddlSearchColumn.SelectedValue, txtSearchValue.Text + "%", "");
List<ExchangeAccount> newAccounts = new List<ExchangeAccount>();
//List<ExchangeAccount> newAccounts = new List<ExchangeAccount>();
accounts = accounts.Where(x => !GetPemissions().Select(p => p.Account).Contains(x.AccountName)).ToArray();
Array.Sort(accounts, CompareAccount);

View file

@ -66,7 +66,7 @@ namespace WebsitePanel.Portal
//Add "Organization Home" menu item
MenuItem item = new MenuItem(
GetLocalizedString("Text.OrganizationHome"),
"",
"",
"",
PortalUtils.EditUrl("ItemID", PanelRequest.ItemID.ToString(), "organization_home", "SpaceID=" + PanelSecurity.PackageId));
@ -363,6 +363,10 @@ namespace WebsitePanel.Portal
private void PrepareEnterpriseStorageMenu(PackageContext cntx, MenuItemCollection enterpriseStorageItems)
{
enterpriseStorageItems.Add(CreateMenuItem("EnterpriseStorageFolders", "enterprisestorage_folders"));
if(Utils.CheckQouta(Quotas.ENTERPRICESTORAGE_DRIVEMAPS, cntx))
enterpriseStorageItems.Add(CreateMenuItem("EnterpriseStorageDriveMaps", "enterprisestorage_drive_maps"));
}
private MenuItem CreateMenuItem(string text, string key)

View file

@ -217,6 +217,20 @@
<Compile Include="CRM\CRMStorageSettings.ascx.designer.cs">
<DependentUpon>CRMStorageSettings.ascx</DependentUpon>
</Compile>
<Compile Include="ExchangeServer\EnterpriseStorageCreateDriveMap.ascx.cs">
<DependentUpon>EnterpriseStorageCreateDriveMap.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ExchangeServer\EnterpriseStorageCreateDriveMap.ascx.designer.cs">
<DependentUpon>EnterpriseStorageCreateDriveMap.ascx</DependentUpon>
</Compile>
<Compile Include="ExchangeServer\EnterpriseStorageDriveMaps.ascx.cs">
<DependentUpon>EnterpriseStorageDriveMaps.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ExchangeServer\EnterpriseStorageDriveMaps.ascx.designer.cs">
<DependentUpon>EnterpriseStorageDriveMaps.ascx</DependentUpon>
</Compile>
<Compile Include="ExchangeServer\EnterpriseStorageFolderGeneralSettings.ascx.cs">
<DependentUpon>EnterpriseStorageFolderGeneralSettings.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@ -4073,6 +4087,8 @@
<ItemGroup>
<Content Include="ApplyEnableHardQuotaFeature.ascx" />
<Content Include="CRM\CRMStorageSettings.ascx" />
<Content Include="ExchangeServer\EnterpriseStorageCreateDriveMap.ascx" />
<Content Include="ExchangeServer\EnterpriseStorageDriveMaps.ascx" />
<Content Include="ExchangeServer\EnterpriseStorageFolderGeneralSettings.ascx" />
<Content Include="ExchangeServer\EnterpriseStorageCreateFolder.ascx" />
<Content Include="ExchangeServer\EnterpriseStorageFolders.ascx" />
@ -5334,6 +5350,10 @@
<Content Include="App_LocalResources\OrganizationMenu.ascx.resx" />
<Content Include="App_LocalResources\SettingsExchangeRetentionPolicyTag.ascx.resx" />
<Content Include="ExchangeServer\App_LocalResources\ExchangeRetentionPolicyTag.ascx.resx" />
<Content Include="ExchangeServer\App_LocalResources\EnterpriseStorageDriveMaps.ascx.resx">
<SubType>Designer</SubType>
</Content>
<Content Include="ExchangeServer\App_LocalResources\EnterpriseStorageCreateDriveMap.ascx.resx" />
<EmbeddedResource Include="UserControls\App_LocalResources\EditDomainsList.ascx.resx">
<SubType>Designer</SubType>
</EmbeddedResource>