Merge
This commit is contained in:
commit
922b58df16
25 changed files with 1046 additions and 449 deletions
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
|
@ -80,7 +80,7 @@ namespace WebsitePanel.Installer.Core
|
|||
|
||||
private WebClient fileLoader;
|
||||
|
||||
public BitlyLoader(string remoteFile)
|
||||
internal BitlyLoader(string remoteFile)
|
||||
: base(remoteFile)
|
||||
{
|
||||
InitFileLoader();
|
||||
|
@ -115,7 +115,7 @@ namespace WebsitePanel.Installer.Core
|
|||
|
||||
Log.WriteStart("Downloading file");
|
||||
Log.WriteInfo("Downloading file \"{0}\" to \"{1}\"", remoteFile, tmpFile);
|
||||
|
||||
|
||||
// Attach event handlers to track status of the download process
|
||||
fileLoader.DownloadProgressChanged += (obj, e) =>
|
||||
{
|
||||
|
@ -145,7 +145,7 @@ namespace WebsitePanel.Installer.Core
|
|||
|
||||
fileLoader.DownloadFileAsync(new Uri(remoteFile), tmpFile);
|
||||
RaiseOnStatusChangedEvent(DownloadingSetupFilesMessage);
|
||||
|
||||
|
||||
autoEvent.WaitOne();
|
||||
}
|
||||
}, ct);
|
||||
|
@ -175,7 +175,7 @@ namespace WebsitePanel.Installer.Core
|
|||
public event EventHandler<LoaderEventArgs<Int32>> ProgressChanged;
|
||||
public event EventHandler<EventArgs> OperationCompleted;
|
||||
|
||||
public Loader(string remoteFile)
|
||||
internal Loader(string remoteFile)
|
||||
{
|
||||
this.remoteFile = remoteFile;
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ namespace WebsitePanel.Installer.Core
|
|||
// Download the file requested
|
||||
Task downloadFileTask = GetDownloadFileTask(remoteFile, tmpFile, token);
|
||||
// Move the file downloaded from temporary location to Data folder
|
||||
var moveFileTask = downloadFileTask.ContinueWith((t) =>
|
||||
var moveFileTask = downloadFileTask.ContinueWith((t) =>
|
||||
{
|
||||
if (File.Exists(tmpFile))
|
||||
{
|
||||
|
@ -312,7 +312,7 @@ namespace WebsitePanel.Installer.Core
|
|||
{
|
||||
RaiseOnOperationCompletedEvent();
|
||||
}, token);
|
||||
|
||||
|
||||
downloadFileTask.Start();
|
||||
downloadFileTask.Wait();
|
||||
}
|
||||
|
@ -527,4 +527,4 @@ namespace WebsitePanel.Installer.Core
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -337,10 +337,13 @@ namespace WebsitePanel.SilentInstaller
|
|||
string installerPath = Utils.GetDbString(row["InstallerPath"]);
|
||||
string installerType = Utils.GetDbString(row["InstallerType"]);
|
||||
|
||||
// Get appropriate loader to download the app distributive
|
||||
var loader = LoaderFactory.CreateFileLoader(fileName);
|
||||
// Mimic synchronous download process for the console app
|
||||
AutoResetEvent autoEvent = new AutoResetEvent(false);
|
||||
|
||||
try
|
||||
{
|
||||
// download installer
|
||||
var loader = new Loader(fileName);
|
||||
//
|
||||
loader.OperationCompleted += new EventHandler<EventArgs>((object sender, EventArgs e) =>
|
||||
{
|
||||
|
@ -374,25 +377,26 @@ namespace WebsitePanel.SilentInstaller
|
|||
Log.WriteEnd("Installer finished");
|
||||
// Remove temporary directory
|
||||
FileUtils.DeleteTempDirectory();
|
||||
// We are done
|
||||
autoEvent.Set();
|
||||
});
|
||||
|
||||
// TODO: Add cleanup for events.
|
||||
loader.OperationFailed += new EventHandler<LoaderEventArgs<Exception>>(loader_OperationFailed);
|
||||
loader.ProgressChanged += new EventHandler<LoaderEventArgs<int>>(loader_ProgressChanged);
|
||||
loader.StatusChanged += new EventHandler<LoaderEventArgs<string>>(loader_StatusChanged);
|
||||
//
|
||||
loader.LoadAppDistributive();
|
||||
// Wait until the download is complete
|
||||
autoEvent.WaitOne();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError("Installer error", ex);
|
||||
//AppContext.AppForm.ShowError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
//this.componentSettingsXml = null;
|
||||
//this.componentCode = null;
|
||||
autoEvent.Set();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void loader_StatusChanged(object sender, LoaderEventArgs<string> e)
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
|
@ -114,6 +113,8 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
|
||||
private System.Threading.SendOrPostCallback DisableMailboxOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback GetMailboxAdvancedSettingsOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback GetMailboxGeneralSettingsOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback SetMailboxGeneralSettingsOperationCompleted;
|
||||
|
@ -304,6 +305,9 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
/// <remarks/>
|
||||
public event DisableMailboxCompletedEventHandler DisableMailboxCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event GetMailboxAdvancedSettingsCompletedEventHandler GetMailboxAdvancedSettingsCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event GetMailboxGeneralSettingsCompletedEventHandler GetMailboxGeneralSettingsCompleted;
|
||||
|
||||
|
@ -1775,6 +1779,50 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetMailboxAdvancedSettings", 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 ExchangeMailbox GetMailboxAdvancedSettings(int itemId, int accountId) {
|
||||
object[] results = this.Invoke("GetMailboxAdvancedSettings", new object[] {
|
||||
itemId,
|
||||
accountId});
|
||||
return ((ExchangeMailbox)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public System.IAsyncResult BeginGetMailboxAdvancedSettings(int itemId, int accountId, System.AsyncCallback callback, object asyncState) {
|
||||
return this.BeginInvoke("GetMailboxAdvancedSettings", new object[] {
|
||||
itemId,
|
||||
accountId}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public ExchangeMailbox EndGetMailboxAdvancedSettings(System.IAsyncResult asyncResult) {
|
||||
object[] results = this.EndInvoke(asyncResult);
|
||||
return ((ExchangeMailbox)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void GetMailboxAdvancedSettingsAsync(int itemId, int accountId) {
|
||||
this.GetMailboxAdvancedSettingsAsync(itemId, accountId, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void GetMailboxAdvancedSettingsAsync(int itemId, int accountId, object userState) {
|
||||
if ((this.GetMailboxAdvancedSettingsOperationCompleted == null)) {
|
||||
this.GetMailboxAdvancedSettingsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetMailboxAdvancedSettingsOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("GetMailboxAdvancedSettings", new object[] {
|
||||
itemId,
|
||||
accountId}, this.GetMailboxAdvancedSettingsOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnGetMailboxAdvancedSettingsOperationCompleted(object arg) {
|
||||
if ((this.GetMailboxAdvancedSettingsCompleted != null)) {
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.GetMailboxAdvancedSettingsCompleted(this, new GetMailboxAdvancedSettingsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetMailboxGeneralSettings", 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 ExchangeMailbox GetMailboxGeneralSettings(int itemId, int accountId) {
|
||||
|
@ -5196,6 +5244,32 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||
public delegate void GetMailboxAdvancedSettingsCompletedEventHandler(object sender, GetMailboxAdvancedSettingsCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||
public partial class GetMailboxAdvancedSettingsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
|
||||
|
||||
private object[] results;
|
||||
|
||||
internal GetMailboxAdvancedSettingsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||
base(exception, cancelled, userState) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public ExchangeMailbox Result {
|
||||
get {
|
||||
this.RaiseExceptionIfNecessary();
|
||||
return ((ExchangeMailbox)(this.results[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||
public delegate void GetMailboxGeneralSettingsCompletedEventHandler(object sender, GetMailboxGeneralSettingsCompletedEventArgs e);
|
||||
|
|
|
@ -232,7 +232,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
);
|
||||
|
||||
if (user == null)
|
||||
throw new Exception("Authentication token is invalid or borken");
|
||||
throw new Exception("Authentication token is invalid or broken");
|
||||
|
||||
SecurityContext.SetThreadPrincipal(user);
|
||||
}
|
||||
|
|
|
@ -2700,7 +2700,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
public static NetworkAdapterDetails GetExternalNetworkAdapterDetails(int itemId)
|
||||
{
|
||||
// load service item
|
||||
VirtualMachine vm = (VirtualMachine)PackageController.GetPackageItem(itemId);
|
||||
VMInfo vm = (VMInfo)PackageController.GetPackageItem(itemId);
|
||||
if (vm == null)
|
||||
return null;
|
||||
|
||||
|
|
|
@ -236,12 +236,19 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public ExchangeMailbox GetMailboxAdvancedSettings(int itemId, int accountId)
|
||||
{
|
||||
return ExchangeServerController.GetMailboxAdvancedSettings(itemId, accountId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public ExchangeMailbox GetMailboxGeneralSettings(int itemId, int accountId)
|
||||
{
|
||||
return ExchangeServerController.GetMailboxGeneralSettings(itemId, accountId);
|
||||
}
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public int SetMailboxGeneralSettings(int itemId, int accountId, bool hideAddressBook, bool disabled)
|
||||
{
|
||||
|
|
|
@ -40,361 +40,366 @@ using WebsitePanel.Server.Utils;
|
|||
|
||||
namespace WebsitePanel.Providers.FTP
|
||||
{
|
||||
public class FileZilla : HostingServiceProviderBase, IFtpServer
|
||||
{
|
||||
#region Constants
|
||||
public class FileZilla : HostingServiceProviderBase, IFtpServer
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private const string FILEZILLA_REG = @"SOFTWARE\FileZilla Server";
|
||||
private const string FILEZILLA_REG_X64 = @"SOFTWARE\Wow6432Node\FileZilla Server";
|
||||
private const string FILEZILLA_SERVER_FILE = "FileZilla Server.xml";
|
||||
private const string FILEZILLA_REG = @"SOFTWARE\FileZilla Server";
|
||||
private const string FILEZILLA_REG_X64 = @"SOFTWARE\Wow6432Node\FileZilla Server";
|
||||
private const string FILEZILLA_SERVER_FILE = "FileZilla Server.xml";
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
protected virtual string FileZillaFolder
|
||||
{
|
||||
get
|
||||
{
|
||||
RegistryKey fzKey = Registry.LocalMachine.OpenSubKey(FILEZILLA_REG) ??
|
||||
Registry.LocalMachine.OpenSubKey(FILEZILLA_REG_X64);
|
||||
#region Properties
|
||||
protected virtual string FileZillaFolder
|
||||
{
|
||||
get
|
||||
{
|
||||
RegistryKey fzKey = Registry.LocalMachine.OpenSubKey(FILEZILLA_REG) ??
|
||||
Registry.LocalMachine.OpenSubKey(FILEZILLA_REG_X64);
|
||||
|
||||
if (fzKey == null)
|
||||
throw new Exception("FileZilla registry key was not found: " + FILEZILLA_REG);
|
||||
throw new Exception("FileZilla registry key was not found: " + FILEZILLA_REG);
|
||||
|
||||
return (string)fzKey.GetValue("Install_Dir");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
return (string)fzKey.GetValue("Install_Dir");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Sites
|
||||
#region Sites
|
||||
|
||||
public virtual void ChangeSiteState(string siteId, ServerState state)
|
||||
{
|
||||
// not implemented
|
||||
}
|
||||
public virtual void ChangeSiteState(string siteId, ServerState state)
|
||||
{
|
||||
// not implemented
|
||||
}
|
||||
|
||||
public virtual string CreateSite(FtpSite site)
|
||||
{
|
||||
// not implemented
|
||||
return null;
|
||||
}
|
||||
public virtual string CreateSite(FtpSite site)
|
||||
{
|
||||
// not implemented
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual void DeleteSite(string siteId)
|
||||
{
|
||||
// not implemented
|
||||
}
|
||||
public virtual void DeleteSite(string siteId)
|
||||
{
|
||||
// not implemented
|
||||
}
|
||||
|
||||
public virtual FtpSite GetSite(string siteId)
|
||||
{
|
||||
// not implemented
|
||||
return null;
|
||||
}
|
||||
public virtual FtpSite GetSite(string siteId)
|
||||
{
|
||||
// not implemented
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual FtpSite[] GetSites()
|
||||
{
|
||||
// not implemented
|
||||
return null;
|
||||
}
|
||||
public virtual FtpSite[] GetSites()
|
||||
{
|
||||
// not implemented
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual bool SiteExists(string siteId)
|
||||
{
|
||||
// not implemented
|
||||
return false;
|
||||
}
|
||||
public virtual bool SiteExists(string siteId)
|
||||
{
|
||||
// not implemented
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual ServerState GetSiteState(string siteId)
|
||||
{
|
||||
// not implemented
|
||||
return ServerState.Started;
|
||||
}
|
||||
public virtual ServerState GetSiteState(string siteId)
|
||||
{
|
||||
// not implemented
|
||||
return ServerState.Started;
|
||||
}
|
||||
|
||||
public virtual void UpdateSite(FtpSite site)
|
||||
{
|
||||
// not implemented
|
||||
}
|
||||
public virtual void UpdateSite(FtpSite site)
|
||||
{
|
||||
// not implemented
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Accounts
|
||||
#region Accounts
|
||||
|
||||
public virtual bool AccountExists(string accountName)
|
||||
{
|
||||
XmlDocument doc = GetFileZillaConfig();
|
||||
XmlNode nodeUser = doc.SelectSingleNode("/FileZillaServer/Users/User[@Name='" + accountName + "']");
|
||||
return (nodeUser != null);
|
||||
}
|
||||
public virtual bool AccountExists(string accountName)
|
||||
{
|
||||
XmlDocument doc = GetFileZillaConfig();
|
||||
XmlNode nodeUser = doc.SelectSingleNode("/FileZillaServer/Users/User[@Name='" + accountName + "']");
|
||||
return (nodeUser != null);
|
||||
}
|
||||
|
||||
public virtual FtpAccount GetAccount(string accountName)
|
||||
{
|
||||
XmlDocument doc = GetFileZillaConfig();
|
||||
XmlNode nodeUser = doc.SelectSingleNode("/FileZillaServer/Users/User[@Name='" + accountName + "']");
|
||||
if (nodeUser == null)
|
||||
return null;
|
||||
public virtual FtpAccount GetAccount(string accountName)
|
||||
{
|
||||
XmlDocument doc = GetFileZillaConfig();
|
||||
XmlNode nodeUser = doc.SelectSingleNode("/FileZillaServer/Users/User[@Name='" + accountName + "']");
|
||||
if (nodeUser == null)
|
||||
return null;
|
||||
|
||||
return CreateAccountFromXmlNode(nodeUser, false);
|
||||
}
|
||||
return CreateAccountFromXmlNode(nodeUser, false);
|
||||
}
|
||||
|
||||
public virtual FtpAccount[] GetAccounts()
|
||||
{
|
||||
XmlDocument doc = GetFileZillaConfig();
|
||||
XmlNodeList nodeUsers = doc.SelectNodes("/FileZillaServer/Users/User");
|
||||
public virtual FtpAccount[] GetAccounts()
|
||||
{
|
||||
XmlDocument doc = GetFileZillaConfig();
|
||||
XmlNodeList nodeUsers = doc.SelectNodes("/FileZillaServer/Users/User");
|
||||
|
||||
List<FtpAccount> accounts = new List<FtpAccount>();
|
||||
foreach (XmlNode nodeUser in nodeUsers)
|
||||
accounts.Add(CreateAccountFromXmlNode(nodeUser, true));
|
||||
List<FtpAccount> accounts = new List<FtpAccount>();
|
||||
foreach (XmlNode nodeUser in nodeUsers)
|
||||
accounts.Add(CreateAccountFromXmlNode(nodeUser, true));
|
||||
|
||||
return accounts.ToArray();
|
||||
}
|
||||
return accounts.ToArray();
|
||||
}
|
||||
|
||||
public virtual void CreateAccount(FtpAccount account)
|
||||
{
|
||||
public virtual void CreateAccount(FtpAccount account)
|
||||
{
|
||||
Log.WriteInfo("GetFileZillaConfig");
|
||||
XmlDocument doc = GetFileZillaConfig();
|
||||
XmlDocument doc = GetFileZillaConfig();
|
||||
|
||||
|
||||
Log.WriteInfo("Find users nodes");
|
||||
// find users node
|
||||
XmlNode nodeUsers = doc.SelectSingleNode("/FileZillaServer/Users");
|
||||
|
||||
XmlElement nodeUser = doc.CreateElement("User");
|
||||
if (nodeUsers != null) nodeUsers.AppendChild(nodeUser);
|
||||
// find users node
|
||||
XmlNode fzServerNode = doc.SelectSingleNode("/FileZillaServer");
|
||||
XmlNode fzAccountsNode = fzServerNode.SelectSingleNode("/Users");
|
||||
if (fzAccountsNode == null)
|
||||
{
|
||||
fzAccountsNode = doc.CreateElement("Users");
|
||||
fzServerNode.AppendChild(fzAccountsNode);
|
||||
}
|
||||
|
||||
// set properties
|
||||
nodeUser.SetAttribute("Name", account.Name);
|
||||
SetOption(nodeUser, "Pass", MD5(account.Password));
|
||||
SetOption(nodeUser, "Group", "");
|
||||
SetOption(nodeUser, "Bypass server userlimit", "0");
|
||||
SetOption(nodeUser, "User Limit", "0");
|
||||
SetOption(nodeUser, "IP Limit", "0");
|
||||
SetOption(nodeUser, "Enabled", BoolToString(account.Enabled));
|
||||
SetOption(nodeUser, "Comments", "");
|
||||
SetOption(nodeUser, "ForceSsl", "0");
|
||||
XmlElement fzAccountNode = doc.CreateElement("User");
|
||||
fzAccountsNode.AppendChild(fzAccountNode);
|
||||
// set properties
|
||||
fzAccountNode.SetAttribute("Name", account.Name);
|
||||
SetOption(fzAccountNode, "Pass", MD5(account.Password));
|
||||
SetOption(fzAccountNode, "Group", "");
|
||||
SetOption(fzAccountNode, "Bypass server userlimit", "0");
|
||||
SetOption(fzAccountNode, "User Limit", "0");
|
||||
SetOption(fzAccountNode, "IP Limit", "0");
|
||||
SetOption(fzAccountNode, "Enabled", BoolToString(account.Enabled));
|
||||
SetOption(fzAccountNode, "Comments", "");
|
||||
SetOption(fzAccountNode, "ForceSsl", "0");
|
||||
|
||||
// IP filter
|
||||
XmlElement nodeIPFilter = doc.CreateElement("IpFilter");
|
||||
nodeUser.AppendChild(nodeIPFilter);
|
||||
// IP filter
|
||||
XmlElement nodeIPFilter = doc.CreateElement("IpFilter");
|
||||
fzAccountNode.AppendChild(nodeIPFilter);
|
||||
|
||||
XmlElement nodeDisallowed = doc.CreateElement("Disallowed");
|
||||
nodeIPFilter.AppendChild(nodeDisallowed);
|
||||
XmlElement nodeDisallowed = doc.CreateElement("Disallowed");
|
||||
nodeIPFilter.AppendChild(nodeDisallowed);
|
||||
|
||||
XmlElement nodeAllowed = doc.CreateElement("Allowed");
|
||||
nodeIPFilter.AppendChild(nodeAllowed);
|
||||
XmlElement nodeAllowed = doc.CreateElement("Allowed");
|
||||
nodeIPFilter.AppendChild(nodeAllowed);
|
||||
|
||||
// folder
|
||||
XmlElement nodePermissions = doc.CreateElement("Permissions");
|
||||
nodeUser.AppendChild(nodePermissions);
|
||||
// folder
|
||||
XmlElement nodePermissions = doc.CreateElement("Permissions");
|
||||
fzAccountNode.AppendChild(nodePermissions);
|
||||
|
||||
XmlElement nodePermission = doc.CreateElement("Permission");
|
||||
nodePermissions.AppendChild(nodePermission);
|
||||
XmlElement nodePermission = doc.CreateElement("Permission");
|
||||
nodePermissions.AppendChild(nodePermission);
|
||||
|
||||
// folder settings
|
||||
nodePermission.SetAttribute("Dir", account.Folder);
|
||||
SetOption(nodePermission, "FileRead", BoolToString(account.CanRead));
|
||||
SetOption(nodePermission, "FileWrite", BoolToString(account.CanWrite));
|
||||
SetOption(nodePermission, "FileDelete", BoolToString(account.CanWrite));
|
||||
SetOption(nodePermission, "DirCreate", BoolToString(account.CanWrite));
|
||||
SetOption(nodePermission, "DirDelete", BoolToString(account.CanWrite));
|
||||
SetOption(nodePermission, "DirList", BoolToString(account.CanRead));
|
||||
SetOption(nodePermission, "DirSubdirs", BoolToString(account.CanRead));
|
||||
SetOption(nodePermission, "IsHome", "1");
|
||||
SetOption(nodePermission, "AutoCreate", "0");
|
||||
// folder settings
|
||||
nodePermission.SetAttribute("Dir", account.Folder);
|
||||
SetOption(nodePermission, "FileRead", BoolToString(account.CanRead));
|
||||
SetOption(nodePermission, "FileWrite", BoolToString(account.CanWrite));
|
||||
SetOption(nodePermission, "FileDelete", BoolToString(account.CanWrite));
|
||||
SetOption(nodePermission, "DirCreate", BoolToString(account.CanWrite));
|
||||
SetOption(nodePermission, "DirDelete", BoolToString(account.CanWrite));
|
||||
SetOption(nodePermission, "DirList", BoolToString(account.CanRead));
|
||||
SetOption(nodePermission, "DirSubdirs", BoolToString(account.CanRead));
|
||||
SetOption(nodePermission, "IsHome", "1");
|
||||
SetOption(nodePermission, "AutoCreate", "0");
|
||||
|
||||
// speed limits
|
||||
XmlElement nodeSpeedLimits = doc.CreateElement("SpeedLimits");
|
||||
nodeUser.AppendChild(nodeSpeedLimits);
|
||||
nodeSpeedLimits.SetAttribute("DlType", "0");
|
||||
nodeSpeedLimits.SetAttribute("DlLimit", "10");
|
||||
nodeSpeedLimits.SetAttribute("ServerDlLimitBypass", "0");
|
||||
nodeSpeedLimits.SetAttribute("UlType", "0");
|
||||
nodeSpeedLimits.SetAttribute("UlLimit", "10");
|
||||
nodeSpeedLimits.SetAttribute("ServerUlLimitBypass", "0");
|
||||
// speed limits
|
||||
XmlElement nodeSpeedLimits = doc.CreateElement("SpeedLimits");
|
||||
fzAccountNode.AppendChild(nodeSpeedLimits);
|
||||
nodeSpeedLimits.SetAttribute("DlType", "0");
|
||||
nodeSpeedLimits.SetAttribute("DlLimit", "10");
|
||||
nodeSpeedLimits.SetAttribute("ServerDlLimitBypass", "0");
|
||||
nodeSpeedLimits.SetAttribute("UlType", "0");
|
||||
nodeSpeedLimits.SetAttribute("UlLimit", "10");
|
||||
nodeSpeedLimits.SetAttribute("ServerUlLimitBypass", "0");
|
||||
|
||||
XmlElement nodeDownload = doc.CreateElement("Download");
|
||||
nodeSpeedLimits.AppendChild(nodeDownload);
|
||||
XmlElement nodeDownload = doc.CreateElement("Download");
|
||||
nodeSpeedLimits.AppendChild(nodeDownload);
|
||||
|
||||
XmlElement nodeUpload = doc.CreateElement("Upload");
|
||||
nodeSpeedLimits.AppendChild(nodeUpload);
|
||||
XmlElement nodeUpload = doc.CreateElement("Upload");
|
||||
nodeSpeedLimits.AppendChild(nodeUpload);
|
||||
|
||||
// save document
|
||||
doc.Save(GetFileZillaConfigPath());
|
||||
// save document
|
||||
doc.Save(GetFileZillaConfigPath());
|
||||
|
||||
// reload config
|
||||
ReloadFileZillaConfig();
|
||||
}
|
||||
// reload config
|
||||
ReloadFileZillaConfig();
|
||||
}
|
||||
|
||||
public virtual void UpdateAccount(FtpAccount account)
|
||||
{
|
||||
XmlDocument doc = GetFileZillaConfig();
|
||||
XmlNode nodeUser = doc.SelectSingleNode("/FileZillaServer/Users/User[@Name='" + account.Name + "']");
|
||||
if (nodeUser == null)
|
||||
return;
|
||||
public virtual void UpdateAccount(FtpAccount account)
|
||||
{
|
||||
XmlDocument doc = GetFileZillaConfig();
|
||||
XmlNode nodeUser = doc.SelectSingleNode("/FileZillaServer/Users/User[@Name='" + account.Name + "']");
|
||||
if (nodeUser == null)
|
||||
return;
|
||||
|
||||
// update user
|
||||
if(!String.IsNullOrEmpty(account.Password))
|
||||
SetOption(nodeUser, "Pass", MD5(account.Password));
|
||||
SetOption(nodeUser, "Enabled", BoolToString(account.Enabled));
|
||||
// update user
|
||||
if(!String.IsNullOrEmpty(account.Password))
|
||||
SetOption(nodeUser, "Pass", MD5(account.Password));
|
||||
SetOption(nodeUser, "Enabled", BoolToString(account.Enabled));
|
||||
|
||||
// update folder
|
||||
XmlNode nodePermission = nodeUser.SelectSingleNode("Permissions/Permission");
|
||||
if (nodePermission != null)
|
||||
{
|
||||
((XmlElement)nodePermission).SetAttribute("Dir", account.Folder);
|
||||
SetOption(nodePermission, "FileRead", BoolToString(account.CanRead));
|
||||
SetOption(nodePermission, "FileWrite", BoolToString(account.CanWrite));
|
||||
SetOption(nodePermission, "FileDelete", BoolToString(account.CanWrite));
|
||||
SetOption(nodePermission, "DirCreate", BoolToString(account.CanWrite));
|
||||
SetOption(nodePermission, "DirDelete", BoolToString(account.CanWrite));
|
||||
SetOption(nodePermission, "DirList", BoolToString(account.CanRead));
|
||||
SetOption(nodePermission, "DirSubdirs", BoolToString(account.CanRead));
|
||||
}
|
||||
// update folder
|
||||
XmlNode nodePermission = nodeUser.SelectSingleNode("Permissions/Permission");
|
||||
if (nodePermission != null)
|
||||
{
|
||||
((XmlElement)nodePermission).SetAttribute("Dir", account.Folder);
|
||||
SetOption(nodePermission, "FileRead", BoolToString(account.CanRead));
|
||||
SetOption(nodePermission, "FileWrite", BoolToString(account.CanWrite));
|
||||
SetOption(nodePermission, "FileDelete", BoolToString(account.CanWrite));
|
||||
SetOption(nodePermission, "DirCreate", BoolToString(account.CanWrite));
|
||||
SetOption(nodePermission, "DirDelete", BoolToString(account.CanWrite));
|
||||
SetOption(nodePermission, "DirList", BoolToString(account.CanRead));
|
||||
SetOption(nodePermission, "DirSubdirs", BoolToString(account.CanRead));
|
||||
}
|
||||
|
||||
// save document
|
||||
doc.Save(GetFileZillaConfigPath());
|
||||
// save document
|
||||
doc.Save(GetFileZillaConfigPath());
|
||||
|
||||
// reload config
|
||||
ReloadFileZillaConfig();
|
||||
}
|
||||
// reload config
|
||||
ReloadFileZillaConfig();
|
||||
}
|
||||
|
||||
public virtual void DeleteAccount(string accountName)
|
||||
{
|
||||
XmlDocument doc = GetFileZillaConfig();
|
||||
XmlNode nodeUser = doc.SelectSingleNode("/FileZillaServer/Users/User[@Name='" + accountName + "']");
|
||||
if (nodeUser == null)
|
||||
return;
|
||||
public virtual void DeleteAccount(string accountName)
|
||||
{
|
||||
XmlDocument doc = GetFileZillaConfig();
|
||||
XmlNode nodeUser = doc.SelectSingleNode("/FileZillaServer/Users/User[@Name='" + accountName + "']");
|
||||
if (nodeUser == null)
|
||||
return;
|
||||
|
||||
// delete account
|
||||
nodeUser.ParentNode.RemoveChild(nodeUser);
|
||||
// delete account
|
||||
nodeUser.ParentNode.RemoveChild(nodeUser);
|
||||
|
||||
// save document
|
||||
doc.Save(GetFileZillaConfigPath());
|
||||
// save document
|
||||
doc.Save(GetFileZillaConfigPath());
|
||||
|
||||
// reload config
|
||||
ReloadFileZillaConfig();
|
||||
}
|
||||
// reload config
|
||||
ReloadFileZillaConfig();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
|
||||
public override void ChangeServiceItemsState(ServiceProviderItem[] items, bool enabled)
|
||||
{
|
||||
foreach (ServiceProviderItem item in items)
|
||||
{
|
||||
if (item is FtpAccount)
|
||||
{
|
||||
try
|
||||
{
|
||||
// change FTP account state
|
||||
FtpAccount account = GetAccount(item.Name);
|
||||
account.Enabled = enabled;
|
||||
UpdateAccount(account);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("Error switching '{0}' {1}", item.Name, item.GetType().Name), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void ChangeServiceItemsState(ServiceProviderItem[] items, bool enabled)
|
||||
{
|
||||
foreach (ServiceProviderItem item in items)
|
||||
{
|
||||
if (item is FtpAccount)
|
||||
{
|
||||
try
|
||||
{
|
||||
// change FTP account state
|
||||
FtpAccount account = GetAccount(item.Name);
|
||||
account.Enabled = enabled;
|
||||
UpdateAccount(account);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("Error switching '{0}' {1}", item.Name, item.GetType().Name), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void DeleteServiceItems(ServiceProviderItem[] items)
|
||||
{
|
||||
foreach (ServiceProviderItem item in items)
|
||||
{
|
||||
if (item is FtpAccount)
|
||||
{
|
||||
try
|
||||
{
|
||||
// delete FTP account
|
||||
DeleteAccount(item.Name);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("Error deleting '{0}' {1}", item.Name, item.GetType().Name), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void DeleteServiceItems(ServiceProviderItem[] items)
|
||||
{
|
||||
foreach (ServiceProviderItem item in items)
|
||||
{
|
||||
if (item is FtpAccount)
|
||||
{
|
||||
try
|
||||
{
|
||||
// delete FTP account
|
||||
DeleteAccount(item.Name);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("Error deleting '{0}' {1}", item.Name, item.GetType().Name), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Private Helpers
|
||||
private string BoolToString(bool val)
|
||||
{
|
||||
return val ? "1" : "0";
|
||||
}
|
||||
#region Private Helpers
|
||||
private string BoolToString(bool val)
|
||||
{
|
||||
return val ? "1" : "0";
|
||||
}
|
||||
|
||||
private void SetOption(XmlNode parentNode, string name, string val)
|
||||
{
|
||||
XmlNode option = parentNode.SelectSingleNode("Option[@Name='" + name + "']");
|
||||
if (option == null)
|
||||
{
|
||||
option = parentNode.OwnerDocument.CreateElement("Option");
|
||||
parentNode.AppendChild(option);
|
||||
((XmlElement)option).SetAttribute("Name", name);
|
||||
}
|
||||
option.InnerText = val;
|
||||
}
|
||||
private void SetOption(XmlNode parentNode, string name, string val)
|
||||
{
|
||||
XmlNode option = parentNode.SelectSingleNode("Option[@Name='" + name + "']");
|
||||
if (option == null)
|
||||
{
|
||||
option = parentNode.OwnerDocument.CreateElement("Option");
|
||||
parentNode.AppendChild(option);
|
||||
((XmlElement)option).SetAttribute("Name", name);
|
||||
}
|
||||
option.InnerText = val;
|
||||
}
|
||||
|
||||
private FtpAccount CreateAccountFromXmlNode(XmlNode nodeUser, bool excludeDetails)
|
||||
{
|
||||
FtpAccount account = new FtpAccount();
|
||||
account.Name = nodeUser.Attributes["Name"].Value;
|
||||
private FtpAccount CreateAccountFromXmlNode(XmlNode nodeUser, bool excludeDetails)
|
||||
{
|
||||
FtpAccount account = new FtpAccount();
|
||||
account.Name = nodeUser.Attributes["Name"].Value;
|
||||
|
||||
if (!excludeDetails)
|
||||
{
|
||||
account.Password = nodeUser.SelectSingleNode("Option[@Name='Pass']").InnerText;
|
||||
account.Enabled = (nodeUser.SelectSingleNode("Option[@Name='Enabled']").InnerText == "1");
|
||||
XmlNode nodeFolder = nodeUser.SelectSingleNode("Permissions/Permission");
|
||||
if (nodeFolder != null)
|
||||
{
|
||||
account.Folder = nodeFolder.Attributes["Dir"].Value;
|
||||
account.CanRead = (nodeFolder.SelectSingleNode("Option[@Name='FileRead']").InnerText == "1");
|
||||
account.CanWrite = (nodeFolder.SelectSingleNode("Option[@Name='FileWrite']").InnerText == "1");
|
||||
}
|
||||
}
|
||||
if (!excludeDetails)
|
||||
{
|
||||
account.Password = nodeUser.SelectSingleNode("Option[@Name='Pass']").InnerText;
|
||||
account.Enabled = (nodeUser.SelectSingleNode("Option[@Name='Enabled']").InnerText == "1");
|
||||
XmlNode nodeFolder = nodeUser.SelectSingleNode("Permissions/Permission");
|
||||
if (nodeFolder != null)
|
||||
{
|
||||
account.Folder = nodeFolder.Attributes["Dir"].Value;
|
||||
account.CanRead = (nodeFolder.SelectSingleNode("Option[@Name='FileRead']").InnerText == "1");
|
||||
account.CanWrite = (nodeFolder.SelectSingleNode("Option[@Name='FileWrite']").InnerText == "1");
|
||||
}
|
||||
}
|
||||
|
||||
return account;
|
||||
}
|
||||
return account;
|
||||
}
|
||||
|
||||
private XmlDocument GetFileZillaConfig()
|
||||
{
|
||||
string path = GetFileZillaConfigPath();
|
||||
if (!File.Exists(path))
|
||||
throw new Exception("FileZilla configuration file was not found: " + path);
|
||||
private XmlDocument GetFileZillaConfig()
|
||||
{
|
||||
string path = GetFileZillaConfigPath();
|
||||
if (!File.Exists(path))
|
||||
throw new Exception("FileZilla configuration file was not found: " + path);
|
||||
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(path);
|
||||
return doc;
|
||||
}
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(path);
|
||||
return doc;
|
||||
}
|
||||
|
||||
private string GetFileZillaConfigPath()
|
||||
{
|
||||
return Path.Combine(FileZillaFolder, FILEZILLA_SERVER_FILE);
|
||||
}
|
||||
private string GetFileZillaConfigPath()
|
||||
{
|
||||
return Path.Combine(FileZillaFolder, FILEZILLA_SERVER_FILE);
|
||||
}
|
||||
|
||||
private string MD5(string str)
|
||||
{
|
||||
System.Text.UTF8Encoding ue = new System.Text.UTF8Encoding();
|
||||
byte[] bytes = ue.GetBytes(str);
|
||||
private string MD5(string str)
|
||||
{
|
||||
System.Text.UTF8Encoding ue = new System.Text.UTF8Encoding();
|
||||
byte[] bytes = ue.GetBytes(str);
|
||||
|
||||
// encrypt bytes
|
||||
System.Security.Cryptography.MD5CryptoServiceProvider md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
|
||||
byte[] hashBytes = md5.ComputeHash(bytes);
|
||||
// encrypt bytes
|
||||
System.Security.Cryptography.MD5CryptoServiceProvider md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
|
||||
byte[] hashBytes = md5.ComputeHash(bytes);
|
||||
|
||||
// Convert the encrypted bytes back to a string (base 16)
|
||||
string hashString = "";
|
||||
// Convert the encrypted bytes back to a string (base 16)
|
||||
string hashString = "";
|
||||
|
||||
for (int i = 0; i < hashBytes.Length; i++)
|
||||
hashString += Convert.ToString(hashBytes[i], 16).PadLeft(2, '0');
|
||||
for (int i = 0; i < hashBytes.Length; i++)
|
||||
hashString += Convert.ToString(hashBytes[i], 16).PadLeft(2, '0');
|
||||
|
||||
return hashString.PadLeft(32, '0');
|
||||
}
|
||||
return hashString.PadLeft(32, '0');
|
||||
}
|
||||
|
||||
private void ReloadFileZillaConfig()
|
||||
{
|
||||
FileUtils.ExecuteSystemCommand(
|
||||
Path.Combine(FileZillaFolder, "FileZilla Server.exe"),
|
||||
"/reload-config");
|
||||
}
|
||||
#endregion
|
||||
private void ReloadFileZillaConfig()
|
||||
{
|
||||
FileUtils.ExecuteSystemCommand(
|
||||
Path.Combine(FileZillaFolder, "FileZilla Server.exe"),
|
||||
"/reload-config");
|
||||
}
|
||||
#endregion
|
||||
|
||||
public override bool IsInstalled()
|
||||
{
|
||||
|
@ -423,5 +428,5 @@ namespace WebsitePanel.Providers.FTP
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,14 +38,98 @@ using System.Reflection;
|
|||
using Ionic.Zip;
|
||||
using WebsitePanel.Providers.OS;
|
||||
|
||||
|
||||
namespace WebsitePanel.Providers.Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a contract that a system command provider needs to implement.
|
||||
/// </summary>
|
||||
public interface ICommandLineProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Executes the file specifed as if you were executing it via command-line interface.
|
||||
/// </summary>
|
||||
/// <param name="filePath">Path to the executable file (eq. .exe, .bat, .cmd and etc).</param>
|
||||
/// <param name="args">Arguments to pass to the executable file</param>
|
||||
/// <param name="outputFile">Path to the output file if you want the output to be written somewhere.</param>
|
||||
/// <returns>Output of the command being executed.</returns>
|
||||
string Execute(string filePath, string args, string outputFile);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides a default implementation of running system commands.
|
||||
/// </summary>
|
||||
public sealed class DefaultCommandLineProvider : ICommandLineProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new process and executes the file specifed as if you were executing it via command-line interface.
|
||||
/// </summary>
|
||||
/// <param name="filePath">Path to the executable file (eq. .exe, .bat, .cmd and etc).</param>
|
||||
/// <param name="args">Arguments to pass to the executable file</param>
|
||||
/// <param name="outputFile">Path to the output file if you want the output to be written somewhere.</param>
|
||||
/// <returns>Output of the command being executed.</returns>
|
||||
public string Execute(string filePath, string args, string outputFile)
|
||||
{
|
||||
// launch system process
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo(filePath, args);
|
||||
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
startInfo.RedirectStandardOutput = true;
|
||||
startInfo.UseShellExecute = false;
|
||||
startInfo.CreateNoWindow = true;
|
||||
|
||||
// get working directory from executable path
|
||||
startInfo.WorkingDirectory = Path.GetDirectoryName(filePath);
|
||||
Process proc = Process.Start(startInfo);
|
||||
|
||||
// analyze results
|
||||
StreamReader reader = proc.StandardOutput;
|
||||
string results = "";
|
||||
if (!String.IsNullOrEmpty(outputFile))
|
||||
{
|
||||
// stream to writer
|
||||
StreamWriter writer = new StreamWriter(outputFile);
|
||||
int BUFFER_LENGTH = 2048;
|
||||
int readBytes = 0;
|
||||
char[] buffer = new char[BUFFER_LENGTH];
|
||||
while ((readBytes = reader.Read(buffer, 0, BUFFER_LENGTH)) > 0)
|
||||
{
|
||||
writer.Write(buffer, 0, readBytes);
|
||||
}
|
||||
writer.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
// return as string
|
||||
results = reader.ReadToEnd();
|
||||
}
|
||||
reader.Close();
|
||||
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Summary description for FileUtils.
|
||||
/// </summary>
|
||||
public class FileUtils
|
||||
{
|
||||
private static ICommandLineProvider CliProvider;
|
||||
|
||||
static FileUtils()
|
||||
{
|
||||
SetDefaultCliProvider(new DefaultCommandLineProvider());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes command-line provider for the utility class. Yet this is not a perfect way to inverse control over CLI processing
|
||||
/// but it does its job for the testing purposes.
|
||||
/// </summary>
|
||||
/// <param name="provider">An instance of a command-line provider to initialize the utility with.</param>
|
||||
public static void SetDefaultCliProvider(ICommandLineProvider provider)
|
||||
{
|
||||
Debug.Assert(provider != null, "Command line provider is null");
|
||||
CliProvider = provider;
|
||||
}
|
||||
|
||||
public static string EvaluateSystemVariables(string str)
|
||||
{
|
||||
if (String.IsNullOrEmpty(str))
|
||||
|
@ -616,45 +700,17 @@ namespace WebsitePanel.Providers.Utils
|
|||
return ExecuteSystemCommand(cmd, args, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the file specifed as if you were executing it via command-line interface.
|
||||
/// </summary>
|
||||
/// <param name="filePath">Path to the executable file (eq. .exe, .bat, .cmd and etc).</param>
|
||||
/// <param name="args">Arguments to pass to the executable file</param>
|
||||
/// <param name="outputFile">Path to the output file if you want the output to be written somewhere.</param>
|
||||
/// <returns>Output of the command being executed.</returns>
|
||||
public static string ExecuteSystemCommand(string cmd, string args, string outputFile)
|
||||
{
|
||||
// launch system process
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo(cmd, args);
|
||||
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
startInfo.RedirectStandardOutput = true;
|
||||
startInfo.StandardOutputEncoding = Encoding.UTF8;
|
||||
startInfo.UseShellExecute = false;
|
||||
startInfo.CreateNoWindow = true;
|
||||
|
||||
// get working directory from executable path
|
||||
startInfo.WorkingDirectory = Path.GetDirectoryName(cmd);
|
||||
Process proc = Process.Start(startInfo);
|
||||
|
||||
|
||||
// analyze results
|
||||
StreamReader reader = proc.StandardOutput;
|
||||
string results = "";
|
||||
if (!String.IsNullOrEmpty(outputFile))
|
||||
{
|
||||
// stream to writer
|
||||
StreamWriter writer = new StreamWriter(outputFile);
|
||||
int BUFFER_LENGTH = 2048;
|
||||
int readBytes = 0;
|
||||
char[] buffer = new char[BUFFER_LENGTH];
|
||||
while ((readBytes = reader.Read(buffer, 0, BUFFER_LENGTH)) > 0)
|
||||
{
|
||||
writer.Write(buffer, 0, readBytes);
|
||||
}
|
||||
writer.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
// return as string
|
||||
results = reader.ReadToEnd();
|
||||
}
|
||||
reader.Close();
|
||||
|
||||
return results;
|
||||
return CliProvider.Execute(cmd, args, outputFile);
|
||||
}
|
||||
|
||||
public static void ExecuteCmdCommand(string command)
|
||||
|
|
|
@ -5164,4 +5164,22 @@
|
|||
<data name="Quota.Lync.EnablePlansEditing" xml:space="preserve">
|
||||
<value>Enable Lync User Plans Editing</value>
|
||||
</data>
|
||||
<data name="Error.EXCHANGE_APPLYPLANTEMPLATE" xml:space="preserve">
|
||||
<value>Failed to apply plans template</value>
|
||||
</data>
|
||||
<data name="Success.EXCHANGE_APPLYPLANTEMPLATE" xml:space="preserve">
|
||||
<value>Succesfully applied plans template</value>
|
||||
</data>
|
||||
<data name="Error.EXCHANGE_MATCHPLANS" xml:space="preserve">
|
||||
<value>Failed to match plans</value>
|
||||
</data>
|
||||
<data name="Success.EXCHANGE_MATCHPLANS" xml:space="preserve">
|
||||
<value>Succesfully plans matched and applied</value>
|
||||
</data>
|
||||
<data name="Error.LYNC_APPLYPLANTEMPLATE" xml:space="preserve">
|
||||
<value>Failed to apply plans template</value>
|
||||
</data>
|
||||
<data name="Success.LYNC_APPLYPLANTEMPLATE" xml:space="preserve">
|
||||
<value>Succesfully applied plans template</value>
|
||||
</data>
|
||||
</root>
|
|
@ -213,4 +213,10 @@
|
|||
<data name="valRequireMailboxPlan.Text" xml:space="preserve">
|
||||
<value>*</value>
|
||||
</data>
|
||||
<data name="btnAddMailboxPlanToOrganizations.Text" xml:space="preserve">
|
||||
<value>Add Mailbox Plans Template to All Tenants</value>
|
||||
</data>
|
||||
<data name="btnMatchMailboxPlanToUser.Text" xml:space="preserve">
|
||||
<value>Match Mailbox Plan to User</value>
|
||||
</data>
|
||||
</root>
|
|
@ -29,9 +29,54 @@
|
|||
using WebsitePanel.EnterpriseServer;
|
||||
using WebsitePanel.Providers.Virtualization;
|
||||
using System.Web;
|
||||
using System;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
// TODO: Move this extension to a separate file later.
|
||||
public static class VirtualMachinesExtensions
|
||||
{
|
||||
#region Privates with specific purposes (eq. caching, usability, performance and etc)
|
||||
/// <summary>
|
||||
/// This method supports the Portal internal infrastructure and is not intended to be used directly from your code. Gets a cached copy of virtual machine object of the specified type or retrieves it for the first time and then caches it.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of virtual machine to be retrieved (possible types are VirtualMachine|VMInfo)</typeparam>
|
||||
/// <param name="cacheIdentityKey">Virtual machine item id</param>
|
||||
/// <param name="getVmFunc">Function to retrieve the virtual machine data from Enterprise Server</param>
|
||||
/// <returns>An instance of the specified virtual machine</returns>
|
||||
internal static T GetCachedVirtualMachine<T>(object cacheIdentityKey, Func<T> getVmFunc)
|
||||
{
|
||||
// TODO: Make this method private when all dependents will be consolidated in the extension.
|
||||
string cacheKey = "CachedVirtualMachine_" + cacheIdentityKey;
|
||||
if (HttpContext.Current.Items[cacheKey] != null)
|
||||
return (T)HttpContext.Current.Items[cacheKey];
|
||||
|
||||
// load virtual machine
|
||||
T virtualMachine = getVmFunc();
|
||||
|
||||
// place to cache
|
||||
if (virtualMachine != null)
|
||||
HttpContext.Current.Items[cacheKey] = virtualMachine;
|
||||
|
||||
return virtualMachine;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Extension methods
|
||||
/// <summary>
|
||||
/// Gets a cached copy of virtual machine object of the specified type or retrieves it for the first time and then caches it.
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="itemId">Virtual machine id</param>
|
||||
/// <returns>An instance of the virtual machine speficied</returns>
|
||||
public static VMInfo GetCachedVirtualMachine(this esVirtualizationServerForPrivateCloud client, int itemId)
|
||||
{
|
||||
return GetCachedVirtualMachine<VMInfo>(
|
||||
itemId, () => ES.Services.VPSPC.GetVirtualMachineItem(itemId));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class VirtualMachinesHelper
|
||||
{
|
||||
public static bool IsVirtualMachineManagementAllowed(int packageId)
|
||||
|
@ -57,20 +102,11 @@ namespace WebsitePanel.Portal
|
|||
return manageAllowed;
|
||||
}
|
||||
|
||||
// TODO: Move this method to the corresponding extension later.
|
||||
public static VirtualMachine GetCachedVirtualMachine(int itemId)
|
||||
{
|
||||
string key = "CachedVirtualMachine" + itemId;
|
||||
if (HttpContext.Current.Items[key] != null)
|
||||
return (VirtualMachine)HttpContext.Current.Items[key];
|
||||
|
||||
// load virtual machine
|
||||
VirtualMachine vm = ES.Services.VPS.GetVirtualMachineItem(itemId);
|
||||
|
||||
// place to cache
|
||||
if (vm != null)
|
||||
HttpContext.Current.Items[key] = vm;
|
||||
|
||||
return vm;
|
||||
return VirtualMachinesExtensions.GetCachedVirtualMachine<VirtualMachine>(
|
||||
itemId, () => ES.Services.VPS.GetVirtualMachineItem(itemId));
|
||||
}
|
||||
|
||||
#region Virtual Machines
|
||||
|
|
|
@ -2,8 +2,11 @@
|
|||
<%@ Register Src="ExchangeServer/UserControls/SizeBox.ascx" TagName="SizeBox" TagPrefix="wsp" %>
|
||||
<%@ Register Src="ExchangeServer/UserControls/DaysBox.ascx" TagName="DaysBox" TagPrefix="wsp" %>
|
||||
<%@ Register Src="UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %>
|
||||
<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %>
|
||||
<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
|
||||
|
||||
|
||||
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
|
||||
<wsp:SimpleMessageBox id="messageBox" runat="server" />
|
||||
<asp:GridView id="gvMailboxPlans" runat="server" EnableViewState="true" AutoGenerateColumns="false"
|
||||
Width="100%" EmptyDataText="gvMailboxPlans" CssSelectorClass="NormalGridView" OnRowCommand="gvMailboxPlan_RowCommand" >
|
||||
<Columns>
|
||||
|
@ -184,5 +187,15 @@
|
|||
Text="Add New Mailboxplan" CssClass="Button1" OnClick="btnAddMailboxPlan_Click" />
|
||||
</div>
|
||||
|
||||
<div class="FormButtonsBarClean">
|
||||
<asp:Button ID="btnAddMailboxPlanToOrganizations" runat="server" meta:resourcekey="btnAddMailboxPlanToOrganizations"
|
||||
Text="Add Mailbox Plans Template to All Organizations" CssClass="Button1" OnClick="btnAddMailboxPlanToOrganizations_Click" OnClientClick="if (confirm('Plans with an existing name will not be added. \nAre you sure you want to add the plans template to all tenants ?')) ShowProgressDialog('Adding mailbox plans, this might take a while ...'); else return false;"/>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="FormButtonsBarClean">
|
||||
<asp:Button ID="btnMatchMailboxPlanToUser" runat="server" meta:resourcekey="btnMatchMailboxPlanToUser"
|
||||
Text="Match Plan to User" CssClass="Button1"
|
||||
OnClientClick="if (confirm('Mail enabled users with no mailbox plan assigned will get a matching mailbox plan applied.\nMatching takes place on mailbox size and the MAPI properties.\n\nAre you sure you want to continue with this ?')) ShowProgressDialog('Applying mailbox plans, this might take a while ...'); else return false;"
|
||||
onclick="btnMatchMailboxPlanToUser_Click" />
|
||||
</div>
|
||||
|
|
@ -238,5 +238,188 @@ namespace WebsitePanel.Portal
|
|||
settings[UserSettings.DEFAULT_MAILBOXPLANS] = writer.ToString();
|
||||
}
|
||||
|
||||
|
||||
protected void btnAddMailboxPlanToOrganizations_Click(object sender, EventArgs e)
|
||||
{
|
||||
AddMailboxPlanToOrganizations("ServerAdmin");
|
||||
}
|
||||
|
||||
private void AddMailboxPlanToOrganizations(string serverAdmin)
|
||||
{
|
||||
UserInfo ServerAdminInfo = ES.Services.Users.GetUserByUsername(serverAdmin);
|
||||
|
||||
if (ServerAdminInfo == null) return;
|
||||
|
||||
UserInfo[] UsersInfo = ES.Services.Users.GetUsers(ServerAdminInfo.UserId, true);
|
||||
|
||||
try
|
||||
{
|
||||
foreach (UserInfo ui in UsersInfo)
|
||||
{
|
||||
PackageInfo[] Packages = ES.Services.Packages.GetPackages(ui.UserId);
|
||||
|
||||
if ((Packages != null) & (Packages.GetLength(0) > 0))
|
||||
{
|
||||
foreach (PackageInfo Package in Packages)
|
||||
{
|
||||
Providers.HostedSolution.Organization[] orgs = null;
|
||||
|
||||
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Package.PackageId, false);
|
||||
|
||||
if ((orgs != null) & (orgs.GetLength(0) > 0))
|
||||
{
|
||||
foreach (Organization org in orgs)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(org.GlobalAddressList))
|
||||
{
|
||||
ExchangeMailboxPlan[] plans = ES.Services.ExchangeServer.GetExchangeMailboxPlans(org.Id);
|
||||
|
||||
foreach (ExchangeMailboxPlan p in list)
|
||||
{
|
||||
if (!PlanExists(p, plans)) ES.Services.ExchangeServer.AddExchangeMailboxPlan(org.Id, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
messageBox.ShowSuccessMessage("EXCHANGE_APPLYPLANTEMPLATE");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
messageBox.ShowErrorMessage("EXCHANGE_APPLYPLANTEMPLATE", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private bool PlanExists(ExchangeMailboxPlan plan, ExchangeMailboxPlan[] plans)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
foreach (ExchangeMailboxPlan p in plans)
|
||||
{
|
||||
if (p.MailboxPlan.ToLower() == plan.MailboxPlan.ToLower())
|
||||
{
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected void btnMatchMailboxPlanToUser_Click(object sender, EventArgs e)
|
||||
{
|
||||
MatchMailboxPlanToUser("serverAdmin");
|
||||
}
|
||||
|
||||
private void MatchMailboxPlanToUser(string serverAdmin)
|
||||
{
|
||||
UserInfo ServerAdminInfo = ES.Services.Users.GetUserByUsername(serverAdmin);
|
||||
|
||||
if (ServerAdminInfo == null) return;
|
||||
|
||||
UserInfo[] UsersInfo = ES.Services.Users.GetUsers(ServerAdminInfo.UserId, true);
|
||||
|
||||
try
|
||||
{
|
||||
foreach (UserInfo ui in UsersInfo)
|
||||
{
|
||||
PackageInfo[] Packages = ES.Services.Packages.GetPackages(ui.UserId);
|
||||
|
||||
if ((Packages != null) & (Packages.GetLength(0) > 0))
|
||||
{
|
||||
foreach (PackageInfo Package in Packages)
|
||||
{
|
||||
Providers.HostedSolution.Organization[] orgs = null;
|
||||
|
||||
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Package.PackageId, false);
|
||||
|
||||
if ((orgs != null) & (orgs.GetLength(0) > 0))
|
||||
{
|
||||
foreach (Organization org in orgs)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(org.GlobalAddressList))
|
||||
{
|
||||
ExchangeMailboxPlan[] plans = ES.Services.ExchangeServer.GetExchangeMailboxPlans(org.Id);
|
||||
|
||||
ExchangeAccount[] mailboxes = ES.Services.ExchangeServer.GetAccounts(org.Id, ExchangeAccountType.Mailbox);
|
||||
|
||||
ExchangeAccount[] rooms = ES.Services.ExchangeServer.GetAccounts(org.Id, ExchangeAccountType.Room);
|
||||
|
||||
ExchangeAccount[] equipment = ES.Services.ExchangeServer.GetAccounts(org.Id, ExchangeAccountType.Equipment);
|
||||
|
||||
MatchExchangeAccountToPlan(org.Id, mailboxes, plans);
|
||||
MatchExchangeAccountToPlan(org.Id, rooms, plans);
|
||||
MatchExchangeAccountToPlan(org.Id, equipment, plans);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
messageBox.ShowSuccessMessage("EXCHANGE_MATCHPLANS");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
messageBox.ShowErrorMessage("EXCHANGE_MATCHPLANS", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void MatchExchangeAccountToPlan(int itemId, ExchangeAccount[] mailboxes, ExchangeMailboxPlan[] plans)
|
||||
{
|
||||
|
||||
foreach (ExchangeAccount a in mailboxes)
|
||||
{
|
||||
if (string.IsNullOrEmpty(a.MailboxPlan))
|
||||
{
|
||||
ExchangeMailbox mailbox = ES.Services.ExchangeServer.GetMailboxAdvancedSettings(itemId, a.AccountId);
|
||||
|
||||
if (mailbox != null)
|
||||
{
|
||||
List<ExchangeMailboxPlan> pl = new List<ExchangeMailboxPlan>();
|
||||
//sort a list of similar MAPI
|
||||
foreach (ExchangeMailboxPlan p in plans)
|
||||
{
|
||||
if (p.EnableMAPI == mailbox.EnableMAPI)
|
||||
pl.Add(p);
|
||||
}
|
||||
|
||||
//remove plans smaller than mailbox size
|
||||
ExchangeMailboxPlan p3 = null;
|
||||
foreach (ExchangeMailboxPlan p2 in pl)
|
||||
{
|
||||
if (p2.MailboxSizeMB >= (mailbox.ProhibitSendReceiveKB / 1024))
|
||||
{
|
||||
if (p3 == null)
|
||||
p3 = p2;
|
||||
else
|
||||
if ((p2.MailboxSizeMB) <= p3.MailboxSizeMB)
|
||||
p3 = p2;
|
||||
}
|
||||
}
|
||||
|
||||
// no matching plan, just match on size
|
||||
if (p3 == null)
|
||||
{
|
||||
foreach (ExchangeMailboxPlan p in plans)
|
||||
{
|
||||
if (p.MailboxSizeMB >= (mailbox.ProhibitSendReceiveKB / 1024))
|
||||
{
|
||||
if (p3 == null)
|
||||
p3 = p;
|
||||
else
|
||||
if ((p.MailboxSizeMB) <= p3.MailboxSizeMB)
|
||||
p3 = p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (p3 != null)
|
||||
ES.Services.ExchangeServer.SetExchangeMailboxPlan(itemId, a.AccountId, p3.MailboxPlanId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,32 +1,4 @@
|
|||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
|
@ -40,6 +12,24 @@ namespace WebsitePanel.Portal {
|
|||
|
||||
public partial class SettingsExchangeMailboxPlansPolicy {
|
||||
|
||||
/// <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>
|
||||
/// 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>
|
||||
/// gvMailboxPlans control.
|
||||
/// </summary>
|
||||
|
@ -381,5 +371,23 @@ namespace WebsitePanel.Portal {
|
|||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button btnAddMailboxPlan;
|
||||
|
||||
/// <summary>
|
||||
/// btnAddMailboxPlanToOrganizations 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 btnAddMailboxPlanToOrganizations;
|
||||
|
||||
/// <summary>
|
||||
/// btnMatchMailboxPlanToUser 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 btnMatchMailboxPlanToUser;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SettingsLyncUserPlansPolicy.ascx.cs" Inherits="WebsitePanel.Portal.SettingsLyncUserPlansPolicy" %>
|
||||
<%@ Register Src="UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %>
|
||||
<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %>
|
||||
<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
|
||||
|
||||
|
||||
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
|
||||
<wsp:SimpleMessageBox id="messageBox" runat="server" />
|
||||
<asp:GridView id="gvPlans" runat="server" EnableViewState="true" AutoGenerateColumns="false"
|
||||
Width="100%" EmptyDataText="gvPlans" CssSelectorClass="NormalGridView" OnRowCommand="gvPlan_RowCommand" >
|
||||
<Columns>
|
||||
|
@ -133,5 +136,9 @@
|
|||
Text="Add New plan" CssClass="Button1" OnClick="btnAddPlan_Click" />
|
||||
</div>
|
||||
|
||||
<div class="FormButtonsBarClean">
|
||||
<asp:Button ID="btnAddPlanToOrganizations" runat="server" meta:resourcekey="btnAddPlanToOrganizations"
|
||||
Text="Add Plans Template to All Organizations" CssClass="Button1" OnClick="btnAddPlanToOrganizations_Click" OnClientClick="if (confirm('Plans with an existing name will not be added. \nAre you sure you want to add the plans template to all tenants ?')) ShowProgressDialog('Adding plans, this might take a while ...'); else return false;"/>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -256,6 +256,75 @@ namespace WebsitePanel.Portal
|
|||
settings[UserSettings.DEFAULT_LYNCUSERPLANS] = writer.ToString();
|
||||
}
|
||||
|
||||
protected void btnAddPlanToOrganizations_Click(object sender, EventArgs e)
|
||||
{
|
||||
AddPlanToOrganizations("ServerAdmin");
|
||||
}
|
||||
|
||||
|
||||
private void AddPlanToOrganizations(string serverAdmin)
|
||||
{
|
||||
UserInfo ServerAdminInfo = ES.Services.Users.GetUserByUsername(serverAdmin);
|
||||
|
||||
if (ServerAdminInfo == null) return;
|
||||
|
||||
UserInfo[] UsersInfo = ES.Services.Users.GetUsers(ServerAdminInfo.UserId, true);
|
||||
|
||||
try
|
||||
{
|
||||
foreach (UserInfo ui in UsersInfo)
|
||||
{
|
||||
PackageInfo[] Packages = ES.Services.Packages.GetPackages(ui.UserId);
|
||||
|
||||
if ((Packages != null) & (Packages.GetLength(0) > 0))
|
||||
{
|
||||
foreach (PackageInfo Package in Packages)
|
||||
{
|
||||
Providers.HostedSolution.Organization[] orgs = null;
|
||||
|
||||
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Package.PackageId, false);
|
||||
|
||||
if ((orgs != null) & (orgs.GetLength(0) > 0))
|
||||
{
|
||||
foreach (Organization org in orgs)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(org.LyncTenantId))
|
||||
{
|
||||
LyncUserPlan[] plans = ES.Services.Lync.GetLyncUserPlans(org.Id);
|
||||
|
||||
foreach (LyncUserPlan p in list)
|
||||
{
|
||||
if (!PlanExists(p, plans)) ES.Services.Lync.AddLyncUserPlan(org.Id, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
messageBox.ShowSuccessMessage("LYNC_APPLYPLANTEMPLATE");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
messageBox.ShowErrorMessage("LYNC_APPLYPLANTEMPLATE", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private bool PlanExists(LyncUserPlan plan, LyncUserPlan[] plans)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
foreach (LyncUserPlan p in plans)
|
||||
{
|
||||
if (p.LyncUserPlanName.ToLower() == plan.LyncUserPlanName.ToLower())
|
||||
{
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,33 +1,4 @@
|
|||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
|
@ -41,6 +12,24 @@ namespace WebsitePanel.Portal {
|
|||
|
||||
public partial class SettingsLyncUserPlansPolicy {
|
||||
|
||||
/// <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>
|
||||
/// 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>
|
||||
/// gvPlans control.
|
||||
/// </summary>
|
||||
|
@ -229,5 +218,14 @@ namespace WebsitePanel.Portal {
|
|||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button btnAddPlan;
|
||||
|
||||
/// <summary>
|
||||
/// btnAddPlanToOrganizations 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 btnAddPlanToOrganizations;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace WebsitePanel.Portal
|
|||
lnkEditSpaceDetails.Visible = (PanelSecurity.PackageId > 1 && !ownSpace);
|
||||
|
||||
lnkDelete.NavigateUrl = EditUrl(PortalUtils.SPACE_ID_PARAM, PanelSecurity.PackageId.ToString(), "delete");
|
||||
if (PanelSecurity.LoggedUser.Role != UserRole.Reseller)
|
||||
if (!((PanelSecurity.LoggedUser.Role == UserRole.Reseller) | (PanelSecurity.LoggedUser.Role == UserRole.Administrator)))
|
||||
lnkDelete.Visible = false;
|
||||
else
|
||||
lnkDelete.Visible = ((PanelSecurity.SelectedUserId != PanelSecurity.EffectiveUserId) && (PanelSecurity.PackageId > 1));
|
||||
|
|
|
@ -40,13 +40,14 @@ namespace WebsitePanel.Portal.VPSForPC.RemoteDesktop
|
|||
resolution.Text = Request["Resolution"];
|
||||
|
||||
// load server info
|
||||
VirtualMachine vm = VirtualMachinesHelper.GetCachedVirtualMachine(PanelRequest.ItemID);
|
||||
VMInfo vm = ES.Services.VPSPC.GetCachedVirtualMachine(PanelRequest.ItemID);
|
||||
litServerName.Text = vm.Name + " - ";
|
||||
username.Text = "Administrator";
|
||||
password.Text = vm.AdministratorPassword;
|
||||
// TODO: Review VMInfo class fields and underlying data for correctness
|
||||
password.Text = vm.AdminPassword;
|
||||
|
||||
// load external network parameters
|
||||
NetworkAdapterDetails nic = ES.Services.VPS.GetExternalNetworkAdapterDetails(PanelRequest.ItemID);
|
||||
NetworkAdapterDetails nic = ES.Services.VPSPC.GetExternalNetworkAdapterDetails(PanelRequest.ItemID);
|
||||
if (nic.IPAddresses.Length > 0)
|
||||
{
|
||||
NetworkAdapterIPAddress ip = nic.IPAddresses[0];
|
||||
|
|
|
@ -66,7 +66,6 @@ namespace WebsitePanel.Portal
|
|||
new Tab { Id = "mime", ResourceKey = "Tab.MIMETypes", Quota = Quotas.WEB_MIME, ViewId = "tabMimes" },
|
||||
new Tab { Id = "coldfusion", ResourceKey = "Tab.ColdFusion", Quota = Quotas.WEB_COLDFUSION, ViewId = "tabCF" },
|
||||
new Tab { Id = "webman", ResourceKey = "Tab.WebManagement", Quota = Quotas.WEB_REMOTEMANAGEMENT, ViewId = "tabWebManagement" },
|
||||
new Tab { Id = "SSL", ResourceKey = "Tab.SSL", Quota = Quotas.WEB_SSL, ViewId = "SSL" },
|
||||
};
|
||||
|
||||
private int PackageId
|
||||
|
@ -166,6 +165,7 @@ namespace WebsitePanel.Portal
|
|||
|
||||
if (!String.IsNullOrEmpty(site.SiteIPAddress))
|
||||
litIPAddress.Text = String.Format("({0})", site.SiteIPAddress);
|
||||
|
||||
|
||||
litFrontPageUnavailable.Visible = false;
|
||||
tblSharePoint.Visible = site.SharePointInstalled;
|
||||
|
@ -234,7 +234,17 @@ namespace WebsitePanel.Portal
|
|||
webSitesMimeTypesControl.BindWebItem(site);
|
||||
webSitesCustomHeadersControl.BindWebItem(site);
|
||||
webSitesCustomErrorsControl.BindWebItem(site);
|
||||
WebsitesSSLControl.BindWebItem(site);
|
||||
if (site.SiteIPAddress != null)
|
||||
{
|
||||
TabsList.Add(new Tab { Id = "SSL", ResourceKey = "Tab.SSL", Quota = Quotas.WEB_SSL, ViewId = "SSL" });
|
||||
TabsList.ForEach((x) =>
|
||||
{
|
||||
x.Name = GetLocalizedString(x.ResourceKey);
|
||||
x.ResourceGroup = x.ResourceGroup ?? ResourceGroups.Web;
|
||||
});
|
||||
|
||||
WebsitesSSLControl.BindWebItem(site);
|
||||
}
|
||||
|
||||
BindVirtualDirectories();
|
||||
|
||||
|
|
|
@ -108,7 +108,12 @@ namespace WebsitePanel.Portal
|
|||
chkDedicatedPool.Visible = PackagesHelper.CheckGroupQuotaEnabled(packageId, ResourceGroups.Web, Quotas.WEB_APPPOOLS);
|
||||
pnlDefaultDocuments.Visible = PackagesHelper.CheckGroupQuotaEnabled(packageId, ResourceGroups.Web, Quotas.WEB_DEFAULTDOCS);
|
||||
|
||||
|
||||
UserSettings settings = ES.Services.Users.GetUserSettings(PanelSecurity.SelectedUserId, "WebPolicy");
|
||||
if (Utils.ParseBool(settings["EnableDedicatedPool"], false) == true)
|
||||
chkDedicatedPool.Checked = true;
|
||||
|
||||
chkDedicatedPool.Enabled = !(Utils.ParseBool(settings["EnableDedicatedPool"], false));
|
||||
|
||||
}
|
||||
|
||||
public void SaveWebItem(WebVirtualDirectory item)
|
||||
|
|
|
@ -2,5 +2,103 @@ SET WSDL="C:\Program Files (x86)\Microsoft WSE\v3.0\Tools\WseWsdl3.exe"
|
|||
SET WSE_CLEAN=..\Tools\WseClean.exe
|
||||
SET SERVER_URL=http://localhost:9005
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esApplicationsInstaller.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ApplicationsInstallerProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ApplicationsInstallerProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esAuditLog.asmx /out:.\WebsitePanel.EnterpriseServer.Client\AuditLogProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\AuditLogProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esAuthentication.asmx /out:.\WebsitePanel.EnterpriseServer.Client\AuthenticationProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\AuthenticationProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esBackup.asmx /out:.\WebsitePanel.EnterpriseServer.Client\BackupProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\BackupProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esBlackBerry.asmx /out:.\WebsitePanel.EnterpriseServer.Client\BlackBerryProxy.cs /namespace:WebsitePanel.EnterpriseServer.HostedSolution /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\BlackBerryProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esComments.asmx /out:.\WebsitePanel.EnterpriseServer.Client\CommentsProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\CommentsProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esCRM.asmx /out:.\WebsitePanel.EnterpriseServer.Client\CRMProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\CRMProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esDatabaseServers.asmx /out:.\WebsitePanel.EnterpriseServer.Client\DatabaseServersProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\DatabaseServersProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/ecServiceHandler.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ecServiceHandlerProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ecServiceHandlerProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/ecStorefront.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ecStorefrontProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ecStorefrontProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/ecStorehouse.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ecStorehouseProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ecStorehouseProxy.cs
|
||||
|
||||
%WSDL% %SERVER_URL%/esExchangeServer.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ExchangeServerProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
%WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ExchangeServerProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esExchangeHostedEdition.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ExchangeHostedEditionProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ExchangeHostedEditionProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esFiles.asmx /out:.\WebsitePanel.EnterpriseServer.Client\FilesProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\FilesProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esHostedSharePointServers.asmx /out:.\WebsitePanel.EnterpriseServer.Client\HostedSharePointServersProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\HostedSharePointServersProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esImport.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ImportProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ImportProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esOCS.asmx /out:.\WebsitePanel.EnterpriseServer.Client\OCSProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\OCSProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esOperatingSystems.asmx /out:.\WebsitePanel.EnterpriseServer.Client\OperatingSystemsProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\OperatingSystemsProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esOrganizations.asmx /out:.\WebsitePanel.EnterpriseServer.Client\OrganizationProxy.cs /namespace:WebsitePanel.EnterpriseServer.HostedSolution /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\OrganizationProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esPackages.asmx /out:.\WebsitePanel.EnterpriseServer.Client\PackagesProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\PackagesProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esScheduler.asmx /out:.\WebsitePanel.EnterpriseServer.Client\SchedulerProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\SchedulerProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esServers.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ServersProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ServersProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esSharePointServers.asmx /out:.\WebsitePanel.EnterpriseServer.Client\SharePointServersProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\SharePointServersProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esSystem.asmx /out:.\WebsitePanel.EnterpriseServer.Client\SystemProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\SystemProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esTasks.asmx /out:.\WebsitePanel.EnterpriseServer.Client\TasksProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\TasksProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esUsers.asmx /out:.\WebsitePanel.EnterpriseServer.Client\UsersProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\UsersProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esVirtualizationServer.asmx /out:.\WebsitePanel.EnterpriseServer.Client\VirtualizationServerProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\VirtualizationServerProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esWebApplicationGallery.asmx /out:.\WebsitePanel.EnterpriseServer.Client\WebApplicationGalleryProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\WebApplicationGalleryProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esWebServers.asmx /out:.\WebsitePanel.EnterpriseServer.Client\WebServersProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\WebServersProxy.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esVirtualizationServerForPrivateCloud.asmx /out:.\WebsitePanel.EnterpriseServer.Client\VirtualizationServerProxyForPrivateCloud.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\VirtualizationServerProxyForPrivateCloud.cs
|
||||
|
||||
REM %WSDL% %SERVER_URL%/esLync.asmx /out:.\WebsitePanel.EnterpriseServer.Client\LyncProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
|
||||
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\LyncProxy.cs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="C:\Program Files\MSBuild\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
|
||||
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
|
||||
<PropertyGroup>
|
||||
<Version>1.2.2.0</Version>
|
||||
<FileVersion>1.2.2.1</FileVersion>
|
||||
<VersionLabel>1.2.2</VersionLabel>
|
||||
<ReleaseDate>2012-05-13</ReleaseDate>
|
||||
<ReleaseDate>2012-08-01</ReleaseDate>
|
||||
<BuildConfiguration>Release</BuildConfiguration>
|
||||
<RootFolder>..</RootFolder>
|
||||
<TrunkFolder>$(RootFolder)\WebsitePanel</TrunkFolder>
|
||||
|
@ -15,12 +15,13 @@
|
|||
<BuildFolder>$(TrunkFolder)\Build\$(BuildConfiguration)</BuildFolder>
|
||||
<DeployFolder>$(TrunkFolder)\Deploy\$(BuildConfiguration)</DeployFolder>
|
||||
|
||||
<PreviousBuildFolder>C:\Projects\WebsitePanel-1.2.1\$(BuildConfiguration)</PreviousBuildFolder>
|
||||
<PreviousBuildFolder>$(RootFolder)\..\prev\$(BuildConfiguration)</PreviousBuildFolder>
|
||||
|
||||
<DiffCmd>$(TrunkFolder)\Tools\Diff.exe</DiffCmd>
|
||||
<SqlCmd>"C:\Program Files\Microsoft SQL Server\110\Tools\Binn\sqlcmd.exe" -S (local)\SQLEXPRESS -E</SqlCmd>
|
||||
<SqlCmd>"$(ProgramFiles)\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe" -S (local)\SQLEXPRESS -E</SqlCmd>
|
||||
|
||||
<MSDeployPath>"C:\Program Files\IIS\Microsoft Web Deploy V2\msdeploy.exe"</MSDeployPath>
|
||||
<MSDeployPath Condition="Exists('$(ProgramFiles)\IIS\Microsoft Web Deploy\msdeploy.exe')">"$(ProgramFiles)\IIS\Microsoft Web Deploy\msdeploy.exe"</MSDeployPath>
|
||||
<MSDeployPath Condition="Exists('$(ProgramFiles)\IIS\Microsoft Web Deploy V2\msdeploy.exe')">"$(ProgramFiles)\IIS\Microsoft Web Deploy V2\msdeploy.exe"</MSDeployPath>
|
||||
|
||||
<DataBaseName>WebsitePanel_build</DataBaseName>
|
||||
<MSDeployConnectionString>server=(local)\SQLEXPRESS;database=$(DataBaseName);Integrated Security=true;</MSDeployConnectionString>
|
||||
|
@ -31,7 +32,8 @@
|
|||
<ImportCsvSrc>$(TrunkFolder)\Sources\Tools\WebsitePanel.Import.CsvBulk\bin\$(BuildConfiguration)</ImportCsvSrc>
|
||||
<ImportEnterpriseSrc>$(TrunkFolder)\Sources\Tools\WebsitePanel.Import.Enterprise\bin\$(BuildConfiguration)</ImportEnterpriseSrc>
|
||||
<AWStatsViewerSrc>$(TrunkFolder)\Sources\Tools\WebsitePanel.AWStats.Viewer</AWStatsViewerSrc>
|
||||
<WSPTransportAgentSrc>$(TrunkFolder)\Sources\Tools\WSPTransportAgent</WSPTransportAgentSrc>
|
||||
|
||||
<WSPTransportAgentSrc>$(TrunkFolder)\Sources\Tools\WSPTransportAgent</WSPTransportAgentSrc>
|
||||
|
||||
<ServerBuild>$(BuildFolder)\Server</ServerBuild>
|
||||
<EnterpriseServerBuild>$(BuildFolder)\EnterpriseServer</EnterpriseServerBuild>
|
||||
|
@ -39,17 +41,14 @@
|
|||
<ImportCsvBuild>$(BuildFolder)\Import.CsvBulk</ImportCsvBuild>
|
||||
<ImportEnterpriseBuild>$(BuildFolder)\Import.Enterprise</ImportEnterpriseBuild>
|
||||
<AWStatsViewerBuild>$(BuildFolder)\AWStats.Viewer</AWStatsViewerBuild>
|
||||
<WSPTransportAgentBuild>$(BuildFolder)\WSPTransportAgent</WSPTransportAgentBuild>
|
||||
|
||||
|
||||
</PropertyGroup>
|
||||
<WSPTransportAgentBuild>$(BuildFolder)\WSPTransportAgent</WSPTransportAgentBuild>
|
||||
|
||||
|
||||
<Target Name="GenerateBuildVersionFiles" Inputs="build.xml" Outputs="$(TrunkFolder)\Sources\VersionInfo.cs;$(TrunkFolder)\Sources\VersionInfo.vb">
|
||||
<AssemblyInfo CodeLanguage="CS" OutputFile="$(TrunkFolder)\Sources\VersionInfo.cs" AssemblyCompany="Outercurve Foundation" AssemblyCopyright="Copyright © 2012 Outercurve Foundation."
|
||||
AssemblyVersion="$(Version)" AssemblyFileVersion="$(FileVersion)" AssemblyInformationalVersion="$(VersionLabel)" />
|
||||
<AssemblyInfo CodeLanguage="VB" OutputFile="$(TrunkFolder)\Sources\VersionInfo.vb" AssemblyCompany="Outercurve Foundation" AssemblyCopyright="Copyright © 2012 Outercurve Foundation."
|
||||
AssemblyVersion="$(Version)" AssemblyFileVersion="$(FileVersion)" AssemblyInformationalVersion="$(VersionLabel)" />
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="GenerateBuildVersionFiles" Inputs="build.xml" Outputs="$(TrunkFolder)\Sources\VersionInfo.cs;$(TrunkFolder)\Sources\VersionInfo.vb">
|
||||
<AssemblyInfo CodeLanguage="CS" OutputFile="$(TrunkFolder)\Sources\VersionInfo.cs" AssemblyCompany="Outercurve Foundation" AssemblyCopyright="Copyright © 2012 Outercurve Foundation." AssemblyVersion="$(Version)" AssemblyFileVersion="$(FileVersion)" AssemblyInformationalVersion="$(VersionLabel)" />
|
||||
<AssemblyInfo CodeLanguage="VB" OutputFile="$(TrunkFolder)\Sources\VersionInfo.vb" AssemblyCompany="Outercurve Foundation" AssemblyCopyright="Copyright © 2012 Outercurve Foundation." AssemblyVersion="$(Version)" AssemblyFileVersion="$(FileVersion)" AssemblyInformationalVersion="$(VersionLabel)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="CompileSources" DependsOnTargets="GenerateBuildVersionFiles">
|
||||
|
@ -60,7 +59,7 @@
|
|||
<MSBuild Projects="$(TrunkFolder)\Sources\Tools\WebsitePanel.Import.CsvBulk.sln" Properties="Configuration=$(BuildConfiguration)" />
|
||||
<MSBuild Projects="$(TrunkFolder)\Sources\Tools\WebsitePanel.Import.Enterprise.sln" Properties="Configuration=$(BuildConfiguration)" />
|
||||
<MSBuild Projects="$(TrunkFolder)\Sources\Tools\WebsitePanel.AWStats.Viewer.sln" Properties="Configuration=$(BuildConfiguration)" />
|
||||
<MSBuild Projects="$(TrunkFolder)\Sources\Tools\WSPTransportAgent.sln" Properties="Configuration=$(BuildConfiguration)" />
|
||||
<MSBuild Projects="$(TrunkFolder)\Sources\Tools\WSPTransportAgent.sln" Properties="Configuration=$(BuildConfiguration)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="PrepareBuilds" DependsOnTargets="CompileSources">
|
||||
|
@ -71,7 +70,7 @@
|
|||
<RemoveDir Directories="$(ImportCsvBuild)"/>
|
||||
<RemoveDir Directories="$(ImportEnterpriseBuild)"/>
|
||||
<RemoveDir Directories="$(AWStatsViewerBuild)"/>
|
||||
<RemoveDir Directories="$(WSPTransportAgentBuild)"/>
|
||||
<RemoveDir Directories="$(WSPTransportAgentBuild)"/>
|
||||
<RemoveDir Directories="$(BuildFolder)"/>
|
||||
|
||||
<MakeDir Directories="$(BuildFolder)"/>
|
||||
|
@ -81,7 +80,7 @@
|
|||
<MakeDir Directories="$(ImportCsvBuild)"/>
|
||||
<MakeDir Directories="$(ImportEnterpriseBuild)"/>
|
||||
<MakeDir Directories="$(AWStatsViewerBuild)"/>
|
||||
<MakeDir Directories="$(WSPTransportAgentBuild)"/>
|
||||
<MakeDir Directories="$(WSPTransportAgentBuild)"/>
|
||||
</Target>
|
||||
|
||||
<Target Name="CreateServerBuild" DependsOnTargets="PrepareBuilds">
|
||||
|
@ -191,7 +190,7 @@
|
|||
<!-- Do nothing -->
|
||||
</Target>
|
||||
|
||||
<Target Name="CreateWSPTransportAgentBuild" DependsOnTargets="CreateImportEnterpriseBuild">
|
||||
<Target Name="CreateWSPTransportAgentBuild" DependsOnTargets="CreateImportEnterpriseBuild">
|
||||
<ItemGroup>
|
||||
<WSPTransportAgentBuildExclude Include="$(WSPTransportAgentSrc)\**\.svn\**" />
|
||||
<WSPTransportAgentBuildExclude Include="$(WSPTransportAgentSrc)\**\obj\**" />
|
||||
|
@ -228,7 +227,7 @@
|
|||
<ImportCsvInstall>$(ToolsFolder)\Import.CsvBulk</ImportCsvInstall>
|
||||
<ImportEnterpriseInstall>$(ToolsFolder)\Import.Enterprise</ImportEnterpriseInstall>
|
||||
<AWStatsViewerInstall>$(ToolsFolder)\AWStats.Viewer</AWStatsViewerInstall>
|
||||
<WSPTransportAgentInstall>$(ToolsFolder)\WSPTransportAgent</WSPTransportAgentInstall>
|
||||
<WSPTransportAgentInstall>$(ToolsFolder)\WSPTransportAgent</WSPTransportAgentInstall>
|
||||
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -349,8 +348,8 @@
|
|||
<PropertyGroup>
|
||||
<DatabaseFolder>$(DeployFolder)\Database</DatabaseFolder>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="CreateEnterpriseServerDatabase" DependsOnTargets="CreatePortalUpdate">
|
||||
|
||||
<Target Name="CreateEnterpriseServerDatabase" DependsOnTargets="CreatePortalUpdate">
|
||||
<MakeDir Directories="$(DatabaseFolder)"/>
|
||||
|
||||
<Exec Command="$(SqlCmd) -Q "IF DB_ID (N'$(DataBaseName)') IS NOT NULL DROP DATABASE $(DataBaseName)"" />
|
||||
|
@ -461,7 +460,7 @@
|
|||
<Zip Files="@(ImportCsvInstallFiles)" ZipFileName="$(ToolsFolder)\WebsitePanel-Import-CsvBulk-$(FileVersion).zip" WorkingDirectory="$(ImportCsvInstall)" />
|
||||
<Zip Files="@(ImportEnterpriseInstallFiles)" ZipFileName="$(ToolsFolder)\WebsitePanel-Import-Enterprise-$(FileVersion).zip" WorkingDirectory="$(ImportEnterpriseInstall)" />
|
||||
<Zip Files="@(AWStatsViewerInstallFiles)" ZipFileName="$(ToolsFolder)\WebsitePanel-AWStatsViewer-$(FileVersion).zip" WorkingDirectory="$(AWStatsViewerInstall)" />
|
||||
<Zip Files="@(WSPTransportAgentInstallFiles)" ZipFileName="$(ToolsFolder)\WebsitePanel-WSPTransportAgent-$(FileVersion).zip" WorkingDirectory="$(WSPTransportAgentInstall)" />
|
||||
<Zip Files="@(WSPTransportAgentInstallFiles)" ZipFileName="$(ToolsFolder)\WebsitePanel-WSPTransportAgent-$(FileVersion).zip" WorkingDirectory="$(WSPTransportAgentInstall)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -1 +1 @@
|
|||
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe build.xml /target:Deploy /property:BuildConfiguration=Debug /v:n /fileLogger /m
|
||||
%windir%\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe build.xml /target:Deploy /property:BuildConfiguration=Debug /v:n /fileLogger /m
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue