This commit is contained in:
alexY 2015-04-27 17:07:41 +03:00
commit 81fa984bdc
180 changed files with 13490 additions and 1913 deletions

File diff suppressed because it is too large Load diff

View file

@ -969,13 +969,13 @@ namespace WebsitePanel.Import.Enterprise
{
return DataProvider.AddExchangeAccount(itemId, (int)accountType,
accountName, displayName, primaryEmailAddress, mailEnabledPublicFolder,
mailboxManagerActions.ToString(), samAccountName, CryptoUtils.Encrypt(accountPassword),0, string.Empty);
mailboxManagerActions.ToString(), samAccountName,0, string.Empty);
}
private static int AddOrganizationUser(int itemId, string accountName, string displayName, string email, string samAccountName, string accountPassword)
{
return DataProvider.AddExchangeAccount(itemId, (int)ExchangeAccountType.User, accountName, displayName, email, false, string.Empty,
samAccountName, CryptoUtils.Encrypt(accountPassword), 0 , string.Empty);
samAccountName, 0 , string.Empty);
}
@ -996,7 +996,7 @@ namespace WebsitePanel.Import.Enterprise
mailEnabledPublicFolder,
mailboxManagerActions,
samAccountName,
CryptoUtils.Encrypt(accountPassword), mailboxPlanId , -1, string.Empty, false);
mailboxPlanId , -1, string.Empty, false);
}
}
}

View file

@ -0,0 +1,18 @@
using System;
namespace WebsitePanel.EnterpriseServer.Base.HostedSolution
{
public class AccessToken
{
public int Id { get; set; }
public Guid AccessTokenGuid { get; set; }
public DateTime ExpirationDate { get; set; }
public int AccountId { get; set; }
public int ItemId { get; set; }
public AccessTokenTypes TokenType { get; set; }
public string SmsResponse { get; set; }
public bool IsSmsSent {
get { return !string.IsNullOrEmpty(SmsResponse); }
}
}
}

View file

@ -0,0 +1,7 @@
namespace WebsitePanel.EnterpriseServer.Base.HostedSolution
{
public enum AccessTokenTypes
{
PasswrodReset = 1
}
}

View file

@ -27,6 +27,7 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Linq;
using System.Xml;
using System.Collections.Generic;
using System.Text;
@ -45,6 +46,8 @@ namespace WebsitePanel.EnterpriseServer
public const string FILEMANAGER_SETTINGS = "FileManagerSettings";
public const string PACKAGE_DISPLAY_SETTINGS = "PackageDisplaySettings";
public const string RDS_SETTINGS = "RdsSettings";
public const string WEBDAV_PORTAL_SETTINGS = "WebdavPortalSettings";
public const string WEBDAV_PASSWORD_RESET_ENABLED_KEY = "WebdavPswResetEnabled";
// key to access to wpi main & custom feed in wpi settings
public const string WPI_MAIN_FEED_KEY = "WpiMainFeedUrl";
@ -97,7 +100,25 @@ namespace WebsitePanel.EnterpriseServer
}
}
public int GetInt(string settingName)
public bool Contains(string settingName)
{
return Settings.AllKeys.Any(x => x.ToLowerInvariant() == (settingName ?? string.Empty).ToLowerInvariant());
}
public T GetValueOrDefault<T>(string settingName, T defaultValue)
{
try
{
return (T)Convert.ChangeType(Settings[settingName], typeof(T));
}
catch
{
}
return defaultValue;
}
public int GetInt(string settingName)
{
return Int32.Parse(Settings[settingName]);
}

View file

@ -65,6 +65,10 @@ namespace WebsitePanel.EnterpriseServer
public const string DEFAULT_LYNCUSERPLANS = "DefaultLyncUserPlans";
public const string RDS_SETUP_LETTER = "RDSSetupLetter";
public const string RDS_POLICY = "RdsPolicy";
public const string USER_PASSWORD_EXPIRATION_LETTER = "UserPasswordExpirationLetter";
public const string USER_PASSWORD_RESET_LETTER = "UserPasswordResetLetter";
public const string HOSTED_ORGANIZATION_PASSWORD_POLICY = "MailboxPasswordPolicy";
public int UserId;
public string SettingsName;

View file

@ -114,7 +114,13 @@
public const string EJECT_DVD_DISK_ERROR = "VPS_EJECT_DVD_DISK_ERROR";
// Replication
public const string SET_REPLICA_SERVER_ERROR = "SET_REPLICA_SERVER_ERROR";
public const string SET_REPLICA_SERVER_ERROR = "VPS_SET_REPLICA_SERVER_ERROR";
public const string UNSET_REPLICA_SERVER_ERROR = "VPS_UNSET_REPLICA_SERVER_ERROR";
public const string NO_REPLICA_SERVER_ERROR = "VPS_NO_REPLICA_SERVER_ERROR";
public const string SET_REPLICATION_ERROR = "VPS_SET_REPLICATION_ERROR";
public const string DISABLE_REPLICATION_ERROR = "VPS_DISABLE_REPLICATION_ERROR";
public const string PAUSE_REPLICATION_ERROR = "VPS_PAUSE_REPLICATION_ERROR";
public const string RESUME_REPLICATION_ERROR = "VPS_RESUME_REPLICATION_ERROR";
public const string HOST_NAMER_IS_ALREADY_USED = "HOST_NAMER_IS_ALREADY_USED";

View file

@ -116,10 +116,12 @@
<Compile Include="Ecommerce\TransactionResult.cs" />
<Compile Include="Ecommerce\TriggerSystem\ITriggerHandler.cs" />
<Compile Include="ExchangeServer\ExchangeEmailAddress.cs" />
<Compile Include="HostedSolution\AccessTokenTypes.cs" />
<Compile Include="HostedSolution\AdditionalGroup.cs" />
<Compile Include="HostedSolution\ServiceLevel.cs" />
<Compile Include="HostedSolution\CRMLycenseTypes.cs" />
<Compile Include="HostedSolution\ESPermission.cs" />
<Compile Include="HostedSolution\AccessToken.cs" />
<Compile Include="HostedSolution\WebDavAccessToken.cs" />
<Compile Include="Log\LogRecord.cs" />
<Compile Include="Packages\ServiceLevelQuotaValueInfo.cs" />

View file

@ -148,7 +148,21 @@ namespace WebsitePanel.EnterpriseServer {
private System.Threading.SendOrPostCallback SetReplicaServerOperationCompleted;
private System.Threading.SendOrPostCallback IsReplicaServerOperationCompleted;
private System.Threading.SendOrPostCallback UnsetReplicaServerOperationCompleted;
private System.Threading.SendOrPostCallback GetReplicaServerOperationCompleted;
private System.Threading.SendOrPostCallback GetReplicationOperationCompleted;
private System.Threading.SendOrPostCallback GetReplicationInfoOperationCompleted;
private System.Threading.SendOrPostCallback SetVmReplicationOperationCompleted;
private System.Threading.SendOrPostCallback DisableVmReplicationOperationCompleted;
private System.Threading.SendOrPostCallback PauseReplicationOperationCompleted;
private System.Threading.SendOrPostCallback ResumeReplicationOperationCompleted;
/// <remarks/>
public esVirtualizationServer2012() {
@ -327,7 +341,28 @@ namespace WebsitePanel.EnterpriseServer {
public event SetReplicaServerCompletedEventHandler SetReplicaServerCompleted;
/// <remarks/>
public event IsReplicaServerCompletedEventHandler IsReplicaServerCompleted;
public event UnsetReplicaServerCompletedEventHandler UnsetReplicaServerCompleted;
/// <remarks/>
public event GetReplicaServerCompletedEventHandler GetReplicaServerCompleted;
/// <remarks/>
public event GetReplicationCompletedEventHandler GetReplicationCompleted;
/// <remarks/>
public event GetReplicationInfoCompletedEventHandler GetReplicationInfoCompleted;
/// <remarks/>
public event SetVmReplicationCompletedEventHandler SetVmReplicationCompleted;
/// <remarks/>
public event DisableVmReplicationCompletedEventHandler DisableVmReplicationCompleted;
/// <remarks/>
public event PauseReplicationCompletedEventHandler PauseReplicationCompleted;
/// <remarks/>
public event ResumeReplicationCompletedEventHandler ResumeReplicationCompleted;
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetVirtualMachines", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
@ -3234,46 +3269,339 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/IsReplicaServer", 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 IsReplicaServer(int serviceId, string remoteServer) {
object[] results = this.Invoke("IsReplicaServer", new object[] {
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/UnsetReplicaServer", 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 UnsetReplicaServer(int serviceId, string remoteServer) {
object[] results = this.Invoke("UnsetReplicaServer", new object[] {
serviceId,
remoteServer});
return ((bool)(results[0]));
return ((ResultObject)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginIsReplicaServer(int serviceId, string remoteServer, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("IsReplicaServer", new object[] {
public System.IAsyncResult BeginUnsetReplicaServer(int serviceId, string remoteServer, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("UnsetReplicaServer", new object[] {
serviceId,
remoteServer}, callback, asyncState);
}
/// <remarks/>
public bool EndIsReplicaServer(System.IAsyncResult asyncResult) {
public ResultObject EndUnsetReplicaServer(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((bool)(results[0]));
return ((ResultObject)(results[0]));
}
/// <remarks/>
public void IsReplicaServerAsync(int serviceId, string remoteServer) {
this.IsReplicaServerAsync(serviceId, remoteServer, null);
public void UnsetReplicaServerAsync(int serviceId, string remoteServer) {
this.UnsetReplicaServerAsync(serviceId, remoteServer, null);
}
/// <remarks/>
public void IsReplicaServerAsync(int serviceId, string remoteServer, object userState) {
if ((this.IsReplicaServerOperationCompleted == null)) {
this.IsReplicaServerOperationCompleted = new System.Threading.SendOrPostCallback(this.OnIsReplicaServerOperationCompleted);
public void UnsetReplicaServerAsync(int serviceId, string remoteServer, object userState) {
if ((this.UnsetReplicaServerOperationCompleted == null)) {
this.UnsetReplicaServerOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUnsetReplicaServerOperationCompleted);
}
this.InvokeAsync("IsReplicaServer", new object[] {
this.InvokeAsync("UnsetReplicaServer", new object[] {
serviceId,
remoteServer}, this.IsReplicaServerOperationCompleted, userState);
remoteServer}, this.UnsetReplicaServerOperationCompleted, userState);
}
private void OnIsReplicaServerOperationCompleted(object arg) {
if ((this.IsReplicaServerCompleted != null)) {
private void OnUnsetReplicaServerOperationCompleted(object arg) {
if ((this.UnsetReplicaServerCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.IsReplicaServerCompleted(this, new IsReplicaServerCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
this.UnsetReplicaServerCompleted(this, new UnsetReplicaServerCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetReplicaServer", 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 ReplicationServerInfo GetReplicaServer(int serviceId, string remoteServer) {
object[] results = this.Invoke("GetReplicaServer", new object[] {
serviceId,
remoteServer});
return ((ReplicationServerInfo)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetReplicaServer(int serviceId, string remoteServer, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetReplicaServer", new object[] {
serviceId,
remoteServer}, callback, asyncState);
}
/// <remarks/>
public ReplicationServerInfo EndGetReplicaServer(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((ReplicationServerInfo)(results[0]));
}
/// <remarks/>
public void GetReplicaServerAsync(int serviceId, string remoteServer) {
this.GetReplicaServerAsync(serviceId, remoteServer, null);
}
/// <remarks/>
public void GetReplicaServerAsync(int serviceId, string remoteServer, object userState) {
if ((this.GetReplicaServerOperationCompleted == null)) {
this.GetReplicaServerOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetReplicaServerOperationCompleted);
}
this.InvokeAsync("GetReplicaServer", new object[] {
serviceId,
remoteServer}, this.GetReplicaServerOperationCompleted, userState);
}
private void OnGetReplicaServerOperationCompleted(object arg) {
if ((this.GetReplicaServerCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetReplicaServerCompleted(this, new GetReplicaServerCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetReplication", 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 VmReplication GetReplication(int itemId) {
object[] results = this.Invoke("GetReplication", new object[] {
itemId});
return ((VmReplication)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetReplication(int itemId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetReplication", new object[] {
itemId}, callback, asyncState);
}
/// <remarks/>
public VmReplication EndGetReplication(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((VmReplication)(results[0]));
}
/// <remarks/>
public void GetReplicationAsync(int itemId) {
this.GetReplicationAsync(itemId, null);
}
/// <remarks/>
public void GetReplicationAsync(int itemId, object userState) {
if ((this.GetReplicationOperationCompleted == null)) {
this.GetReplicationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetReplicationOperationCompleted);
}
this.InvokeAsync("GetReplication", new object[] {
itemId}, this.GetReplicationOperationCompleted, userState);
}
private void OnGetReplicationOperationCompleted(object arg) {
if ((this.GetReplicationCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetReplicationCompleted(this, new GetReplicationCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetReplicationInfo", 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 ReplicationDetailInfo GetReplicationInfo(int itemId) {
object[] results = this.Invoke("GetReplicationInfo", new object[] {
itemId});
return ((ReplicationDetailInfo)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetReplicationInfo(int itemId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetReplicationInfo", new object[] {
itemId}, callback, asyncState);
}
/// <remarks/>
public ReplicationDetailInfo EndGetReplicationInfo(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((ReplicationDetailInfo)(results[0]));
}
/// <remarks/>
public void GetReplicationInfoAsync(int itemId) {
this.GetReplicationInfoAsync(itemId, null);
}
/// <remarks/>
public void GetReplicationInfoAsync(int itemId, object userState) {
if ((this.GetReplicationInfoOperationCompleted == null)) {
this.GetReplicationInfoOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetReplicationInfoOperationCompleted);
}
this.InvokeAsync("GetReplicationInfo", new object[] {
itemId}, this.GetReplicationInfoOperationCompleted, userState);
}
private void OnGetReplicationInfoOperationCompleted(object arg) {
if ((this.GetReplicationInfoCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetReplicationInfoCompleted(this, new GetReplicationInfoCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetVmReplication", 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 SetVmReplication(int itemId, VmReplication replication) {
object[] results = this.Invoke("SetVmReplication", new object[] {
itemId,
replication});
return ((ResultObject)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginSetVmReplication(int itemId, VmReplication replication, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("SetVmReplication", new object[] {
itemId,
replication}, callback, asyncState);
}
/// <remarks/>
public ResultObject EndSetVmReplication(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((ResultObject)(results[0]));
}
/// <remarks/>
public void SetVmReplicationAsync(int itemId, VmReplication replication) {
this.SetVmReplicationAsync(itemId, replication, null);
}
/// <remarks/>
public void SetVmReplicationAsync(int itemId, VmReplication replication, object userState) {
if ((this.SetVmReplicationOperationCompleted == null)) {
this.SetVmReplicationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetVmReplicationOperationCompleted);
}
this.InvokeAsync("SetVmReplication", new object[] {
itemId,
replication}, this.SetVmReplicationOperationCompleted, userState);
}
private void OnSetVmReplicationOperationCompleted(object arg) {
if ((this.SetVmReplicationCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.SetVmReplicationCompleted(this, new SetVmReplicationCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/DisableVmReplication", 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 DisableVmReplication(int itemId) {
object[] results = this.Invoke("DisableVmReplication", new object[] {
itemId});
return ((ResultObject)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginDisableVmReplication(int itemId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("DisableVmReplication", new object[] {
itemId}, callback, asyncState);
}
/// <remarks/>
public ResultObject EndDisableVmReplication(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((ResultObject)(results[0]));
}
/// <remarks/>
public void DisableVmReplicationAsync(int itemId) {
this.DisableVmReplicationAsync(itemId, null);
}
/// <remarks/>
public void DisableVmReplicationAsync(int itemId, object userState) {
if ((this.DisableVmReplicationOperationCompleted == null)) {
this.DisableVmReplicationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDisableVmReplicationOperationCompleted);
}
this.InvokeAsync("DisableVmReplication", new object[] {
itemId}, this.DisableVmReplicationOperationCompleted, userState);
}
private void OnDisableVmReplicationOperationCompleted(object arg) {
if ((this.DisableVmReplicationCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.DisableVmReplicationCompleted(this, new DisableVmReplicationCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/PauseReplication", 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 PauseReplication(int itemId) {
object[] results = this.Invoke("PauseReplication", new object[] {
itemId});
return ((ResultObject)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginPauseReplication(int itemId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("PauseReplication", new object[] {
itemId}, callback, asyncState);
}
/// <remarks/>
public ResultObject EndPauseReplication(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((ResultObject)(results[0]));
}
/// <remarks/>
public void PauseReplicationAsync(int itemId) {
this.PauseReplicationAsync(itemId, null);
}
/// <remarks/>
public void PauseReplicationAsync(int itemId, object userState) {
if ((this.PauseReplicationOperationCompleted == null)) {
this.PauseReplicationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnPauseReplicationOperationCompleted);
}
this.InvokeAsync("PauseReplication", new object[] {
itemId}, this.PauseReplicationOperationCompleted, userState);
}
private void OnPauseReplicationOperationCompleted(object arg) {
if ((this.PauseReplicationCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.PauseReplicationCompleted(this, new PauseReplicationCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/ResumeReplication", 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 ResumeReplication(int itemId) {
object[] results = this.Invoke("ResumeReplication", new object[] {
itemId});
return ((ResultObject)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginResumeReplication(int itemId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("ResumeReplication", new object[] {
itemId}, callback, asyncState);
}
/// <remarks/>
public ResultObject EndResumeReplication(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((ResultObject)(results[0]));
}
/// <remarks/>
public void ResumeReplicationAsync(int itemId) {
this.ResumeReplicationAsync(itemId, null);
}
/// <remarks/>
public void ResumeReplicationAsync(int itemId, object userState) {
if ((this.ResumeReplicationOperationCompleted == null)) {
this.ResumeReplicationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnResumeReplicationOperationCompleted);
}
this.InvokeAsync("ResumeReplication", new object[] {
itemId}, this.ResumeReplicationOperationCompleted, userState);
}
private void OnResumeReplicationOperationCompleted(object arg) {
if ((this.ResumeReplicationCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.ResumeReplicationCompleted(this, new ResumeReplicationCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
@ -4767,26 +5095,208 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void IsReplicaServerCompletedEventHandler(object sender, IsReplicaServerCompletedEventArgs e);
public delegate void UnsetReplicaServerCompletedEventHandler(object sender, UnsetReplicaServerCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class IsReplicaServerCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
public partial class UnsetReplicaServerCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal IsReplicaServerCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
internal UnsetReplicaServerCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public bool Result {
public ResultObject Result {
get {
this.RaiseExceptionIfNecessary();
return ((bool)(this.results[0]));
return ((ResultObject)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void GetReplicaServerCompletedEventHandler(object sender, GetReplicaServerCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetReplicaServerCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetReplicaServerCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public ReplicationServerInfo Result {
get {
this.RaiseExceptionIfNecessary();
return ((ReplicationServerInfo)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void GetReplicationCompletedEventHandler(object sender, GetReplicationCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetReplicationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetReplicationCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public VmReplication Result {
get {
this.RaiseExceptionIfNecessary();
return ((VmReplication)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void GetReplicationInfoCompletedEventHandler(object sender, GetReplicationInfoCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetReplicationInfoCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetReplicationInfoCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public ReplicationDetailInfo Result {
get {
this.RaiseExceptionIfNecessary();
return ((ReplicationDetailInfo)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void SetVmReplicationCompletedEventHandler(object sender, SetVmReplicationCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class SetVmReplicationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal SetVmReplicationCompletedEventArgs(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.42")]
public delegate void DisableVmReplicationCompletedEventHandler(object sender, DisableVmReplicationCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class DisableVmReplicationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal DisableVmReplicationCompletedEventArgs(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.42")]
public delegate void PauseReplicationCompletedEventHandler(object sender, PauseReplicationCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class PauseReplicationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal PauseReplicationCompletedEventArgs(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.42")]
public delegate void ResumeReplicationCompletedEventHandler(object sender, ResumeReplicationCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class ResumeReplicationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal ResumeReplicationCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public ResultObject Result {
get {
this.RaiseExceptionIfNecessary();
return ((ResultObject)(this.results[0]));
}
}
}

View file

@ -0,0 +1,13 @@
using System;
using System.Linq;
namespace WebsitePanel.EnterpriseServer.Extensions
{
public static class UriExtensions
{
public static Uri Append(this Uri uri, params string[] paths)
{
return new Uri(paths.Aggregate(uri.AbsoluteUri, (current, path) => string.Format("{0}/{1}", current.TrimEnd('/'), path.TrimStart('/'))));
}
}
}

View file

@ -27,11 +27,13 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.IO;
using System.Reflection;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Serialization;
using WebsitePanel.Providers;
namespace WebsitePanel.EnterpriseServer
@ -704,6 +706,37 @@ namespace WebsitePanel.EnterpriseServer
return type.FullName + ", " + type.Assembly.GetName().Name;
}
public static TResult Deserialize<TResult>(string inputString)
{
TResult result;
var serializer = new XmlSerializer(typeof(TResult));
using (TextReader reader = new StringReader(inputString))
{
result = (TResult)serializer.Deserialize(reader);
}
return result;
}
public static string Serialize<TEntity>(TEntity entity)
{
string result = string.Empty;
var xmlSerializer = new XmlSerializer(typeof(TEntity));
using (var stringWriter = new StringWriter())
{
using (XmlWriter writer = XmlWriter.Create(stringWriter))
{
xmlSerializer.Serialize(writer, entity);
result = stringWriter.ToString();
}
}
return result;
}
#region Helper Functions

View file

@ -31,6 +31,7 @@ using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
using WebsitePanel.Providers.HostedSolution;
using Microsoft.ApplicationBlocks.Data;
using System.Collections.Generic;
@ -2409,7 +2410,7 @@ namespace WebsitePanel.EnterpriseServer
public static int AddExchangeAccount(int itemId, int accountType, string accountName,
string displayName, string primaryEmailAddress, bool mailEnabledPublicFolder,
string mailboxManagerActions, string samAccountName, string accountPassword, int mailboxPlanId, string subscriberNumber)
string mailboxManagerActions, string samAccountName, int mailboxPlanId, string subscriberNumber)
{
SqlParameter outParam = new SqlParameter("@AccountID", SqlDbType.Int);
outParam.Direction = ParameterDirection.Output;
@ -2427,7 +2428,6 @@ namespace WebsitePanel.EnterpriseServer
new SqlParameter("@MailEnabledPublicFolder", mailEnabledPublicFolder),
new SqlParameter("@MailboxManagerActions", mailboxManagerActions),
new SqlParameter("@SamAccountName", samAccountName),
new SqlParameter("@AccountPassword", accountPassword),
new SqlParameter("@MailboxPlanId", (mailboxPlanId == 0) ? (object)DBNull.Value : (object)mailboxPlanId),
new SqlParameter("@SubscriberNumber", (string.IsNullOrEmpty(subscriberNumber) ? (object)DBNull.Value : (object)subscriberNumber))
);
@ -2612,7 +2612,7 @@ namespace WebsitePanel.EnterpriseServer
public static void UpdateExchangeAccount(int accountId, string accountName, ExchangeAccountType accountType,
string displayName, string primaryEmailAddress, bool mailEnabledPublicFolder,
string mailboxManagerActions, string samAccountName, string accountPassword, int mailboxPlanId, int archivePlanId, string subscriberNumber,
string mailboxManagerActions, string samAccountName, int mailboxPlanId, int archivePlanId, string subscriberNumber,
bool EnableArchiving)
{
SqlHelper.ExecuteNonQuery(
@ -2626,7 +2626,6 @@ namespace WebsitePanel.EnterpriseServer
new SqlParameter("@PrimaryEmailAddress", primaryEmailAddress),
new SqlParameter("@MailEnabledPublicFolder", mailEnabledPublicFolder),
new SqlParameter("@MailboxManagerActions", mailboxManagerActions),
new SqlParameter("@Password", string.IsNullOrEmpty(accountPassword) ? (object)DBNull.Value : (object)accountPassword),
new SqlParameter("@SamAccountName", samAccountName),
new SqlParameter("@MailboxPlanId", (mailboxPlanId == 0) ? (object)DBNull.Value : (object)mailboxPlanId),
new SqlParameter("@ArchivingMailboxPlanId", (archivePlanId < 1) ? (object)DBNull.Value : (object)archivePlanId),
@ -3210,6 +3209,91 @@ namespace WebsitePanel.EnterpriseServer
#region Organizations
public static int AddAccessToken(AccessToken token)
{
return AddAccessToken(token.AccessTokenGuid, token.AccountId, token.ItemId, token.ExpirationDate, token.TokenType);
}
public static int AddAccessToken(Guid accessToken, int accountId, int itemId, DateTime expirationDate, AccessTokenTypes type)
{
SqlParameter prmId = new SqlParameter("@TokenID", SqlDbType.Int);
prmId.Direction = ParameterDirection.Output;
SqlHelper.ExecuteNonQuery(
ConnectionString,
CommandType.StoredProcedure,
"AddAccessToken",
prmId,
new SqlParameter("@AccessToken", accessToken),
new SqlParameter("@ExpirationDate", expirationDate),
new SqlParameter("@AccountID", accountId),
new SqlParameter("@ItemId", itemId),
new SqlParameter("@TokenType", (int)type)
);
// read identity
return Convert.ToInt32(prmId.Value);
}
public static void SetAccessTokenResponseMessage(Guid accessToken, string response)
{
SqlHelper.ExecuteNonQuery(
ConnectionString,
CommandType.StoredProcedure,
"SetAccessTokenSmsResponse",
new SqlParameter("@AccessToken", accessToken),
new SqlParameter("@SmsResponse", response)
);
}
public static void DeleteExpiredAccessTokens()
{
SqlHelper.ExecuteNonQuery(
ConnectionString,
CommandType.StoredProcedure,
"DeleteExpiredAccessTokenTokens"
);
}
public static IDataReader GetAccessTokenByAccessToken(Guid accessToken, AccessTokenTypes type)
{
return SqlHelper.ExecuteReader(
ConnectionString,
CommandType.StoredProcedure,
"GetAccessTokenByAccessToken",
new SqlParameter("@AccessToken", accessToken),
new SqlParameter("@TokenType", type)
);
}
public static void DeleteAccessToken(Guid accessToken, AccessTokenTypes type)
{
SqlHelper.ExecuteNonQuery(
ConnectionString,
CommandType.StoredProcedure,
"DeleteAccessToken",
new SqlParameter("@AccessToken", accessToken),
new SqlParameter("@TokenType", type)
);
}
public static void UpdateOrganizationSettings(int itemId, string settingsName, string xml)
{
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
ObjectQualifier + "UpdateExchangeOrganizationSettings",
new SqlParameter("@ItemId", itemId),
new SqlParameter("@SettingsName", settingsName),
new SqlParameter("@Xml", xml));
}
public static IDataReader GetOrganizationSettings(int itemId, string settingsName)
{
return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
ObjectQualifier + "GetExchangeOrganizationSettings",
new SqlParameter("@ItemId", itemId),
new SqlParameter("@SettingsName", settingsName));
}
public static int AddOrganizationDeletedUser(int accountId, int originAT, string storagePath, string folderName, string fileName, DateTime expirationDate)
{
SqlParameter outParam = new SqlParameter("@ID", SqlDbType.Int);

View file

@ -1650,12 +1650,12 @@ namespace WebsitePanel.EnterpriseServer
return result;
}
public static ResultObject DeleteMappedDrive(int itemId, string driveLetter)
public static ResultObject DeleteMappedDrive(int itemId, string folderName)
{
return DeleteMappedDriveInternal(itemId, driveLetter);
return DeleteMappedDriveInternal(itemId, folderName);
}
protected static ResultObject DeleteMappedDriveInternal(int itemId, string driveLetter)
protected static ResultObject DeleteMappedDriveInternal(int itemId, string folderName)
{
ResultObject result = TaskManager.StartResultTask<ResultObject>("ENTERPRISE_STORAGE", "DELETE_MAPPED_DRIVE", itemId);
@ -1670,9 +1670,13 @@ namespace WebsitePanel.EnterpriseServer
return result;
}
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);
orgProxy.DeleteMappedDrive(org.OrganizationId, driveLetter);
orgProxy.DeleteMappedDriveByPath(org.OrganizationId, path);
}
catch (Exception ex)
{

View file

@ -1211,9 +1211,6 @@ namespace WebsitePanel.EnterpriseServer
if (account == null)
return null;
// decrypt password
account.AccountPassword = CryptoUtils.Decrypt(account.AccountPassword);
return account;
}
@ -1225,9 +1222,6 @@ namespace WebsitePanel.EnterpriseServer
if (account == null)
return null;
// decrypt password
account.AccountPassword = CryptoUtils.Decrypt(account.AccountPassword);
return account;
}
@ -1268,9 +1262,6 @@ namespace WebsitePanel.EnterpriseServer
if (account == null)
return null;
// decrypt password
account.AccountPassword = CryptoUtils.Decrypt(account.AccountPassword);
return account;
}
@ -1280,14 +1271,14 @@ namespace WebsitePanel.EnterpriseServer
{
return DataProvider.AddExchangeAccount(itemId, (int)accountType,
accountName, displayName, primaryEmailAddress, mailEnabledPublicFolder,
mailboxManagerActions.ToString(), samAccountName, CryptoUtils.Encrypt(accountPassword), mailboxPlanId, (string.IsNullOrEmpty(subscriberNumber) ? null : subscriberNumber.Trim()));
mailboxManagerActions.ToString(), samAccountName, mailboxPlanId, (string.IsNullOrEmpty(subscriberNumber) ? null : subscriberNumber.Trim()));
}
private static void UpdateAccount(ExchangeAccount account)
{
DataProvider.UpdateExchangeAccount(account.AccountId, account.AccountName, account.AccountType, account.DisplayName,
account.PrimaryEmailAddress, account.MailEnabledPublicFolder,
account.MailboxManagerActions.ToString(), account.SamAccountName, account.AccountPassword, account.MailboxPlanId, account.ArchivingMailboxPlanId,
account.MailboxManagerActions.ToString(), account.SamAccountName, account.MailboxPlanId, account.ArchivingMailboxPlanId,
(string.IsNullOrEmpty(account.SubscriberNumber) ? null : account.SubscriberNumber.Trim()),
account.EnableArchiving);
}
@ -1674,7 +1665,6 @@ namespace WebsitePanel.EnterpriseServer
mailEnabledPublicFolder,
mailboxManagerActions,
samAccountName,
CryptoUtils.Encrypt(accountPassword),
mailboxPlanId, archivePlanId,
(string.IsNullOrEmpty(subscriberNumber) ? null : subscriberNumber.Trim()), EnableArchiving);
}
@ -1952,7 +1942,6 @@ namespace WebsitePanel.EnterpriseServer
account.AccountType = ExchangeAccountType.User;
account.MailEnabledPublicFolder = false;
account.AccountPassword = null;
UpdateAccount(account);
DataProvider.DeleteUserEmailAddresses(account.AccountId, account.PrimaryEmailAddress);
@ -2338,7 +2327,6 @@ namespace WebsitePanel.EnterpriseServer
}
// save account
account.AccountPassword = null;
UpdateAccount(account);
return 0;
@ -2562,7 +2550,6 @@ namespace WebsitePanel.EnterpriseServer
else account.MailboxManagerActions &= ~action;
// update account
account.AccountPassword = null;
UpdateAccount(account);
return 0;
@ -2629,6 +2616,13 @@ namespace WebsitePanel.EnterpriseServer
items["AccountDomain"] = account.PrimaryEmailAddress.Substring(account.PrimaryEmailAddress.IndexOf("@") + 1);
items["DefaultDomain"] = org.DefaultDomain;
var passwordResetUrl = OrganizationController.GenerateUserPasswordResetLink(account.ItemId, account.AccountId);
if (!string.IsNullOrEmpty(passwordResetUrl))
{
items["PswResetUrl"] = passwordResetUrl;
}
if (!String.IsNullOrEmpty(account.SamAccountName))
{
int idx = account.SamAccountName.IndexOf("\\");
@ -3895,7 +3889,6 @@ namespace WebsitePanel.EnterpriseServer
// update account
account.DisplayName = displayName;
account.PrimaryEmailAddress = emailAddress;
account.AccountPassword = null;
UpdateAccount(account);
return 0;
@ -4218,7 +4211,6 @@ namespace WebsitePanel.EnterpriseServer
// update account
account.DisplayName = displayName;
account.AccountPassword = null;
UpdateAccount(account);
return 0;
@ -4434,7 +4426,6 @@ namespace WebsitePanel.EnterpriseServer
addressLists.ToArray());
// save account
account.AccountPassword = null;
UpdateAccount(account);
return 0;
@ -4997,7 +4988,6 @@ namespace WebsitePanel.EnterpriseServer
account.AccountName = accountName;
account.MailEnabledPublicFolder = true;
account.PrimaryEmailAddress = email;
account.AccountPassword = null;
UpdateAccount(account);
// register e-mail
@ -5049,7 +5039,6 @@ namespace WebsitePanel.EnterpriseServer
// update and save account
account.MailEnabledPublicFolder = false;
account.PrimaryEmailAddress = "";
account.AccountPassword = null;
UpdateAccount(account);
@ -5168,7 +5157,6 @@ namespace WebsitePanel.EnterpriseServer
{
// rename original folder
account.DisplayName = newFullName;
account.AccountPassword = null;
UpdateAccount(account);
// rename nested folders
@ -5383,7 +5371,6 @@ namespace WebsitePanel.EnterpriseServer
emailAddress);
// save account
account.AccountPassword = null;
UpdateAccount(account);
return 0;

View file

@ -33,8 +33,10 @@ using System.Collections.Specialized;
using System.Data;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;
using WebsitePanel.EnterpriseServer.Code.HostedSolution;
using WebsitePanel.EnterpriseServer.Code.SharePoint;
using WebsitePanel.EnterpriseServer.Extensions;
using WebsitePanel.Providers;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.ResultObjects;
@ -1532,7 +1534,359 @@ namespace WebsitePanel.EnterpriseServer
return result;
}
public static List<OrganizationUser> GetOrganizationUsersWithExpiredPassword(int itemId, int daysBeforeExpiration)
{
// load organization
Organization org = GetOrganization(itemId);
if (org == null)
{
return null;
}
Organizations orgProxy = GetOrganizationProxy(org.ServiceId);
var expiredUsersAd = orgProxy.GetOrganizationUsersWithExpiredPassword(org.OrganizationId, daysBeforeExpiration);
var expiredUsersDb = GetOrganizationUsersPaged(itemId, null, null, null, 0, int.MaxValue).PageUsers.Where(x => expiredUsersAd.Any(z => z.SamAccountName == x.SamAccountName)).ToList();
foreach (var user in expiredUsersDb)
{
var adUser = expiredUsersAd.First(x => x.SamAccountName == user.SamAccountName);
user.PasswordExpirationDateTime = adUser.PasswordExpirationDateTime;
}
return expiredUsersDb;
}
/// <summary>
/// Send reset user password email
/// </summary>
/// <param name="itemId">Organization Id</param>
/// <param name="accountId">User Id</param>
/// <param name="reason">Reason why reset email is sent.</param>
/// <param name="mailTo">Optional, if null accountID user PrimaryEmailAddress will be used</param>
public static void SendResetUserPasswordEmail(int itemId, int accountId, string reason, string mailTo = null)
{
// load organization
Organization org = GetOrganization(itemId);
if (org == null)
{
throw new Exception(string.Format("Organization not found (ItemId = {0})", itemId));
}
Organizations orgProxy = GetOrganizationProxy(org.ServiceId);
UserInfo owner = PackageController.GetPackageOwner(org.PackageId);
OrganizationUser user = OrganizationController.GetAccount(itemId, accountId);
OrganizationUser settings = orgProxy.GetUserGeneralSettings(user.AccountName, org.OrganizationId);
user.PasswordExpirationDateTime = settings.PasswordExpirationDateTime;
if (string.IsNullOrEmpty(mailTo))
{
mailTo = user.PrimaryEmailAddress;
}
var generalSettings = OrganizationController.GetOrganizationGeneralSettings(itemId);
var logoUrl = generalSettings != null ? generalSettings.OrganizationLogoUrl : string.Empty;
SendUserPasswordEmail(owner, user, reason, mailTo, logoUrl, UserSettings.USER_PASSWORD_RESET_LETTER, "USER_PASSWORD_RESET_LETTER");
}
public static void SendUserExpirationPasswordEmail(UserInfo owner, OrganizationUser user, string reason,
string mailTo, string logoUrl)
{
SendUserPasswordEmail(owner, user, reason, user.PrimaryEmailAddress, logoUrl, UserSettings.USER_PASSWORD_EXPIRATION_LETTER, "USER_PASSWORD_EXPIRATION_LETTER");
}
public static void SendUserPasswordEmail(UserInfo owner, OrganizationUser user, string reason, string mailTo, string logoUrl, string settingsName, string taskName)
{
UserSettings settings = UserController.GetUserSettings(owner.UserId,
settingsName);
TaskManager.StartTask("ORGANIZATION", "SEND_" + taskName, user.ItemId);
try
{
if (string.IsNullOrEmpty(logoUrl))
{
logoUrl = settings["LogoUrl"];
}
string from = settings["From"];
string subject = settings["Subject"];
string body = owner.HtmlMail ? settings["HtmlBody"] : settings["TextBody"];
bool isHtml = owner.HtmlMail;
MailPriority priority = MailPriority.Normal;
if (!String.IsNullOrEmpty(settings["Priority"]))
{
priority = (MailPriority) Enum.Parse(typeof (MailPriority), settings["Priority"], true);
}
Hashtable items = new Hashtable();
items["user"] = user;
items["logoUrl"] = logoUrl;
items["passwordResetLink"] = GenerateUserPasswordResetLink(user.ItemId, user.AccountId);
body = PackageController.EvaluateTemplate(body, items);
TaskManager.Write("Organization ID : " + user.ItemId);
TaskManager.Write("Account : " + user.DisplayName);
TaskManager.Write("Reason : " + reason);
TaskManager.Write("MailTo : " + mailTo);
// send mail message
MailHelper.SendMessage(from, mailTo, null, subject, body, priority, isHtml);
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
}
public static AccessToken GetAccessToken(Guid accessToken, AccessTokenTypes type)
{
return ObjectUtils.FillObjectFromDataReader<AccessToken>(DataProvider.GetAccessTokenByAccessToken(accessToken, type));
}
public static void DeleteAccessToken(Guid accessToken, AccessTokenTypes type)
{
DataProvider.DeleteAccessToken(accessToken, type);
}
public static void DeleteAllExpiredTokens()
{
DataProvider.DeleteExpiredAccessTokens();
}
public static SystemSettings GetWebDavSystemSettings()
{
return SystemController.GetSystemSettingsInternal(SystemSettings.WEBDAV_PORTAL_SETTINGS, false);
}
public static string GenerateUserPasswordResetLink(int itemId, int accountId)
{
string passwordResetUrlFormat = "account/password-reset/step-2";
var settings = GetWebDavSystemSettings();
if (settings == null || !settings.GetValueOrDefault(SystemSettings.WEBDAV_PASSWORD_RESET_ENABLED_KEY, false) ||!settings.Contains("WebdavPortalUrl"))
{
return string.Empty;
}
var webdavPortalUrl = new Uri(settings["WebdavPortalUrl"]);
var token = CreateAccessToken(itemId, accountId, AccessTokenTypes.PasswrodReset);
return webdavPortalUrl.Append(passwordResetUrlFormat)
.Append(token.AccessTokenGuid.ToString("n")).ToString();
}
private static AccessToken CreateAccessToken(int itemId, int accountId, AccessTokenTypes type)
{
var token = new AccessToken
{
AccessTokenGuid = Guid.NewGuid(),
ItemId = itemId,
AccountId = accountId,
TokenType = type,
ExpirationDate = DateTime.Now.AddHours(12)
};
token.Id = DataProvider.AddAccessToken(token);
return token;
}
public static void SetAccessTokenResponse(Guid accessToken, string response)
{
DataProvider.SetAccessTokenResponseMessage(accessToken, response);
}
public static bool CheckPhoneNumberIsInUse(int itemId, string phoneNumber, string userSamAccountName = null)
{
// load organization
Organization org = GetOrganization(itemId);
if (org == null)
{
throw new Exception(string.Format("Organization with id '{0}' not found", itemId));
}
Organizations orgProxy = GetOrganizationProxy(org.ServiceId);
return orgProxy.CheckPhoneNumberIsInUse(phoneNumber, userSamAccountName);
}
public static void UpdateOrganizationPasswordSettings(int itemId, OrganizationPasswordSettings settings)
{
TaskManager.StartTask("ORGANIZATION", "UPDATE_PASSWORD_SETTINGS");
try
{
// load organization
Organization org = GetOrganization(itemId);
if (org == null)
{
TaskManager.WriteWarning("Organization with itemId '{0}' not found", itemId.ToString());
return;
}
Organizations orgProxy = GetOrganizationProxy(org.ServiceId);
orgProxy.ApplyPasswordSettings(org.OrganizationId, settings);
var xml = ObjectUtils.Serialize(settings);
DataProvider.UpdateOrganizationSettings(itemId, OrganizationSettings.PasswordSettings, xml);
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
}
public static OrganizationPasswordSettings GetOrganizationPasswordSettings(int itemId)
{
var passwordSettings = GetOrganizationSettings<OrganizationPasswordSettings>(itemId, OrganizationSettings.PasswordSettings);
if (passwordSettings == null)
{
Organization org = GetOrganization(itemId);
if (org == null)
{
throw new Exception(string.Format("Organization not found (ItemId = {0})", itemId));
}
var package = PackageController.GetPackage(org.PackageId);
UserSettings userSettings = UserController.GetUserSettings(package.UserId, UserSettings.EXCHANGE_POLICY);
if (userSettings != null)
{
string policyValue = userSettings["MailboxPasswordPolicy"];
if (policyValue != null)
{
string[] parts = policyValue.Split(';');
passwordSettings = new OrganizationPasswordSettings
{
MinimumLength = GetValueSafe(parts, 1, 0),
MaximumLength = GetValueSafe(parts, 2, 0),
UppercaseLettersCount = GetValueSafe(parts, 3, 0),
NumbersCount = GetValueSafe(parts, 4, 0),
SymbolsCount = GetValueSafe(parts, 5, 0),
AccountLockoutThreshold = GetValueSafe(parts, 7, 0),
EnforcePasswordHistory = GetValueSafe(parts, 8, 0),
AccountLockoutDuration = GetValueSafe(parts, 9, 0),
ResetAccountLockoutCounterAfter = GetValueSafe(parts, 10, 0),
LockoutSettingsEnabled = GetValueSafe(parts, 11, false),
PasswordComplexityEnabled = GetValueSafe(parts, 11, true),
};
PasswordPolicyResult passwordPolicy = GetPasswordPolicy(itemId);
if (passwordPolicy.IsSuccess)
{
passwordSettings.MinimumLength = passwordPolicy.Value.MinLength;
if (passwordPolicy.Value.IsComplexityEnable)
{
passwordSettings.NumbersCount = 1;
passwordSettings.SymbolsCount = 1;
passwordSettings.UppercaseLettersCount = 1;
}
}
}
}
}
return passwordSettings;
}
public static T GetValueSafe<T>(string[] array, int index, T defaultValue)
{
if (array.Length > index)
{
if (string.IsNullOrEmpty(array[index]))
{
return defaultValue;
}
return (T)Convert.ChangeType(array[index], typeof(T));
}
return defaultValue;
}
public static void UpdateOrganizationGeneralSettings(int itemId, OrganizationGeneralSettings settings)
{
TaskManager.StartTask("ORGANIZATION", "UPDATE_GENERAL_SETTINGS");
try
{
// load organization
Organization org = GetOrganization(itemId);
if (org == null)
{
TaskManager.WriteWarning("Organization with itemId '{0}' not found", itemId.ToString());
return;
}
var xml = ObjectUtils.Serialize(settings);
DataProvider.UpdateOrganizationSettings(itemId, OrganizationSettings.GeneralSettings, xml);
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
}
public static OrganizationGeneralSettings GetOrganizationGeneralSettings(int itemId)
{
return GetOrganizationSettings<OrganizationGeneralSettings>(itemId, OrganizationSettings.GeneralSettings);
}
private static T GetOrganizationSettings<T>(int itemId, string settingsName)
{
var entity = ObjectUtils.FillObjectFromDataReader<OrganizationSettingsEntity>(DataProvider.GetOrganizationSettings(itemId, settingsName));
if (entity == null)
{
return default(T);
}
return ObjectUtils.Deserialize<T>(entity.Xml);
}
private static bool EmailAddressExists(string emailAddress)
{
@ -1543,7 +1897,7 @@ namespace WebsitePanel.EnterpriseServer
private static int AddOrganizationUser(int itemId, string accountName, string displayName, string email, string sAMAccountName, string accountPassword, string subscriberNumber)
{
return DataProvider.AddExchangeAccount(itemId, (int)ExchangeAccountType.User, accountName, displayName, email, false, string.Empty,
sAMAccountName, CryptoUtils.Encrypt(accountPassword), 0, subscriberNumber.Trim());
sAMAccountName, 0, subscriberNumber.Trim());
}
@ -2231,9 +2585,6 @@ namespace WebsitePanel.EnterpriseServer
if (account == null)
return null;
// decrypt password
account.AccountPassword = CryptoUtils.Decrypt(account.AccountPassword);
return account;
}
@ -2268,7 +2619,7 @@ namespace WebsitePanel.EnterpriseServer
#endregion
// place log record
TaskManager.StartTask("ORGANIZATION", "GET_USER_GENERAL", itemId);
//TaskManager.StartTask("ORGANIZATION", "GET_USER_GENERAL", itemId);
OrganizationUser account = null;
Organization org = null;
@ -2311,7 +2662,7 @@ namespace WebsitePanel.EnterpriseServer
catch { }
finally
{
TaskManager.CompleteTask();
//TaskManager.CompleteTask();
}
return (account);
@ -2395,10 +2746,6 @@ namespace WebsitePanel.EnterpriseServer
account.IsVIP = isVIP;
//account.
if (!String.IsNullOrEmpty(password))
account.AccountPassword = CryptoUtils.Encrypt(password);
else
account.AccountPassword = null;
UpdateAccount(account);
UpdateAccountServiceLevelSettings(account);
@ -2526,6 +2873,9 @@ namespace WebsitePanel.EnterpriseServer
// place log record
TaskManager.StartTask("ORGANIZATION", "SET_USER_PASSWORD", itemId);
TaskManager.Write("ItemId: {0}", itemId.ToString());
TaskManager.Write("AccountId: {0}", accountId.ToString());
try
{
// load organization
@ -2549,10 +2899,6 @@ namespace WebsitePanel.EnterpriseServer
password);
//account.
if (!String.IsNullOrEmpty(password))
account.AccountPassword = CryptoUtils.Encrypt(password);
else
account.AccountPassword = null;
UpdateAccount(account);
@ -2577,7 +2923,7 @@ namespace WebsitePanel.EnterpriseServer
{
DataProvider.UpdateExchangeAccount(account.AccountId, account.AccountName, account.AccountType, account.DisplayName,
account.PrimaryEmailAddress, account.MailEnabledPublicFolder,
account.MailboxManagerActions.ToString(), account.SamAccountName, account.AccountPassword, account.MailboxPlanId, account.ArchivingMailboxPlanId,
account.MailboxManagerActions.ToString(), account.SamAccountName, account.MailboxPlanId, account.ArchivingMailboxPlanId,
(string.IsNullOrEmpty(account.SubscriberNumber) ? null : account.SubscriberNumber.Trim()),
account.EnableArchiving);
}
@ -2814,7 +3160,7 @@ namespace WebsitePanel.EnterpriseServer
{
return DataProvider.AddExchangeAccount(itemId, (int)accountType,
accountName, displayName, primaryEmailAddress, mailEnabledPublicFolder,
mailboxManagerActions.ToString(), samAccountName, CryptoUtils.Encrypt(accountPassword), mailboxPlanId, (string.IsNullOrEmpty(subscriberNumber) ? null : subscriberNumber.Trim()));
mailboxManagerActions.ToString(), samAccountName, mailboxPlanId, (string.IsNullOrEmpty(subscriberNumber) ? null : subscriberNumber.Trim()));
}
#region Additional Default Groups

View file

@ -0,0 +1,67 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using WebsitePanel.Providers.HostedSolution;
namespace WebsitePanel.EnterpriseServer
{
public class UserPasswordExpirationNotificationTask : SchedulerTask
{
// Input parameters:
private static readonly string DaysBeforeNotify = "DAYS_BEFORE_EXPIRATION";
public override void DoWork()
{
BackgroundTask topTask = TaskManager.TopTask;
int daysBeforeNotify;
// check input parameters
if (!int.TryParse((string)topTask.GetParamValue(DaysBeforeNotify), out daysBeforeNotify))
{
TaskManager.WriteWarning("Specify 'Notify before (days)' task parameter");
return;
}
OrganizationController.DeleteAllExpiredTokens();
var owner = UserController.GetUser(topTask.EffectiveUserId);
var packages = PackageController.GetMyPackages(topTask.EffectiveUserId);
foreach (var package in packages)
{
var organizations = ExchangeServerController.GetExchangeOrganizations(package.PackageId, true);
foreach (var organization in organizations)
{
var usersWithExpiredPasswords = OrganizationController.GetOrganizationUsersWithExpiredPassword(organization.Id, daysBeforeNotify);
var generalSettings = OrganizationController.GetOrganizationGeneralSettings(organization.Id);
var logoUrl = generalSettings != null ? generalSettings.OrganizationLogoUrl : string.Empty;
foreach (var user in usersWithExpiredPasswords)
{
user.ItemId = organization.Id;
if (string.IsNullOrEmpty(user.PrimaryEmailAddress))
{
TaskManager.WriteWarning(string.Format("Unable to send email to {0} user (organization: {1}), user primary email address is not set.", user.DisplayName, organization.OrganizationId));
continue;
}
OrganizationController.SendUserExpirationPasswordEmail(owner, user, "Scheduler Password Expiration Notification", user.PrimaryEmailAddress, logoUrl);
}
}
}
// send mail message
// MailHelper.SendMessage(mailFrom, mailTo, mailSubject, mailBody, false);
}
}
}

View file

@ -3720,6 +3720,8 @@ namespace WebsitePanel.EnterpriseServer
#region Replication
#region IsReplicaServer Part
public static CertificateInfo[] GetCertificates(int serviceId, string remoteServer)
{
VirtualizationServer2012 vs = GetVirtualizationProxy(serviceId);
@ -3745,12 +3747,208 @@ namespace WebsitePanel.EnterpriseServer
return result;
}
public static bool IsReplicaServer(int serviceId, string remoteServer)
public static ResultObject UnsetReplicaServer(int serviceId, string remoteServer)
{
ResultObject result = new ResultObject();
try
{
VirtualizationServer2012 vs = GetVirtualizationProxy(serviceId);
vs.UnsetReplicaServer(remoteServer);
result.IsSuccess = true;
}
catch (Exception ex)
{
result.AddError(VirtualizationErrorCodes.UNSET_REPLICA_SERVER_ERROR, ex);
}
return result;
}
public static ReplicationServerInfo GetReplicaServer(int serviceId, string remoteServer)
{
VirtualizationServer2012 vs = GetVirtualizationProxy(serviceId);
return vs.IsReplicaServer(remoteServer);
return vs.GetReplicaServer(remoteServer);
}
#endregion
public static VmReplication GetReplication(int itemId)
{
VirtualMachine vm = GetVirtualMachineByItemId(itemId);
VirtualizationServer2012 vs = GetVirtualizationProxy(vm.ServiceId);
return vs.GetReplication(vm.VirtualMachineId);
}
public static ReplicationDetailInfo GetReplicationInfo(int itemId)
{
VirtualMachine vm = GetVirtualMachineByItemId(itemId);
VirtualizationServer2012 vs = GetVirtualizationProxy(vm.ServiceId);
return vs.GetReplicationInfo(vm.VirtualMachineId);
}
public static ResultObject SetVmReplication(int itemId, VmReplication replication)
{
TaskManager.StartTask("VPS2012", "SetVmReplication");
ResultObject result = new ResultObject();
try
{
VirtualMachine vm = GetVirtualMachineByItemId(itemId);
VirtualizationServer2012 vs = GetVirtualizationProxy(vm.ServiceId);
// Get replica server
var replicaServerInfo = GetReplicaInfoForService(vm.ServiceId, ref result);
if (result.ErrorCodes.Count > 0)
return result;
// We should use enable replication or set replication?
var vmReplica = vs.GetReplication(vm.VirtualMachineId);
if (vmReplica == null) // need enable
{
vs.EnableVmReplication(vm.VirtualMachineId, replicaServerInfo.ComputerName, replication);
vs.StartInitialReplication(vm.VirtualMachineId);
}
else // need set
{
vs.SetVmReplication(vm.VirtualMachineId, replicaServerInfo.ComputerName, replication);
}
result.IsSuccess = true;
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
TaskManager.WriteWarning("Organization with itemId '{0}' not found", itemId.ToString());
return result;
}
public static ResultObject DisableVmReplication(int itemId)
{
ResultObject result = new ResultObject();
try
{
VirtualMachine vm = GetVirtualMachineByItemId(itemId);
VirtualizationServer2012 vs = GetVirtualizationProxy(vm.ServiceId);
vs.DisableVmReplication(vm.VirtualMachineId);
CleanUpReplicaServer(vm);
result.IsSuccess = true;
}
catch (Exception ex)
{
result.AddError(VirtualizationErrorCodes.DISABLE_REPLICATION_ERROR, ex);
}
return result;
}
public static ResultObject PauseReplication(int itemId)
{
ResultObject result = new ResultObject();
try
{
VirtualMachine vm = GetVirtualMachineByItemId(itemId);
VirtualizationServer2012 vs = GetVirtualizationProxy(vm.ServiceId);
vs.PauseReplication(vm.VirtualMachineId);
result.IsSuccess = true;
}
catch (Exception ex)
{
result.AddError(VirtualizationErrorCodes.PAUSE_REPLICATION_ERROR, ex);
}
return result;
}
public static ResultObject ResumeReplication(int itemId)
{
ResultObject result = new ResultObject();
try
{
VirtualMachine vm = GetVirtualMachineByItemId(itemId);
VirtualizationServer2012 vs = GetVirtualizationProxy(vm.ServiceId);
vs.ResumeReplication(vm.VirtualMachineId);
result.IsSuccess = true;
}
catch (Exception ex)
{
result.AddError(VirtualizationErrorCodes.RESUME_REPLICATION_ERROR, ex);
}
return result;
}
#region Private methods
private static void CleanUpReplicaServer(VirtualMachine originalVm)
{
try
{
ResultObject result = new ResultObject();
// Get replica server
var replicaServer = GetReplicaForService(originalVm.ServiceId, ref result);
// Clean up replica server
var replicaVm = replicaServer.GetVirtualMachines().FirstOrDefault(m => m.Name == originalVm.Name);
if (replicaVm != null)
{
replicaServer.DisableVmReplication(replicaVm.VirtualMachineId);
replicaServer.ShutDownVirtualMachine(replicaVm.VirtualMachineId, true, "ReplicaDelete");
replicaServer.DeleteVirtualMachine(replicaVm.VirtualMachineId);
}
}
catch { /* skip */ }
}
private static ReplicationServerInfo GetReplicaInfoForService(int serviceId, ref ResultObject result)
{
// Get service id of replica server
StringDictionary vsSesstings = ServerController.GetServiceSettings(serviceId);
string replicaServiceId = vsSesstings["ReplicaServerId"];
if (string.IsNullOrEmpty(replicaServiceId))
{
result.ErrorCodes.Add(VirtualizationErrorCodes.NO_REPLICA_SERVER_ERROR);
return null;
}
// get replica server info for replica service id
VirtualizationServer2012 vsReplica = GetVirtualizationProxy(Convert.ToInt32(replicaServiceId));
StringDictionary vsReplicaSesstings = ServerController.GetServiceSettings(Convert.ToInt32(replicaServiceId));
string computerName = vsReplicaSesstings["ServerName"];
var replicaServerInfo = vsReplica.GetReplicaServer(computerName);
if (!replicaServerInfo.Enabled)
{
result.ErrorCodes.Add(VirtualizationErrorCodes.NO_REPLICA_SERVER_ERROR);
return null;
}
return replicaServerInfo;
}
private static VirtualizationServer2012 GetReplicaForService(int serviceId, ref ResultObject result)
{
// Get service id of replica server
StringDictionary vsSesstings = ServerController.GetServiceSettings(serviceId);
string replicaServiceId = vsSesstings["ReplicaServerId"];
if (string.IsNullOrEmpty(replicaServiceId))
{
result.ErrorCodes.Add(VirtualizationErrorCodes.NO_REPLICA_SERVER_ERROR);
return null;
}
// get replica server for replica service id
return GetVirtualizationProxy(Convert.ToInt32(replicaServiceId));
}
#endregion
#endregion
}
}

View file

@ -75,6 +75,7 @@
<Compile Include="Common\CryptoUtils.cs" />
<Compile Include="Common\EnterpriseServerIdentity.cs" />
<Compile Include="Common\EnterpriseServerPrincipal.cs" />
<Compile Include="Common\Extensions\UriExtensions.cs" />
<Compile Include="Common\FileUtils.cs" />
<Compile Include="Common\Int128.cs" />
<Compile Include="Common\IPAddress.cs" />
@ -158,6 +159,7 @@
<Compile Include="SchedulerTasks\SendMailNotificationTask.cs" />
<Compile Include="SchedulerTasks\SuspendOverdueInvoicesTask.cs" />
<Compile Include="SchedulerTasks\SuspendOverusedPackagesTask.cs" />
<Compile Include="SchedulerTasks\UserPasswordExpirationNotificationTask.cs" />
<Compile Include="SchedulerTasks\ZipFilesTask.cs" />
<Compile Include="Scheduling\Scheduler.cs" />
<Compile Include="Scheduling\SchedulerController.cs" />

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 System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@ -47,6 +48,60 @@ namespace WebsitePanel.EnterpriseServer
{
#region Organizations
[WebMethod]
public bool CheckPhoneNumberIsInUse(int itemId, string phoneNumber, string userSamAccountName = null)
{
return OrganizationController.CheckPhoneNumberIsInUse(itemId, phoneNumber, userSamAccountName);
}
[WebMethod]
public void DeletePasswordresetAccessToken(Guid accessToken)
{
OrganizationController.DeleteAccessToken(accessToken, AccessTokenTypes.PasswrodReset);
}
[WebMethod]
public void SetAccessTokenResponse(Guid accessToken, string response)
{
OrganizationController.SetAccessTokenResponse(accessToken, response);
}
[WebMethod]
public AccessToken GetPasswordresetAccessToken(Guid token)
{
return OrganizationController.GetAccessToken(token, AccessTokenTypes.PasswrodReset);
}
[WebMethod]
public void UpdateOrganizationGeneralSettings(int itemId, OrganizationGeneralSettings settings)
{
OrganizationController.UpdateOrganizationGeneralSettings(itemId, settings);
}
[WebMethod]
public OrganizationGeneralSettings GetOrganizationGeneralSettings(int itemId)
{
return OrganizationController.GetOrganizationGeneralSettings(itemId);
}
[WebMethod]
public void UpdateOrganizationPasswordSettings(int itemId, OrganizationPasswordSettings settings)
{
OrganizationController.UpdateOrganizationPasswordSettings(itemId, settings);
}
[WebMethod]
public SystemSettings GetWebDavSystemSettings()
{
return OrganizationController.GetWebDavSystemSettings();
}
[WebMethod]
public OrganizationPasswordSettings GetOrganizationPasswordSettings(int itemId)
{
return OrganizationController.GetOrganizationPasswordSettings(itemId);
}
[WebMethod]
public bool CheckOrgIdExists(string orgId)
{
@ -280,6 +335,11 @@ namespace WebsitePanel.EnterpriseServer
return OrganizationController.GetPasswordPolicy(itemId);
}
[WebMethod]
public void SendResetUserPasswordEmail(int itemId, int accountId, string reason, string mailTo = null)
{
OrganizationController.SendResetUserPasswordEmail(itemId, accountId, reason, mailTo);
}
#endregion

View file

@ -488,12 +488,54 @@ namespace WebsitePanel.EnterpriseServer
}
[WebMethod]
public bool IsReplicaServer(int serviceId, string remoteServer)
public ResultObject UnsetReplicaServer(int serviceId, string remoteServer)
{
return VirtualizationServerController2012.IsReplicaServer(serviceId, remoteServer);
return VirtualizationServerController2012.UnsetReplicaServer(serviceId, remoteServer);
}
[WebMethod]
public ReplicationServerInfo GetReplicaServer(int serviceId, string remoteServer)
{
return VirtualizationServerController2012.GetReplicaServer(serviceId, remoteServer);
}
[WebMethod]
public VmReplication GetReplication(int itemId)
{
return VirtualizationServerController2012.GetReplication(itemId);
}
[WebMethod]
public ReplicationDetailInfo GetReplicationInfo(int itemId)
{
return VirtualizationServerController2012.GetReplicationInfo(itemId);
}
[WebMethod]
public ResultObject SetVmReplication(int itemId, VmReplication replication)
{
return VirtualizationServerController2012.SetVmReplication(itemId, replication);
}
[WebMethod]
public ResultObject DisableVmReplication(int itemId)
{
return VirtualizationServerController2012.DisableVmReplication(itemId);
}
[WebMethod]
public ResultObject PauseReplication(int itemId)
{
return VirtualizationServerController2012.PauseReplication(itemId);
}
[WebMethod]
public ResultObject ResumeReplication(int itemId)
{
return VirtualizationServerController2012.ResumeReplication(itemId);
}
#endregion
}
}
}

View file

@ -108,11 +108,11 @@ namespace WebsitePanel.Providers.HostedSolution
set { this.mailEnabledPublicFolder = value; }
}
public string AccountPassword
{
get { return this.accountPassword; }
set { this.accountPassword = value; }
}
//public string AccountPassword
//{
// get { return this.accountPassword; }
// set { this.accountPassword = value; }
//}
public MailboxManagerActions MailboxManagerActions
{

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 System.Collections.Generic;
using WebsitePanel.Providers.OS;
using WebsitePanel.Providers.ResultObjects;
@ -96,5 +97,10 @@ namespace WebsitePanel.Providers.HostedSolution
void SetDriveMapsTargetingFilter(string organizationId, ExchangeAccount[] accounts, string folderName);
void ChangeDriveMapFolderPath(string organizationId, string oldFolder, string newFolder);
List<OrganizationUser> GetOrganizationUsersWithExpiredPassword(string organizationId, int daysBeforeExpiration);
void ApplyPasswordSettings(string organizationId, OrganizationPasswordSettings passwordSettings);
bool CheckPhoneNumberIsInUse(string phoneNumber, string userSamAccountName = null);
}
}

View file

@ -0,0 +1,7 @@
namespace WebsitePanel.Providers.HostedSolution
{
public class OrganizationGeneralSettings
{
public string OrganizationLogoUrl { get; set; }
}
}

View file

@ -0,0 +1,19 @@
namespace WebsitePanel.Providers.HostedSolution
{
public class OrganizationPasswordSettings
{
public int MinimumLength { get; set; }
public int MaximumLength { get; set; }
public int EnforcePasswordHistory { get; set; }
public bool LockoutSettingsEnabled { get; set; }
public int AccountLockoutDuration { get; set; }
public int AccountLockoutThreshold { get; set; }
public int ResetAccountLockoutCounterAfter { get; set; }
public bool PasswordComplexityEnabled { get; set; }
public int UppercaseLettersCount { get; set; }
public int NumbersCount { get; set; }
public int SymbolsCount { get; set; }
}
}

View file

@ -0,0 +1,8 @@
namespace WebsitePanel.Providers.HostedSolution
{
public class OrganizationSettings
{
public const string PasswordSettings = "PasswordSettings";
public const string GeneralSettings = "GeneralSettings";
}
}

View file

@ -0,0 +1,9 @@
namespace WebsitePanel.Providers.HostedSolution
{
public class OrganizationSettingsEntity
{
public int ItemId { get; set; }
public string SettingsName { get; set; }
public string Xml { get; set; }
}
}

View file

@ -268,11 +268,11 @@ namespace WebsitePanel.Providers.HostedSolution
}
public string AccountPassword
{
get { return accountPassword; }
set { accountPassword = value; }
}
//public string AccountPassword
//{
// get { return accountPassword; }
// set { accountPassword = value; }
//}
public string ExternalEmail { get; set; }
@ -334,5 +334,7 @@ namespace WebsitePanel.Providers.HostedSolution
get { return userMustChangePassword; }
set { userMustChangePassword = value; }
}
public DateTime PasswordExpirationDateTime { get; set; }
}
}

View file

@ -109,7 +109,7 @@ namespace WebsitePanel.Providers.Virtualization
void TestReplicationServer(string vmId, string replicaServer, string localThumbprint);
void StartInitialReplication(string vmId);
VmReplication GetReplication(string vmId);
bool DisableVmReplication(string vmId, string replicaServer);
void DisableVmReplication(string vmId);
ReplicationDetailInfo GetReplicationInfo(string vmId);
void PauseReplication(string vmId);
void ResumeReplication(string vmId);

View file

@ -17,6 +17,7 @@ namespace WebsitePanel.Providers.Virtualization
public TimeSpan AverageLatency { get; set; }
public int Errors { get; set; }
public int SuccessfulReplications { get; set; }
public int MissedReplicationCount { get; set; }
public string PendingSize { get; set; }
public DateTime LastSynhronizedAt { get; set; }
}

View file

@ -14,6 +14,7 @@ namespace WebsitePanel.Providers.Virtualization
FailedOver,
NotApplicable,
ReadyForInitialReplication,
InitialReplicationInProgress,
Replicating,
Resynchronizing,
ResynchronizeSuspended,

View file

@ -7,7 +7,7 @@
public string Thumbprint { get; set; }
[Persistent]
public string VhdToReplicate { get; set; }
public string[] VhdToReplicate { get; set; }
[Persistent]
public ReplicaFrequency ReplicaFrequency { get; set; }

View file

@ -119,9 +119,13 @@
<Compile Include="HostedSolution\LyncUserPlanType.cs" />
<Compile Include="HostedSolution\LyncUsersPaged.cs" />
<Compile Include="HostedSolution\LyncVoicePolicyType.cs" />
<Compile Include="HostedSolution\OrganizationGeneralSettings.cs" />
<Compile Include="HostedSolution\OrganizationPasswordSettings.cs" />
<Compile Include="HostedSolution\OrganizationSecurityGroup.cs" />
<Compile Include="HostedSolution\OrganizationDeletedUser.cs" />
<Compile Include="HostedSolution\OrganizationDeletedUsersPaged.cs" />
<Compile Include="HostedSolution\OrganizationSettings.cs" />
<Compile Include="HostedSolution\OrganizationSettingsEntity.cs" />
<Compile Include="HostedSolution\SharePointEnterpriseStatisticsReport.cs" />
<Compile Include="HostedSolution\SharePointEntetpriseStatistics.cs" />
<Compile Include="HostedSolution\TransactionAction.cs" />

View file

@ -27,6 +27,7 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.DirectoryServices.ActiveDirectory;
using System.IO;
using System.Xml;
using System.Linq;
@ -394,11 +395,28 @@ namespace WebsitePanel.Providers.HostedSolution
throw new ArgumentNullException("organizationId");
string groupPath = GetGroupPath(organizationId);
string psoName = FormOrganizationPSOName(organizationId);
Runspace runspace = null;
try
{
runspace = OpenRunspace();
if (FineGrainedPasswordPolicyExist(runspace, psoName))
{
RemoveFineGrainedPasswordPolicy(runspace, psoName);
}
ActiveDirectoryUtils.DeleteADObject(groupPath);
}
catch { /* skip */ }
catch
{
/* skip */
}
finally
{
CloseRunspace(runspace);
}
string path = GetOrganizationPath(organizationId);
ActiveDirectoryUtils.DeleteADObject(path, true);
@ -480,6 +498,310 @@ namespace WebsitePanel.Providers.HostedSolution
return Errors.OK;
}
public List<OrganizationUser> GetOrganizationUsersWithExpiredPassword(string organizationId, int daysBeforeExpiration)
{
return GetOrganizationUsersWithExpiredPasswordInternal(organizationId, daysBeforeExpiration);
}
internal List<OrganizationUser> GetOrganizationUsersWithExpiredPasswordInternal(string organizationId, int daysBeforeExpiration)
{
var result = new List<OrganizationUser>();
if (string.IsNullOrEmpty(organizationId))
{
return result;
}
Runspace runspace = null;
try
{
runspace = OpenRunspace();
var psoName = FormOrganizationPSOName(organizationId);
var maxPasswordAgeSpan = GetMaxPasswordAge(runspace, psoName);
var searchRoot = new DirectoryEntry(GetOrganizationPath(organizationId));
var search = new DirectorySearcher(searchRoot)
{
SearchScope = SearchScope.Subtree,
Filter = "(objectClass=user)"
};
search.PropertiesToLoad.Add("pwdLastSet");
search.PropertiesToLoad.Add("sAMAccountName");
SearchResultCollection searchResults = search.FindAll();
foreach (SearchResult searchResult in searchResults)
{
var pwdLastSetTicks = (long) searchResult.Properties["pwdLastSet"][0];
var pwdLastSetDate = DateTime.FromFileTimeUtc(pwdLastSetTicks);
var expirationDate = maxPasswordAgeSpan == TimeSpan.MaxValue ? DateTime.MaxValue : pwdLastSetDate.AddDays(maxPasswordAgeSpan.Days);
if (expirationDate.AddDays(-daysBeforeExpiration) < DateTime.Now)
{
var user = new OrganizationUser();
user.PasswordExpirationDateTime = expirationDate;
user.SamAccountName = (string) searchResult.Properties["sAMAccountName"][0];
result.Add(user);
}
}
}
catch (Exception)
{
throw;
}
finally
{
CloseRunspace(runspace);
}
return result;
}
internal TimeSpan GetMaxPasswordAge(Runspace runspace, string psoName)
{
if (FineGrainedPasswordPolicyExist(runspace, psoName))
{
var psoObject = GetFineGrainedPasswordPolicy(runspace, psoName);
var span = GetPSObjectProperty(psoObject, "MaxPasswordAge") as TimeSpan?;
if (span != null)
{
return span.Value;
}
}
using (Domain d = Domain.GetCurrentDomain())
{
using (DirectoryEntry domain = d.GetDirectoryEntry())
{
DirectorySearcher ds = new DirectorySearcher(
domain,
"(objectClass=*)",
null,
SearchScope.Base
);
SearchResult sr = ds.FindOne();
if (sr != null && sr.Properties.Contains("maxPwdAge"))
{
try
{
return TimeSpan.FromTicks((long)sr.Properties["maxPwdAge"][0]).Duration();
}
catch (Exception)
{
return TimeSpan.MaxValue;
}
}
throw new Exception("'maxPwdAge' property not found.");
}
}
}
public bool CheckPhoneNumberIsInUse(string phoneNumber, string userPrincipalName = null)
{
if (string.IsNullOrEmpty(phoneNumber))
{
return false;
}
phoneNumber = phoneNumber.Replace("+", "");
var userExcludeQuery = string.IsNullOrEmpty(userPrincipalName) ? string.Empty : string.Format("(!(UserPrincipalName={0}))", userPrincipalName);
string query = string.Format("(&" +
"(objectClass=user)" +
"(|" +
"(|(facsimileTelephoneNumber=+{0})(facsimileTelephoneNumber={0}))" +
"(|(homePhone=+{0})(homePhone={0}))" +
"(|(mobile=+{0})(mobile={0}))" +
"(|(pager=+{0})(pager={0}))" +
"(|(telephoneNumber=+{0})(telephoneNumber={0}))" +
")" +
"{1}" +
")", phoneNumber, userExcludeQuery);
using (Domain d = Domain.GetCurrentDomain())
{
using (DirectoryEntry domain = d.GetDirectoryEntry())
{
var search = new DirectorySearcher(domain)
{
SearchScope = SearchScope.Subtree,
Filter = query
};
search.PropertiesToLoad.Add(ADAttributes.Fax);
search.PropertiesToLoad.Add(ADAttributes.HomePhone);
search.PropertiesToLoad.Add(ADAttributes.MobilePhone);
search.PropertiesToLoad.Add(ADAttributes.Pager);
search.PropertiesToLoad.Add(ADAttributes.BusinessPhone);
SearchResult result = search.FindOne();
if (result != null)
{
return true;
}
return false;
}
}
}
public void ApplyPasswordSettings(string organizationId, OrganizationPasswordSettings settings)
{
HostedSolutionLog.LogStart("ApplyPasswordPolicy");
Runspace runspace = null;
var psoName = FormOrganizationPSOName(organizationId);
try
{
runspace = OpenRunspace();
if (!FineGrainedPasswordPolicyExist(runspace, psoName))
{
CreateFineGrainedPasswordPolicy(runspace, organizationId, psoName, settings);
string groupPath = GetGroupPath(organizationId);
SetFineGrainedPasswordPolicySubject(runspace, groupPath, psoName);
}
else
{
UpdateFineGrainedPasswordPolicy(runspace, psoName, settings);
}
}
catch (Exception ex)
{
HostedSolutionLog.LogError(ex);
throw;
}
finally
{
CloseRunspace(runspace);
HostedSolutionLog.LogEnd("ApplyPasswordPolicy");
}
}
private string FormOrganizationPSOName(string organizationId)
{
return string.Format("{0}-PSO", organizationId);
}
private bool FineGrainedPasswordPolicyExist(Runspace runspace, string psoName)
{
try
{
var cmd = new Command("Get-ADFineGrainedPasswordPolicy");
cmd.Parameters.Add("Identity", psoName);
var result = ExecuteShellCommand(runspace, cmd);
}
catch (Exception e)
{
return false;
}
return true;
}
private PSObject GetFineGrainedPasswordPolicy(Runspace runspace, string psoName)
{
var cmd = new Command("Get-ADFineGrainedPasswordPolicy");
cmd.Parameters.Add("Identity", psoName);
return ExecuteShellCommand(runspace, cmd).FirstOrDefault();
}
private void CreateFineGrainedPasswordPolicy(Runspace runspace, string organizationId, string psoName, OrganizationPasswordSettings settings)
{
var cmd = new Command("New-ADFineGrainedPasswordPolicy");
cmd.Parameters.Add("Name", psoName);
cmd.Parameters.Add("Description", string.Format("The {0} Password Policy", organizationId));
cmd.Parameters.Add("Precedence", 50);
cmd.Parameters.Add("MinPasswordLength", settings.MinimumLength);
cmd.Parameters.Add("PasswordHistoryCount", settings.EnforcePasswordHistory);
cmd.Parameters.Add("ComplexityEnabled", false);
cmd.Parameters.Add("ReversibleEncryptionEnabled", false);
if (settings.LockoutSettingsEnabled)
{
cmd.Parameters.Add("LockoutDuration", new TimeSpan(0, settings.AccountLockoutDuration, 0));
cmd.Parameters.Add("LockoutThreshold", settings.AccountLockoutThreshold);
cmd.Parameters.Add("LockoutObservationWindow", new TimeSpan(0, settings.ResetAccountLockoutCounterAfter, 0));
}
ExecuteShellCommand(runspace, cmd);
}
private void SetFineGrainedPasswordPolicySubject(Runspace runspace, string subjectPath, string psoName)
{
var entry = new DirectoryEntry(subjectPath);
var cmd = new Command("Add-ADFineGrainedPasswordPolicySubject");
cmd.Parameters.Add("Identity", psoName);
cmd.Parameters.Add("Subjects", entry.Properties[ADAttributes.SAMAccountName].Value.ToString());
ExecuteShellCommand(runspace, cmd);
cmd = new Command("Set-ADGroup");
cmd.Parameters.Add("Identity", entry.Properties[ADAttributes.SAMAccountName].Value.ToString());
cmd.Parameters.Add("GroupScope", "Global");
ExecuteShellCommand(runspace, cmd);
}
private void UpdateFineGrainedPasswordPolicy(Runspace runspace, string psoName, OrganizationPasswordSettings settings)
{
var cmd = new Command("Set-ADFineGrainedPasswordPolicy");
cmd.Parameters.Add("Identity", psoName);
cmd.Parameters.Add("MinPasswordLength", settings.MinimumLength);
cmd.Parameters.Add("PasswordHistoryCount", settings.EnforcePasswordHistory);
cmd.Parameters.Add("ComplexityEnabled", false);
cmd.Parameters.Add("ReversibleEncryptionEnabled", false);
if (settings.LockoutSettingsEnabled)
{
cmd.Parameters.Add("LockoutDuration", new TimeSpan(0, settings.AccountLockoutDuration, 0));
cmd.Parameters.Add("LockoutThreshold", settings.AccountLockoutThreshold);
cmd.Parameters.Add("LockoutObservationWindow", new TimeSpan(0, settings.ResetAccountLockoutCounterAfter, 0));
}
else
{
cmd.Parameters.Add("LockoutDuration", new TimeSpan(0));
cmd.Parameters.Add("LockoutThreshold", 0);
cmd.Parameters.Add("LockoutObservationWindow", 0);
}
ExecuteShellCommand(runspace, cmd);
}
private void RemoveFineGrainedPasswordPolicy(Runspace runspace, string psoName)
{
var cmd = new Command("Remove-ADFineGrainedPasswordPolicy");
cmd.Parameters.Add("Identity", psoName);
ExecuteShellCommand(runspace, cmd);
}
public PasswordPolicyResult GetPasswordPolicy()
{
return GetPasswordPolicyInternal();
@ -597,7 +919,7 @@ namespace WebsitePanel.Providers.HostedSolution
string path = GetUserPath(organizationId, loginName);
OrganizationUser retUser = GetUser(path);
OrganizationUser retUser = GetUser(organizationId, path);
HostedSolutionLog.LogEnd("GetUserGeneralSettingsInternal");
return retUser;
@ -650,7 +972,7 @@ namespace WebsitePanel.Providers.HostedSolution
user.Properties[ADAttributes.PwdLastSet].Value = userMustChangePassword ? 0 : -1;
}
private OrganizationUser GetUser(string path)
private OrganizationUser GetUser(string organizationId, string path)
{
OrganizationUser retUser = new OrganizationUser();
@ -686,9 +1008,41 @@ namespace WebsitePanel.Providers.HostedSolution
retUser.UserPrincipalName = (string)entry.InvokeGet(ADAttributes.UserPrincipalName);
retUser.UserMustChangePassword = GetUserMustChangePassword(entry);
var psoName = FormOrganizationPSOName(organizationId);
retUser.PasswordExpirationDateTime = GetPasswordExpirationDate(psoName, entry);
return retUser;
}
private DateTime GetPasswordExpirationDate(string psoName, DirectoryEntry entry)
{
Runspace runspace = null;
try
{
runspace = OpenRunspace();
var maxPasswordAgeSpan = GetMaxPasswordAge(runspace, psoName);
var pwdLastSetTicks = ConvertADSLargeIntegerToInt64(entry.Properties[ADAttributes.PwdLastSet].Value);
var pwdLastSetDate = DateTime.FromFileTimeUtc(pwdLastSetTicks);
if (maxPasswordAgeSpan == TimeSpan.MaxValue)
{
return DateTime.MaxValue;
}
return pwdLastSetDate.AddDays(maxPasswordAgeSpan.Days);
}
finally
{
CloseRunspace(runspace);
}
}
private string GetDomainName(string username)
{
string domain = ActiveDirectoryUtils.GetNETBIOSDomainName(RootDomain);
@ -1055,7 +1409,7 @@ namespace WebsitePanel.Providers.HostedSolution
foreach (string userPath in ActiveDirectoryUtils.GetGroupObjects(groupName, "user", organizationEntry))
{
OrganizationUser tmpUser = GetUser(userPath);
OrganizationUser tmpUser = GetUser(organizationId, userPath);
members.Add(new ExchangeAccount
{
@ -1326,12 +1680,46 @@ namespace WebsitePanel.Providers.HostedSolution
internal void DeleteMappedDriveByPathInternal(string organizationId, string path)
{
MappedDrive drive = GetDriveMaps(organizationId).Where(x => x.Path == path).FirstOrDefault();
HostedSolutionLog.LogStart("DeleteMappedDriveInternal");
HostedSolutionLog.DebugInfo("path : {0}:", path);
HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId);
if (drive != null)
{
DeleteMappedDriveInternal(organizationId, drive.DriveLetter);
}
if (string.IsNullOrEmpty(organizationId))
throw new ArgumentNullException("organizationId");
if (string.IsNullOrEmpty(path))
throw new ArgumentNullException("path");
string gpoId;
if (!CheckMappedDriveGpoExists(organizationId, out gpoId))
{
CreateAndLinkMappedDrivesGPO(organizationId, out gpoId);
}
if (!string.IsNullOrEmpty(gpoId))
{
string filePath = 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(filePath);
XmlNode drive = xml.SelectSingleNode(string.Format("./Drives/Drive[contains(Properties/@path,'{0}')]", path));
if (drive != null)
{
drive.ParentNode.RemoveChild(drive);
}
xml.Save(filePath);
IncrementGPOVersion(organizationId, gpoId);
}
HostedSolutionLog.LogEnd("DeleteMappedDriveInternal");
}
public void DeleteMappedDrive(string organizationId, string drive)

View file

@ -31,6 +31,7 @@ using System.IO;
using System.Net.Mail;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using Microsoft.Win32;
@ -38,7 +39,7 @@ using WebsitePanel.Server.Utils;
namespace WebsitePanel.Providers.Mail
{
public class IceWarp : HostingServiceProviderBase, IMailServer
public class IceWarp : HostingServiceProviderBase, IMailServer, IDisposable
{
protected const string API_PROGID = "IceWarpServer.APIObject";
protected const string DOMAIN_PROGID = "IceWarpServer.DomainObject";
@ -46,7 +47,7 @@ namespace WebsitePanel.Providers.Mail
private dynamic _currentApiObject = null;
#region IceWarp Enums
#region Protected Enums
protected enum IceWarpErrorCode
{
@ -109,8 +110,8 @@ namespace WebsitePanel.Providers.Mail
get
{
var apiObject = GetApiObject();
var adresses = ((object) apiObject.GetProperty("C_System_Services_BindIPAddress"));
return adresses == null ? "" : adresses.ToString().Split(new[] {';'}, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
var adresses = ((object)apiObject.GetProperty("C_System_Services_BindIPAddress"));
return adresses == null ? "" : adresses.ToString().Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
}
}
@ -119,7 +120,7 @@ namespace WebsitePanel.Providers.Mail
get
{
var apiObject = GetApiObject();
return Convert.ToBoolean((object) apiObject.GetProperty("C_Accounts_Global_Domains_UseDiskQuota"));
return Convert.ToBoolean((object)apiObject.GetProperty("C_Accounts_Global_Domains_UseDiskQuota"));
}
}
@ -128,7 +129,7 @@ namespace WebsitePanel.Providers.Mail
get
{
var apiObject = GetApiObject();
return Convert.ToBoolean((object) apiObject.GetProperty("C_Accounts_Global_Domains_UseDomainLimits"));
return Convert.ToBoolean((object)apiObject.GetProperty("C_Accounts_Global_Domains_UseDomainLimits"));
}
}
@ -137,7 +138,7 @@ namespace WebsitePanel.Providers.Mail
get
{
var apiObject = GetApiObject();
return Convert.ToBoolean((object) apiObject.GetProperty("C_Accounts_Global_Domains_UseUserLimits"));
return Convert.ToBoolean((object)apiObject.GetProperty("C_Accounts_Global_Domains_UseUserLimits"));
}
}
@ -146,7 +147,7 @@ namespace WebsitePanel.Providers.Mail
get
{
var apiObject = GetApiObject();
return Convert.ToBoolean((object) apiObject.GetProperty("C_Accounts_Global_Domains_OverrideGlobal"));
return Convert.ToBoolean((object)apiObject.GetProperty("C_Accounts_Global_Domains_OverrideGlobal"));
}
}
@ -155,7 +156,7 @@ namespace WebsitePanel.Providers.Mail
get
{
var apiObject = GetApiObject();
return Convert.ToInt32((object) apiObject.GetProperty("C_Mail_SMTP_Delivery_MaxMsgSize"))/1024/1024;
return Convert.ToInt32((object)apiObject.GetProperty("C_Mail_SMTP_Delivery_MaxMsgSize")) / 1024 / 1024;
}
}
@ -194,7 +195,7 @@ namespace WebsitePanel.Providers.Mail
protected static string GetErrorMessage(int errorCode)
{
switch ((IceWarpErrorCode) errorCode)
switch ((IceWarpErrorCode)errorCode)
{
case IceWarpErrorCode.S_OK:
return "OK";
@ -248,6 +249,11 @@ namespace WebsitePanel.Providers.Mail
}
}
protected void DisposeObject(object obj)
{
Marshal.FinalReleaseComObject(obj);
}
protected dynamic GetApiObject()
{
if (_currentApiObject != null) return _currentApiObject;
@ -386,6 +392,8 @@ namespace WebsitePanel.Providers.Mail
}
}
DisposeObject(accountObject);
return mailAccounts.ToArray();
}
@ -399,7 +407,7 @@ namespace WebsitePanel.Providers.Mail
apiObject.SetProperty("C_Accounts_Global_Domains_WarnMailboxUsage", ProviderSettings["WarnMailboxUsage"]);
apiObject.SetProperty("C_Accounts_Global_Domains_WarnDomainSize", ProviderSettings["WarnDomainSize"]);
apiObject.SetProperty("C_Mail_SMTP_Delivery_MaxMsgSize", Convert.ToInt32(ProviderSettings["MaxMessageSize"])*1024*1024);
apiObject.SetProperty("C_Mail_SMTP_Delivery_MaxMsgSize", Convert.ToInt32(ProviderSettings["MaxMessageSize"]) * 1024 * 1024);
apiObject.SetProperty("C_Mail_SMTP_Delivery_LimitMsgSize", Convert.ToInt32(ProviderSettings["MaxMessageSize"]) > 0);
SaveApiSetting(apiObject);
@ -407,11 +415,11 @@ namespace WebsitePanel.Providers.Mail
#endregion
#region IHostingServiceProvier methods
#region IHostingServiceProvier methods
public override SettingPair[] GetProviderDefaultSettings()
{
var settings = new []
public override SettingPair[] GetProviderDefaultSettings()
{
var settings = new[]
{
new SettingPair("UseDomainDiskQuota", UseDomainDiskQuota.ToString()),
new SettingPair("UseDomainLimits", UseDomainLimits.ToString()),
@ -423,8 +431,8 @@ namespace WebsitePanel.Providers.Mail
new SettingPair("ServerIpAddress", BindIpAddress)
};
return settings;
}
return settings;
}
public override string[] Install()
{
@ -433,25 +441,25 @@ namespace WebsitePanel.Providers.Mail
}
public override void ChangeServiceItemsState(ServiceProviderItem[] items, bool enabled)
{
foreach (var item in items.OfType<MailDomain>())
{
try
{
// enable/disable mail domain
if (DomainExists(item.Name))
{
var mailDomain = GetDomain(item.Name);
mailDomain.Enabled = enabled;
UpdateDomain(mailDomain);
}
}
catch (Exception ex)
{
Log.WriteError(String.Format("Error switching '{0}' IceWarp domain", item.Name), ex);
}
}
}
{
foreach (var item in items.OfType<MailDomain>())
{
try
{
// enable/disable mail domain
if (DomainExists(item.Name))
{
var mailDomain = GetDomain(item.Name);
mailDomain.Enabled = enabled;
UpdateDomain(mailDomain);
}
}
catch (Exception ex)
{
Log.WriteError(String.Format("Error switching '{0}' IceWarp domain", item.Name), ex);
}
}
}
public override void DeleteServiceItems(ServiceProviderItem[] items)
{
@ -470,64 +478,69 @@ namespace WebsitePanel.Providers.Mail
}
public override ServiceProviderItemDiskSpace[] GetServiceItemsDiskSpace(ServiceProviderItem[] items)
{
var itemsDiskspace = new List<ServiceProviderItemDiskSpace>();
{
var itemsDiskspace = new List<ServiceProviderItemDiskSpace>();
// update items with diskspace
foreach (var item in items.OfType<MailAccount>())
{
try
{
Log.WriteStart(String.Format("Calculating mail account '{0}' size", item.Name));
// calculate disk space
var accountObject = GetAccountObject(item.Name);
var size = Convert.ToInt64((object)accountObject.GetProperty("U_MailboxSize")) * 1024;
var accountObject = GetAccountObject();
var diskspace = new ServiceProviderItemDiskSpace {ItemId = item.Id, DiskSpace = size};
itemsDiskspace.Add(diskspace);
Log.WriteEnd(String.Format("Calculating mail account '{0}' size", item.Name));
}
catch (Exception ex)
{
Log.WriteError(ex);
}
}
return itemsDiskspace.ToArray();
}
// update items with diskspace
foreach (var item in items.OfType<MailAccount>())
{
try
{
Log.WriteStart(String.Format("Calculating mail account '{0}' size", item.Name));
// calculate disk space
accountObject.Open(item.Name);
var size = Convert.ToInt64((object)accountObject.GetProperty("U_MailboxSize")) * 1024;
public override ServiceProviderItemBandwidth[] GetServiceItemsBandwidth(ServiceProviderItem[] items, DateTime since)
{
var itemsBandwidth = new ServiceProviderItemBandwidth[items.Length];
var diskspace = new ServiceProviderItemDiskSpace { ItemId = item.Id, DiskSpace = size };
itemsDiskspace.Add(diskspace);
// update items with diskspace
for (int i = 0; i < items.Length; i++)
{
ServiceProviderItem item = items[i];
Log.WriteEnd(String.Format("Calculating mail account '{0}' size", item.Name));
}
catch (Exception ex)
{
Log.WriteError(ex);
}
}
// create new bandwidth object
itemsBandwidth[i] = new ServiceProviderItemBandwidth
{
ItemId = item.Id,
DisposeObject(accountObject);
return itemsDiskspace.ToArray();
}
public override ServiceProviderItemBandwidth[] GetServiceItemsBandwidth(ServiceProviderItem[] items, DateTime since)
{
var itemsBandwidth = new ServiceProviderItemBandwidth[items.Length];
// update items with bandwidth
for (var i = 0; i < items.Length; i++)
{
var item = items[i];
// create new bandwidth object
itemsBandwidth[i] = new ServiceProviderItemBandwidth
{
ItemId = item.Id,
Days = new DailyStatistics[0]
};
};
if (item is MailDomain)
{
try
{
// get daily statistics
itemsBandwidth[i].Days = GetDailyStatistics(since, item.Name);
}
catch (Exception ex)
{
Log.WriteError(ex);
System.Diagnostics.Debug.WriteLine(ex);
}
}
}
if (!(item is MailDomain)) continue;
return itemsBandwidth;
}
try
{
// get daily statistics
itemsBandwidth[i].Days = GetDailyStatistics(since, item.Name);
}
catch (Exception ex)
{
Log.WriteError(ex);
System.Diagnostics.Debug.WriteLine(ex);
}
}
return itemsBandwidth;
}
public DailyStatistics[] GetDailyStatistics(DateTime since, string maildomainName)
{
@ -568,8 +581,8 @@ namespace WebsitePanel.Providers.Mail
Year = date.Year,
Month = date.Month,
Day = date.Day,
BytesSent = Convert.ToInt64(fields[mailSentField])*1024,
BytesReceived = Convert.ToInt64(fields[mailReceivedField])*1024
BytesSent = Convert.ToInt64(fields[mailSentField]) * 1024,
BytesReceived = Convert.ToInt64(fields[mailReceivedField]) * 1024
};
days.Add(dailyStats);
continue;
@ -618,7 +631,7 @@ namespace WebsitePanel.Providers.Mail
// Checking for version 10.4.0 (released 2012-03-21) or newer
// This version introduced L_ListFile_Contents, G_ListFile_Contents and M_ListFileContents that is the latest API variable used by this provider
var split = version.Split(new[] {'.'});
var split = version.Split(new[] { '.' });
var majorVersion = Convert.ToInt32(split[0]);
var minVersion = Convert.ToInt32(split[1]);
@ -636,32 +649,34 @@ namespace WebsitePanel.Providers.Mail
public string[] GetDomains()
{
var api = GetApiObject();
return api.GetDomainList().Split(new[] {';'}, StringSplitOptions.RemoveEmptyEntries);
return api.GetDomainList().Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
}
public MailDomain GetDomain(string domainName)
{
var domain = GetDomainObject(domainName);
var domainObject = GetDomainObject(domainName);
var mailDomain = new MailDomain
{
Name = domain.Name,
PostmasterAccount = domain.GetProperty("D_AdminEmail"),
CatchAllAccount = domain.GetProperty("D_UnknownForwardTo"),
Enabled = Convert.ToBoolean((object) domain.GetProperty("D_DisableLogin")),
MaxDomainSizeInMB = Convert.ToInt32((object) domain.GetProperty("D_DiskQuota"))/1024,
MaxDomainUsers = Convert.ToInt32((object) domain.GetProperty("D_AccountNumber")),
MegaByteSendLimit = Convert.ToInt32((object) domain.GetProperty("D_VolumeLimit"))/1024,
NumberSendLimit = Convert.ToInt32((object) domain.GetProperty("D_NumberLimit")),
DefaultUserQuotaInMB = Convert.ToInt32((object) domain.GetProperty("D_UserMailbox"))/1024,
DefaultUserMaxMessageSizeMegaByte = Convert.ToInt32((object) domain.GetProperty("D_UserMsg"))/1024,
DefaultUserMegaByteSendLimit = Convert.ToInt32((object) domain.GetProperty("D_UserMB")),
DefaultUserNumberSendLimit = Convert.ToInt32((object) domain.GetProperty("D_UserNumber")),
Name = domainObject.Name,
PostmasterAccount = domainObject.GetProperty("D_AdminEmail"),
CatchAllAccount = domainObject.GetProperty("D_UnknownForwardTo"),
Enabled = Convert.ToBoolean((object)domainObject.GetProperty("D_DisableLogin")),
MaxDomainSizeInMB = Convert.ToInt32((object)domainObject.GetProperty("D_DiskQuota")) / 1024,
MaxDomainUsers = Convert.ToInt32((object)domainObject.GetProperty("D_AccountNumber")),
MegaByteSendLimit = Convert.ToInt32((object)domainObject.GetProperty("D_VolumeLimit")) / 1024,
NumberSendLimit = Convert.ToInt32((object)domainObject.GetProperty("D_NumberLimit")),
DefaultUserQuotaInMB = Convert.ToInt32((object)domainObject.GetProperty("D_UserMailbox")) / 1024,
DefaultUserMaxMessageSizeMegaByte = Convert.ToInt32((object)domainObject.GetProperty("D_UserMsg")) / 1024,
DefaultUserMegaByteSendLimit = Convert.ToInt32((object)domainObject.GetProperty("D_UserMB")),
DefaultUserNumberSendLimit = Convert.ToInt32((object)domainObject.GetProperty("D_UserNumber")),
UseDomainDiskQuota = Convert.ToBoolean(ProviderSettings["UseDomainDiskQuota"]),
UseDomainLimits = Convert.ToBoolean(ProviderSettings["UseDomainLimits"]),
UseUserLimits = Convert.ToBoolean(ProviderSettings["UseUserLimits"])
};
DisposeObject(domainObject);
return mailDomain;
}
@ -685,6 +700,8 @@ namespace WebsitePanel.Providers.Mail
SaveDomain(domainObject);
DisposeObject(domainObject);
UpdateDomain(domain);
}
@ -706,17 +723,19 @@ namespace WebsitePanel.Providers.Mail
}
domainObject.SetProperty("D_DisableLogin", !domain.Enabled);
domainObject.SetProperty("D_DiskQuota", domain.MaxDomainSizeInMB*1024);
domainObject.SetProperty("D_DiskQuota", domain.MaxDomainSizeInMB * 1024);
domainObject.SetProperty("D_AccountNumber", domain.MaxDomainUsers);
domainObject.SetProperty("D_VolumeLimit", domain.MegaByteSendLimit*1024);
domainObject.SetProperty("D_VolumeLimit", domain.MegaByteSendLimit * 1024);
domainObject.SetProperty("D_NumberLimit", domain.NumberSendLimit);
domainObject.SetProperty("D_UserMailbox", domain.DefaultUserQuotaInMB*1024);
domainObject.SetProperty("D_UserMsg", domain.DefaultUserMaxMessageSizeMegaByte*1024);
domainObject.SetProperty("D_UserMailbox", domain.DefaultUserQuotaInMB * 1024);
domainObject.SetProperty("D_UserMsg", domain.DefaultUserMaxMessageSizeMegaByte * 1024);
domainObject.SetProperty("D_UserMB", domain.DefaultUserMegaByteSendLimit);
domainObject.SetProperty("D_UserNumber", domain.DefaultUserNumberSendLimit);
SaveDomain(domainObject);
DisposeObject(domainObject);
}
public void DeleteDomain(string domainName)
@ -732,6 +751,8 @@ namespace WebsitePanel.Providers.Mail
{
Log.WriteError("Could not delete domain" + GetErrorMessage(domainObject.LastErr), null);
}
DisposeObject(domainObject);
}
#endregion
@ -747,7 +768,11 @@ namespace WebsitePanel.Providers.Mail
var domainObject = GetDomainObject(aliasName);
return Convert.ToInt32((object) domainObject.GetProperty("D_Type")) == 2 && string.Compare(domainObject.GetProperty("D_DomainValue").ToString(), domainName, true) == 0;
var result = Convert.ToInt32((object)domainObject.GetProperty("D_Type")) == 2 && string.Compare(domainObject.GetProperty("D_DomainValue").ToString(), domainName, true) == 0;
DisposeObject(domainObject);
return result;
}
public string[] GetDomainAliases(string domainName)
@ -772,13 +797,15 @@ namespace WebsitePanel.Providers.Mail
public void AddDomainAlias(string domainName, string aliasName)
{
var mailDomain = new MailDomain {Name = aliasName};
var mailDomain = new MailDomain { Name = aliasName };
CreateDomain(mailDomain);
var domainObject = GetDomainObject(aliasName);
domainObject.SetProperty("D_Type", 2);
domainObject.SetProperty("D_DomainValue", domainName);
SaveDomain(domainObject);
DisposeObject(domainObject);
}
public void DeleteDomainAlias(string domainName, string aliasName)
@ -794,7 +821,11 @@ namespace WebsitePanel.Providers.Mail
{
var accountObject = GetAccountObject();
return accountObject.Open(mailboxName) && Convert.ToInt32((object) accountObject.GetProperty("U_Type")) == (int) IceWarpAccountType.User;
var result = accountObject.Open(mailboxName) && Convert.ToInt32((object)accountObject.GetProperty("U_Type")) == (int)IceWarpAccountType.User;
DisposeObject(accountObject);
return result;
}
protected class IceWarpResponderContent
@ -840,35 +871,35 @@ namespace WebsitePanel.Providers.Mail
return result;
}
protected static MailAccount CreateMailAccountFromAccountObject(dynamic accountObject)
protected MailAccount CreateMailAccountFromAccountObject(dynamic accountObject)
{
var mailAccount = new MailAccount
{
Name = accountObject.EmailAddress,
FullName = accountObject.GetProperty("U_Name"),
Enabled = Convert.ToInt32((object) accountObject.GetProperty("U_AccountDisabled")) == 0,
ForwardingEnabled = !string.IsNullOrWhiteSpace(accountObject.GetProperty("U_ForwardTo")) || string.IsNullOrWhiteSpace(accountObject.GetProperty("U_RemoteAddress")) && Convert.ToBoolean((object) accountObject.GetProperty("U_UseRemoteAddress")),
IsDomainAdmin = Convert.ToBoolean((object) accountObject.GetProperty("U_DomainAdmin")),
MaxMailboxSize = Convert.ToBoolean((object) accountObject.GetProperty("U_MaxBox")) ? Convert.ToInt32((object) accountObject.GetProperty("U_MaxBoxSize"))/1024 : 0,
Enabled = Convert.ToInt32((object)accountObject.GetProperty("U_AccountDisabled")) == 0,
ForwardingEnabled = !string.IsNullOrWhiteSpace(accountObject.GetProperty("U_ForwardTo")) || string.IsNullOrWhiteSpace(accountObject.GetProperty("U_RemoteAddress")) && Convert.ToBoolean((object)accountObject.GetProperty("U_UseRemoteAddress")),
IsDomainAdmin = Convert.ToBoolean((object)accountObject.GetProperty("U_DomainAdmin")),
MaxMailboxSize = Convert.ToBoolean((object)accountObject.GetProperty("U_MaxBox")) ? Convert.ToInt32((object)accountObject.GetProperty("U_MaxBoxSize")) / 1024 : 0,
Password = accountObject.GetProperty("U_Password"),
ResponderEnabled = Convert.ToInt32((object) accountObject.GetProperty("U_Respond")) > 0,
QuotaUsed = Convert.ToInt64((object) accountObject.GetProperty("U_MailBoxSize")),
MaxMessageSizeMegaByte = Convert.ToInt32((object) accountObject.GetProperty("U_MaxMessageSize"))/1024,
MegaByteSendLimit = Convert.ToInt32((object) accountObject.GetProperty("U_MegabyteSendLimit")),
NumberSendLimit = Convert.ToInt32((object) accountObject.GetProperty("U_NumberSendLimit")),
DeleteOlder = Convert.ToBoolean((object) accountObject.GetProperty("U_DeleteOlder")),
DeleteOlderDays = Convert.ToInt32((object) accountObject.GetProperty("U_DeleteOlderDays")),
ForwardOlder = Convert.ToBoolean((object) accountObject.GetProperty("U_ForwardOlder")),
ForwardOlderDays = Convert.ToInt32((object) accountObject.GetProperty("U_ForwardOlderDays")),
ResponderEnabled = Convert.ToInt32((object)accountObject.GetProperty("U_Respond")) > 0,
QuotaUsed = Convert.ToInt64((object)accountObject.GetProperty("U_MailBoxSize")),
MaxMessageSizeMegaByte = Convert.ToInt32((object)accountObject.GetProperty("U_MaxMessageSize")) / 1024,
MegaByteSendLimit = Convert.ToInt32((object)accountObject.GetProperty("U_MegabyteSendLimit")),
NumberSendLimit = Convert.ToInt32((object)accountObject.GetProperty("U_NumberSendLimit")),
DeleteOlder = Convert.ToBoolean((object)accountObject.GetProperty("U_DeleteOlder")),
DeleteOlderDays = Convert.ToInt32((object)accountObject.GetProperty("U_DeleteOlderDays")),
ForwardOlder = Convert.ToBoolean((object)accountObject.GetProperty("U_ForwardOlder")),
ForwardOlderDays = Convert.ToInt32((object)accountObject.GetProperty("U_ForwardOlderDays")),
ForwardOlderTo = accountObject.GetProperty("U_ForwardOlderTo"),
IceWarpAccountState = Convert.ToInt32((object) accountObject.GetProperty("U_AccountDisabled")),
IceWarpAccountType = Convert.ToInt32((object) accountObject.GetProperty("U_AccountType")),
IceWarpRespondType = Convert.ToInt32((object) accountObject.GetProperty("U_Respond"))
IceWarpAccountState = Convert.ToInt32((object)accountObject.GetProperty("U_AccountDisabled")),
IceWarpAccountType = Convert.ToInt32((object)accountObject.GetProperty("U_AccountType")),
IceWarpRespondType = Convert.ToInt32((object)accountObject.GetProperty("U_Respond"))
};
if (mailAccount.ForwardingEnabled)
{
mailAccount.ForwardingAddresses = new string[] {accountObject.GetProperty("U_ForwardTo") + accountObject.GetProperty("U_RemoteAddress")};
mailAccount.ForwardingAddresses = new string[] { accountObject.GetProperty("U_ForwardTo") + accountObject.GetProperty("U_RemoteAddress") };
mailAccount.DeleteOnForward = Convert.ToInt32(accountObject.GetProperty("U_UseRemoteAddress")) == 1;
mailAccount.RetainLocalCopy = !mailAccount.DeleteOnForward;
}
@ -889,7 +920,7 @@ namespace WebsitePanel.Providers.Mail
mailAccount.RespondTo = respondTo;
}
mailAccount.RespondPeriodInDays = Convert.ToInt32((object) accountObject.GetProperty("U_RespondPeriod"));
mailAccount.RespondPeriodInDays = Convert.ToInt32((object)accountObject.GetProperty("U_RespondPeriod"));
var responderContent = ParseResponderContent(accountObject.GetProperty("U_ResponderContent"));
mailAccount.ResponderMessage = responderContent.Content;
mailAccount.ResponderSubject = responderContent.Subject;
@ -907,7 +938,11 @@ namespace WebsitePanel.Providers.Mail
public MailAccount GetAccount(string mailboxName)
{
var accountObject = GetAccountObject(mailboxName);
return CreateMailAccountFromAccountObject(accountObject);
var account = CreateMailAccountFromAccountObject(accountObject);
DisposeObject(accountObject);
return account;
}
public void CreateAccount(MailAccount mailbox)
@ -924,10 +959,12 @@ namespace WebsitePanel.Providers.Mail
if (accountObject.New(mailbox.Name))
{
accountObject.SetProperty("U_Password", mailbox.Password);
accountObject.Save();
UpdateAccount(mailbox);
}
UpdateAccount(mailbox);
DisposeObject(accountObject);
}
public void UpdateAccount(MailAccount mailbox)
@ -937,10 +974,15 @@ namespace WebsitePanel.Providers.Mail
accountObject.SetProperty("U_Name", mailbox.FullName);
accountObject.SetProperty("U_AccountDisabled", mailbox.IceWarpAccountState);
accountObject.SetProperty("U_DomainAdmin", mailbox.IsDomainAdmin);
accountObject.SetProperty("U_Password", mailbox.Password);
accountObject.SetProperty("U_MaxBoxSize", mailbox.MaxMailboxSize*1024);
if (mailbox.ChangePassword)
{
accountObject.SetProperty("U_Password", mailbox.Password);
}
accountObject.SetProperty("U_MaxBoxSize", mailbox.MaxMailboxSize * 1024);
accountObject.SetProperty("U_MaxBox", mailbox.MaxMailboxSize > 0 ? "1" : "0");
accountObject.SetProperty("U_MaxMessageSize", mailbox.MaxMessageSizeMegaByte*1024);
accountObject.SetProperty("U_MaxMessageSize", mailbox.MaxMessageSizeMegaByte * 1024);
accountObject.SetProperty("U_MegabyteSendLimit", mailbox.MegaByteSendLimit);
accountObject.SetProperty("U_NumberSendLimit", mailbox.NumberSendLimit);
accountObject.SetProperty("U_AccountType", mailbox.IceWarpAccountType);
@ -1000,6 +1042,8 @@ namespace WebsitePanel.Providers.Mail
}
SaveAccount(accountObject);
DisposeObject(accountObject);
}
public void DeleteAccount(string mailboxName)
@ -1014,6 +1058,8 @@ namespace WebsitePanel.Providers.Mail
{
Log.WriteError("Cannot delete account: " + GetErrorMessage(accountObject.LastErr), null);
}
DisposeObject(accountObject);
}
#endregion
@ -1024,7 +1070,11 @@ namespace WebsitePanel.Providers.Mail
{
var accountObject = GetAccountObject();
return accountObject.Open(mailAliasName);
var result = accountObject.Open(mailAliasName);
DisposeObject(accountObject);
return result;
}
protected IEnumerable<string> GetAliasListFromAccountObject(dynamic accountObject)
@ -1056,12 +1106,14 @@ namespace WebsitePanel.Providers.Mail
{
var forwardTo = GetForwardToAddressFromAccountObject(accountObject);
var aliases = GetAliasListFromAccountObject(accountObject) as IEnumerable<string>;
aliasList.AddRange(aliases.Where(a => a + "@" + domainName != forwardTo).Select(alias => new MailAlias {Name = alias + "@" + domainName, ForwardTo = forwardTo}));
aliasList.AddRange(aliases.Where(a => a + "@" + domainName != forwardTo).Select(alias => new MailAlias { Name = alias + "@" + domainName, ForwardTo = forwardTo }));
}
accountObject.FindDone();
}
DisposeObject(accountObject);
return aliasList.ToArray();
}
@ -1071,7 +1123,11 @@ namespace WebsitePanel.Providers.Mail
var forwardTo = GetForwardToAddressFromAccountObject(accountObject);
return new MailAlias {ForwardTo = forwardTo, Name = mailAliasName};
var result = new MailAlias { ForwardTo = forwardTo, Name = mailAliasName };
DisposeObject(accountObject);
return result;
}
public void CreateMailAlias(MailAlias mailAlias)
@ -1081,23 +1137,25 @@ namespace WebsitePanel.Providers.Mail
{
mailAlias.ForwardingEnabled = true;
mailAlias.DeleteOnForward = true;
mailAlias.ForwardingAddresses = new[] {mailAlias.ForwardTo};
mailAlias.ForwardingAddresses = new[] { mailAlias.ForwardTo };
mailAlias.Password = GetRandomPassword();
CreateAccount(mailAlias);
}
// else open account and add alias to list
// else open account and add alias to list
else
{
var accountOject = GetAccountObject(mailAlias.ForwardTo);
var aliases = ((IEnumerable<string>) GetAliasListFromAccountObject(accountOject)).ToList();
var accountObject = GetAccountObject(mailAlias.ForwardTo);
var aliases = ((IEnumerable<string>)GetAliasListFromAccountObject(accountObject)).ToList();
aliases.Add(GetEmailUser(mailAlias.Name));
accountOject.SetProperty("U_EmailAlias", string.Join(";", aliases));
accountObject.SetProperty("U_EmailAlias", string.Join(";", aliases));
SaveAccount(accountOject, "account when creating mail alias");
SaveAccount(accountObject, "account when creating mail alias");
DisposeObject(accountObject);
}
}
private string GetRandowChars(string chars, int length)
private static string GetRandowChars(string chars, int length)
{
var random = new Random();
return new string(Enumerable.Repeat(chars, length).Select(s => s[random.Next(s.Length)]).ToArray());
@ -1112,7 +1170,7 @@ namespace WebsitePanel.Providers.Mail
var alpha = apiObject.GetProperty("C_Accounts_Policies_Pass_Alpha");
return System.Web.Security.Membership.GeneratePassword(minLength, nonAlphaNum) +
GetRandowChars("0123456789", digits)+
GetRandowChars("0123456789", digits) +
GetRandowChars("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", alpha);
}
@ -1137,11 +1195,13 @@ namespace WebsitePanel.Providers.Mail
accountObject.SetProperty("U_EmailAlias", string.Join(";", otherAliases));
SaveAccount(accountObject, "account during alias delete");
}
// If no other aliases, this should be an account with a remote address and then we should delete the account
// If no other aliases, this should be an account with a remote address and then we should delete the account
else
{
DeleteAccount(mailAliasName);
}
DisposeObject(accountObject);
}
#endregion
@ -1152,7 +1212,11 @@ namespace WebsitePanel.Providers.Mail
{
var accountObject = GetAccountObject();
return accountObject.Open(groupName) && Convert.ToInt32(accountObject.GetProperty("U_Type")) == 7;
var result = accountObject.Open(groupName) && (IceWarpAccountType)Enum.Parse(typeof(IceWarpAccountType), ((object)accountObject.GetProperty("U_Type")).ToString()) == IceWarpAccountType.UserGroup;
DisposeObject(accountObject);
return result;
}
public MailGroup[] GetGroups(string domainName)
@ -1165,7 +1229,7 @@ namespace WebsitePanel.Providers.Mail
var mailGroup = new MailGroup
{
Name = accountObject.EmailAddress,
Enabled = Convert.ToInt32((object) accountObject.GetProperty("U_AccountDisabled")) == 0,
Enabled = Convert.ToInt32((object)accountObject.GetProperty("U_AccountDisabled")) == 0,
GroupName = accountObject.GetProperty("G_Name"),
Members = ((IEnumerable<string>)SplitFileContents(accountObject, "G_ListFile_Contents")).ToArray()
};
@ -1176,7 +1240,11 @@ namespace WebsitePanel.Providers.Mail
public MailGroup GetGroup(string groupName)
{
var accountObject = GetAccountObject(groupName);
return CreateMailGroupFromAccountObject(accountObject);
var result = CreateMailGroupFromAccountObject(accountObject);
DisposeObject(accountObject);
return result;
}
public void CreateGroup(MailGroup @group)
@ -1185,7 +1253,7 @@ namespace WebsitePanel.Providers.Mail
if (accountObject.New(group.Name))
{
accountObject.SetProperty("U_Type", 7);
accountObject.SetProperty("U_Type", IceWarpAccountType.UserGroup);
accountObject.SetProperty("G_GroupwareMailDelivery", false);
SaveAccount(accountObject, "group account");
}
@ -1195,6 +1263,8 @@ namespace WebsitePanel.Providers.Mail
}
UpdateGroup(group);
DisposeObject(accountObject);
}
public void UpdateGroup(MailGroup @group)
@ -1206,6 +1276,8 @@ namespace WebsitePanel.Providers.Mail
accountObject.SetProperty("G_ListFile_Contents", string.Join("\n", group.Members));
SaveAccount(accountObject, "group");
DisposeObject(accountObject);
}
public void DeleteGroup(string groupName)
@ -1220,6 +1292,8 @@ namespace WebsitePanel.Providers.Mail
{
Log.WriteError("Cannot delete group: " + GetErrorMessage(accountObject.LastErr), null);
}
DisposeObject(accountObject);
}
#endregion
@ -1230,7 +1304,11 @@ namespace WebsitePanel.Providers.Mail
{
var accountObject = GetAccountObject();
return accountObject.Open(maillistName) && (IceWarpAccountType) Enum.Parse(typeof (IceWarpAccountType), ((object) accountObject.GetProperty("U_Type")).ToString()) == IceWarpAccountType.MailingList;
var result = accountObject.Open(maillistName) && (IceWarpAccountType)Enum.Parse(typeof(IceWarpAccountType), ((object)accountObject.GetProperty("U_Type")).ToString()) == IceWarpAccountType.MailingList;
DisposeObject(accountObject);
return result;
}
public MailList[] GetLists(string domainName)
@ -1240,8 +1318,8 @@ namespace WebsitePanel.Providers.Mail
protected IEnumerable<string> SplitStringProperty(dynamic accountObject, string propertyName, char separator)
{
var value = (object) accountObject.GetProperty(propertyName);
return value == null ? new String[] {} : value.ToString().Split(new[] {separator}, StringSplitOptions.RemoveEmptyEntries);
var value = (object)accountObject.GetProperty(propertyName);
return value == null ? new String[] { } : value.ToString().Split(new[] { separator }, StringSplitOptions.RemoveEmptyEntries);
}
protected IEnumerable<string> SplitFileContents(dynamic accountObject, string propertyName)
@ -1262,43 +1340,43 @@ namespace WebsitePanel.Providers.Mail
Name = accountObject.EmailAddress,
Description = accountObject.GetProperty("M_Name"),
ModeratorAddress = accountObject.GetProperty("M_OwnerAddress"),
MembersSource = (IceWarpListMembersSource) Enum.Parse(typeof (IceWarpListMembersSource), ((object) accountObject.GetProperty("M_SendAllLists")).ToString()),
Members = ((IEnumerable<string>)SplitFileContents(accountObject, "M_ListFile_Contents")).Select(m => m.TrimEnd(new[] {';', '0', '1', '2'})).ToArray(),
SetReceipientsToToHeader = Convert.ToBoolean((object) accountObject.GetProperty("M_SeparateTo")),
MembersSource = (IceWarpListMembersSource)Enum.Parse(typeof(IceWarpListMembersSource), ((object)accountObject.GetProperty("M_SendAllLists")).ToString()),
Members = ((IEnumerable<string>)SplitFileContents(accountObject, "M_ListFile_Contents")).Select(m => m.TrimEnd(new[] { ';', '0', '1', '2' })).ToArray(),
SetReceipientsToToHeader = Convert.ToBoolean((object)accountObject.GetProperty("M_SeparateTo")),
SubjectPrefix = accountObject.GetProperty("M_AddToSubject"),
Originator = (IceWarpListOriginator) Enum.Parse(typeof (IceWarpListOriginator), ((object) accountObject.GetProperty("M_ListSender")).ToString()),
PostingMode = Convert.ToBoolean((object) accountObject.GetProperty("M_MembersOnly")) ? PostingMode.MembersCanPost : PostingMode.AnyoneCanPost,
PasswordProtection = (PasswordProtection) Enum.Parse(typeof (PasswordProtection), ((object) accountObject.GetProperty("M_Moderated")).ToString()),
Originator = (IceWarpListOriginator)Enum.Parse(typeof(IceWarpListOriginator), ((object)accountObject.GetProperty("M_ListSender")).ToString()),
PostingMode = Convert.ToBoolean((object)accountObject.GetProperty("M_MembersOnly")) ? PostingMode.MembersCanPost : PostingMode.AnyoneCanPost,
PasswordProtection = (PasswordProtection)Enum.Parse(typeof(PasswordProtection), ((object)accountObject.GetProperty("M_Moderated")).ToString()),
Password = accountObject.GetProperty("M_ModeratedPassword"),
DefaultRights = (IceWarpListDefaultRights) Enum.Parse(typeof (IceWarpListDefaultRights), ((object) accountObject.GetProperty("M_DefaultRights")).ToString()),
MaxMessageSizeEnabled = Convert.ToBoolean((object) accountObject.GetProperty("M_MaxList")),
MaxMessageSize = Convert.ToInt32((object) accountObject.GetProperty("M_MaxListSize")),
MaxMembers = Convert.ToInt32((object) accountObject.GetProperty("M_MaxMembers")),
SendToSender = Convert.ToBoolean((object) accountObject.GetProperty("M_SendToSender")),
DigestMode = Convert.ToBoolean((object) accountObject.GetProperty("M_DigestConfirmed")),
MaxMessagesPerMinute = Convert.ToInt32((object) accountObject.GetProperty("M_ListBatch")),
SendSubscribe = Convert.ToBoolean((object) accountObject.GetProperty("M_NotifyJoin")),
SendUnsubscribe = Convert.ToBoolean((object) accountObject.GetProperty("M_NotifyLeave")),
DefaultRights = (IceWarpListDefaultRights)Enum.Parse(typeof(IceWarpListDefaultRights), ((object)accountObject.GetProperty("M_DefaultRights")).ToString()),
MaxMessageSizeEnabled = Convert.ToBoolean((object)accountObject.GetProperty("M_MaxList")),
MaxMessageSize = Convert.ToInt32((object)accountObject.GetProperty("M_MaxListSize")),
MaxMembers = Convert.ToInt32((object)accountObject.GetProperty("M_MaxMembers")),
SendToSender = Convert.ToBoolean((object)accountObject.GetProperty("M_SendToSender")),
DigestMode = Convert.ToBoolean((object)accountObject.GetProperty("M_DigestConfirmed")),
MaxMessagesPerMinute = Convert.ToInt32((object)accountObject.GetProperty("M_ListBatch")),
SendSubscribe = Convert.ToBoolean((object)accountObject.GetProperty("M_NotifyJoin")),
SendUnsubscribe = Convert.ToBoolean((object)accountObject.GetProperty("M_NotifyLeave")),
// From list server account
ConfirmSubscription = (IceWarpListConfirmSubscription) Enum.Parse(typeof (IceWarpListConfirmSubscription), ((object) listServerAccountObject.GetProperty("L_DigestConfirmed")).ToString()),
CommandsInSubject = Convert.ToBoolean((object) listServerAccountObject.GetProperty("L_ListSubject")),
DisableSubscribecommand = !Convert.ToBoolean((object) listServerAccountObject.GetProperty("M_JoinR")),
AllowUnsubscribe = Convert.ToBoolean((object) listServerAccountObject.GetProperty("M_LeaveR")),
DisableListcommand = !Convert.ToBoolean((object) listServerAccountObject.GetProperty("M_ListsR")),
DisableWhichCommand = !Convert.ToBoolean((object) listServerAccountObject.GetProperty("M_WhichR")),
DisableReviewCommand = !Convert.ToBoolean((object) listServerAccountObject.GetProperty("M_ReviewR")),
DisableVacationCommand = !Convert.ToBoolean((object) listServerAccountObject.GetProperty("M_VacationR")),
Moderated = Convert.ToBoolean((object) listServerAccountObject.GetProperty("L_Moderated")),
ConfirmSubscription = (IceWarpListConfirmSubscription)Enum.Parse(typeof(IceWarpListConfirmSubscription), ((object)listServerAccountObject.GetProperty("L_DigestConfirmed")).ToString()),
CommandsInSubject = Convert.ToBoolean((object)listServerAccountObject.GetProperty("L_ListSubject")),
DisableSubscribecommand = !Convert.ToBoolean((object)listServerAccountObject.GetProperty("M_JoinR")),
AllowUnsubscribe = Convert.ToBoolean((object)listServerAccountObject.GetProperty("M_LeaveR")),
DisableListcommand = !Convert.ToBoolean((object)listServerAccountObject.GetProperty("M_ListsR")),
DisableWhichCommand = !Convert.ToBoolean((object)listServerAccountObject.GetProperty("M_WhichR")),
DisableReviewCommand = !Convert.ToBoolean((object)listServerAccountObject.GetProperty("M_ReviewR")),
DisableVacationCommand = !Convert.ToBoolean((object)listServerAccountObject.GetProperty("M_VacationR")),
Moderated = Convert.ToBoolean((object)listServerAccountObject.GetProperty("L_Moderated")),
CommandPassword = listServerAccountObject.GetProperty("L_ModeratedPassword"),
SuppressCommandResponses = Convert.ToBoolean((object) listServerAccountObject.GetProperty("L_MaxList"))
SuppressCommandResponses = Convert.ToBoolean((object)listServerAccountObject.GetProperty("L_MaxList"))
};
// This is how I get values for from and replyto header values. TODO: There must be a better way, but I don't see the pattern right now...
var ss = Convert.ToInt32((object) accountObject.GetProperty("M_SetSender"));
var sv = Convert.ToInt32((object) accountObject.GetProperty("M_SetValue"));
var vm = Convert.ToBoolean((object) accountObject.GetProperty("M_ValueMode"));
var ss = Convert.ToInt32((object)accountObject.GetProperty("M_SetSender"));
var sv = Convert.ToInt32((object)accountObject.GetProperty("M_SetValue"));
var vm = Convert.ToBoolean((object)accountObject.GetProperty("M_ValueMode"));
var value = accountObject.GetProperty("M_HeaderValue");
switch (ss)
@ -1363,13 +1441,19 @@ namespace WebsitePanel.Providers.Mail
break;
}
DisposeObject(listServerAccountObject);
return mailList;
}
public MailList GetList(string maillistName)
{
var accountObject = GetAccountObject(maillistName);
return CreateMailListFromAccountObject(accountObject);
var result = CreateMailListFromAccountObject(accountObject);
DisposeObject(accountObject);
return result;
}
public void CreateList(MailList maillist)
@ -1395,6 +1479,8 @@ namespace WebsitePanel.Providers.Mail
SaveAccount(accountObject, "mailing list");
UpdateList(maillist);
DisposeObject(accountObject);
}
protected dynamic FindMatchingListServerAccount(string mailingListName, bool createListServerAccountIfNeeded)
@ -1555,7 +1641,7 @@ namespace WebsitePanel.Providers.Mail
listServerAccountObject.SetProperty("L_ListSender", maillist.Originator);
listServerAccountObject.SetProperty("L_MaxList", maillist.SuppressCommandResponses);
SaveAccount(accountObject, "listserver account associated with mailing list");
SaveAccount(listServerAccountObject, "listserver account associated with mailing list");
}
public void DeleteList(string maillistName)
@ -1602,8 +1688,16 @@ namespace WebsitePanel.Providers.Mail
{
Log.WriteError("Cannot delete mail list: " + GetErrorMessage(accountObject.LastErr), null);
}
DisposeObject(accountObject);
DisposeObject(listServerAccountObject);
}
#endregion
public void Dispose()
{
Marshal.FinalReleaseComObject(_currentApiObject);
}
}
}

View file

@ -52,7 +52,7 @@ namespace WebsitePanel.Providers.Virtualization
cmd.Parameters.Add("DynamicMemoryEnabled", false);
}
powerShell.Execute(cmd, true);
powerShell.Execute(cmd, true, true);
}
}
}

View file

@ -74,6 +74,7 @@ namespace WebsitePanel.Providers.Virtualization
{
Command cmd = new Command("Stop-VM");
cmd.Parameters.Add("Name", vmName);
if (force) cmd.Parameters.Add("Force");
if (!string.IsNullOrEmpty(server)) cmd.Parameters.Add("ComputerName", server);
//if (!string.IsNullOrEmpty(reason)) cmd.Parameters.Add("Reason", reason);

View file

@ -102,7 +102,7 @@ namespace WebsitePanel.Providers.Virtualization
public ReplicaMode ReplicaMode
{
get { return (ReplicaMode) ProviderSettings.GetInt("ReplicaMode"); }
get { return (ReplicaMode) Enum.Parse(typeof(ReplicaMode) , ProviderSettings["ReplicaMode"]); }
}
protected string ReplicaServerPath
{
@ -239,7 +239,7 @@ namespace WebsitePanel.Providers.Virtualization
Name = current.GetString("Name"),
State = current.GetEnum<VirtualMachineState>("State"),
Uptime = Convert.ToInt64(current.GetProperty<TimeSpan>("UpTime").TotalMilliseconds),
ReplicationState = result[0].GetEnum<ReplicationState>("ReplicationState")
ReplicationState = current.GetEnum<ReplicationState>("ReplicationState")
};
vmachines.Add(vm);
}
@ -780,10 +780,10 @@ namespace WebsitePanel.Providers.Virtualization
Command cmd = new Command("Get-VMSwitch");
// Not needed as the PowerShellManager adds the computer name
//if (!string.IsNullOrEmpty(computerName)) cmd.Parameters.Add("ComputerName", computerName);
if (!string.IsNullOrEmpty(computerName)) cmd.Parameters.Add("ComputerName", computerName);
if (!string.IsNullOrEmpty(type)) cmd.Parameters.Add("SwitchType", type);
Collection<PSObject> result = PowerShell.Execute(cmd, true, true);
Collection<PSObject> result = PowerShell.Execute(cmd, false, true);
foreach (PSObject current in result)
{
@ -2037,19 +2037,18 @@ namespace WebsitePanel.Providers.Virtualization
var excludes = vm.Disks
.Select(d => d.Path)
.Where(p => !p.Equals(replication.VhdToReplicate, StringComparison.OrdinalIgnoreCase))
.Where(p => replication.VhdToReplicate.All(vp => !p.Equals(vp, StringComparison.OrdinalIgnoreCase)))
.ToArray();
if (excludes.Any())
cmd.Parameters.Add("ExcludedVhdPath", excludes);
// recovery points
cmd.Parameters.Add("RecoveryHistory", replication.AdditionalRecoveryPoints);
if (replication.AdditionalRecoveryPoints > 0)
{
if (replication.AdditionalRecoveryPoints > 24)
throw new Exception("AdditionalRecoveryPoints can not be greater than 24");
cmd.Parameters.Add("RecoveryHistory", replication.AdditionalRecoveryPoints);
if (replication.VSSSnapshotFrequencyHour > 0)
{
if (replication.VSSSnapshotFrequencyHour > 12)
@ -2059,10 +2058,7 @@ namespace WebsitePanel.Providers.Virtualization
}
}
PowerShell.Execute(cmd, true);
// Initial Replication
StartInitialReplication(vmId);
PowerShell.Execute(cmd, true, true);
}
public void SetVmReplication(string vmId, string replicaServer, VmReplication replication)
@ -2080,21 +2076,13 @@ namespace WebsitePanel.Providers.Virtualization
cmd.Parameters.Add("CertificateThumbprint", replication.Thumbprint);
cmd.Parameters.Add("ReplicationFrequencySec", (int)replication.ReplicaFrequency);
var excludes = vm.Disks
.Select(d => d.Path)
.Where(p => !p.Equals(replication.VhdToReplicate, StringComparison.OrdinalIgnoreCase))
.ToArray();
if (excludes.Any())
cmd.Parameters.Add("ExcludedVhdPath", excludes);
// recovery points
cmd.Parameters.Add("RecoveryHistory", replication.AdditionalRecoveryPoints);
if (replication.AdditionalRecoveryPoints > 0)
{
if (replication.AdditionalRecoveryPoints > 24)
throw new Exception("AdditionalRecoveryPoints can not be greater than 24");
cmd.Parameters.Add("RecoveryHistory", replication.AdditionalRecoveryPoints);
if (replication.VSSSnapshotFrequencyHour > 0)
{
if (replication.VSSSnapshotFrequencyHour > 12)
@ -2102,9 +2090,13 @@ namespace WebsitePanel.Providers.Virtualization
cmd.Parameters.Add("VSSSnapshotFrequencyHour", replication.VSSSnapshotFrequencyHour);
}
else
{
cmd.Parameters.Add("DisableVSSSnapshotReplication");
}
}
PowerShell.Execute(cmd, true);
PowerShell.Execute(cmd, true, true);
}
public void TestReplicationServer(string vmId, string replicaServer, string localThumbprint)
@ -2163,36 +2155,21 @@ namespace WebsitePanel.Providers.Virtualization
excludes.Add(item.Path.ToString());
replica.VhdToReplicate = vm.Disks
.Select(d => d.Path)
.FirstOrDefault(p => excludes.All(ep => !p.Equals(ep, StringComparison.OrdinalIgnoreCase)));
.Where(p => excludes.All(ep => !p.Equals(ep, StringComparison.OrdinalIgnoreCase)))
.ToArray();
}
return replica;
}
public bool DisableVmReplication(string vmId, string replicaServer)
public void DisableVmReplication(string vmId)
{
if (ReplicaMode != ReplicaMode.ReplicationEnabled)
if (ReplicaMode == ReplicaMode.None)
throw new Exception("Server does not allow replication by settings");
var vm = GetVirtualMachine(vmId);
ReplicaHelper.RemoveVmReplication(PowerShell, vm.Name, ServerNameSettings);
// move it to EnterpriseServer?
// If we have access - delete garbage from replica server
try
{
ReplicaHelper.RemoveVmReplication(PowerShell, vm.Name, replicaServer);
// Delete replica vm
VirtualMachineHelper.Stop(PowerShell, vm.Name, true, replicaServer);
VirtualMachineHelper.Delete(PowerShell, vm.Name, replicaServer);
}
catch
{
return false;
}
return true;
}
@ -2212,13 +2189,13 @@ namespace WebsitePanel.Providers.Virtualization
if (result != null && result.Count > 0)
{
replica = new ReplicationDetailInfo();
replica.AverageLatency = result[0].GetProperty<TimeSpan>("AverageReplicationLatency");
replica.AverageLatency = result[0].GetProperty<TimeSpan?>("AverageReplicationLatency") ?? new TimeSpan();
replica.AverageSize = result[0].GetMb("AverageReplicationSize");
replica.Errors = result[0].GetInt("ReplicationErrors");
replica.FromTime = result[0].GetProperty<DateTime>("MonitoringStartTime");
replica.Health = result[0].GetEnum<ReplicationHealth>("ReplicationHealth");
replica.HealthDetails = result[0].GetString("ReplicationHealthDetails");
replica.LastSynhronizedAt = result[0].GetProperty<DateTime>("LastReplicationTime");
replica.HealthDetails = string.Join(" ", result[0].GetProperty<string[]>("ReplicationHealthDetails"));
replica.LastSynhronizedAt = result[0].GetProperty<DateTime?>("LastReplicationTime") ?? new DateTime();
replica.MaximumSize = result[0].GetMb("MaximumReplicationSize");
replica.Mode = result[0].GetEnum<VmReplicationMode>("ReplicationMode");
replica.PendingSize = result[0].GetMb("PendingReplicationSize");
@ -2226,6 +2203,7 @@ namespace WebsitePanel.Providers.Virtualization
replica.ReplicaServerName = result[0].GetString("CurrentReplicaServerName");
replica.State = result[0].GetEnum<ReplicationState>("ReplicationState");
replica.SuccessfulReplications = result[0].GetInt("SuccessfulReplicationCount");
replica.MissedReplicationCount = result[0].GetInt("MissedReplicationCount");
replica.ToTime = result[0].GetProperty<DateTime>("MonitoringEndTime");
}

View file

@ -2749,45 +2749,40 @@ namespace WebsitePanel.Providers.Virtualization2012 {
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/DisableVmReplication", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public bool DisableVmReplication(string vmId, string replicaServer) {
object[] results = this.Invoke("DisableVmReplication", new object[] {
vmId,
replicaServer});
return ((bool)(results[0]));
public void DisableVmReplication(string vmId) {
this.Invoke("DisableVmReplication", new object[] {
vmId});
}
/// <remarks/>
public System.IAsyncResult BeginDisableVmReplication(string vmId, string replicaServer, System.AsyncCallback callback, object asyncState) {
public System.IAsyncResult BeginDisableVmReplication(string vmId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("DisableVmReplication", new object[] {
vmId,
replicaServer}, callback, asyncState);
vmId}, callback, asyncState);
}
/// <remarks/>
public bool EndDisableVmReplication(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((bool)(results[0]));
public void EndDisableVmReplication(System.IAsyncResult asyncResult) {
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void DisableVmReplicationAsync(string vmId, string replicaServer) {
this.DisableVmReplicationAsync(vmId, replicaServer, null);
public void DisableVmReplicationAsync(string vmId) {
this.DisableVmReplicationAsync(vmId, null);
}
/// <remarks/>
public void DisableVmReplicationAsync(string vmId, string replicaServer, object userState) {
public void DisableVmReplicationAsync(string vmId, object userState) {
if ((this.DisableVmReplicationOperationCompleted == null)) {
this.DisableVmReplicationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDisableVmReplicationOperationCompleted);
}
this.InvokeAsync("DisableVmReplication", new object[] {
vmId,
replicaServer}, this.DisableVmReplicationOperationCompleted, userState);
vmId}, this.DisableVmReplicationOperationCompleted, userState);
}
private void OnDisableVmReplicationOperationCompleted(object arg) {
if ((this.DisableVmReplicationCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.DisableVmReplicationCompleted(this, new DisableVmReplicationCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
this.DisableVmReplicationCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
@ -4179,29 +4174,7 @@ namespace WebsitePanel.Providers.Virtualization2012 {
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void DisableVmReplicationCompletedEventHandler(object sender, DisableVmReplicationCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class DisableVmReplicationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal DisableVmReplicationCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public bool Result {
get {
this.RaiseExceptionIfNecessary();
return ((bool)(this.results[0]));
}
}
}
public delegate void DisableVmReplicationCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]

View file

@ -27,6 +27,7 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Web.Services;
using System.Web.Services.Protocols;
@ -254,5 +255,23 @@ namespace WebsitePanel.Server
{
Organization.ChangeDriveMapFolderPath(organizationId, oldFolder, newFolder);
}
[WebMethod, SoapHeader("settings")]
public List<OrganizationUser> GetOrganizationUsersWithExpiredPassword(string organizationId, int daysBeforeExpiration)
{
return Organization.GetOrganizationUsersWithExpiredPassword(organizationId, daysBeforeExpiration);
}
[WebMethod, SoapHeader("settings")]
public void ApplyPasswordSettings(string organizationId, OrganizationPasswordSettings passwordSettings)
{
Organization.ApplyPasswordSettings(organizationId, passwordSettings);
}
[WebMethod, SoapHeader("settings")]
public bool CheckPhoneNumberIsInUse(string phoneNumber, string userSamAccountName = null)
{
return Organization.CheckPhoneNumberIsInUse(phoneNumber, userSamAccountName);
}
}
}

View file

@ -1023,14 +1023,13 @@ namespace WebsitePanel.Server
}
[WebMethod, SoapHeader("settings")]
public bool DisableVmReplication(string vmId, string replicaServer)
public void DisableVmReplication(string vmId)
{
try
{
Log.WriteStart("'{0}' DisableVmReplication", ProviderSettings.ProviderName);
var result = VirtualizationProvider.DisableVmReplication(vmId, replicaServer);
VirtualizationProvider.DisableVmReplication(vmId);
Log.WriteEnd("'{0}' DisableVmReplication", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{

View file

@ -65,6 +65,16 @@ namespace WebsitePanel.WebDav.Core.Config.Entities
}
}
public string PasswordResetSmsKey
{
get
{
SessionKeysElement sessionKey =
_sessionKeys.FirstOrDefault(x => x.Key == SessionKeysElement.PassswordResetSmsKey);
return sessionKey != null ? sessionKey.Value : null;
}
}
public string ResourseRenderCount
{
get

View file

@ -0,0 +1,16 @@
namespace WebsitePanel.WebDav.Core.Config.Entities
{
public class TwilioParameters: AbstractConfigCollection
{
public string AccountSid { get; private set; }
public string AuthorizationToken { get; private set; }
public string PhoneFrom { get; private set; }
public TwilioParameters()
{
AccountSid = ConfigSection.Twilio.AccountSid;
AuthorizationToken = ConfigSection.Twilio.AuthorizationToken;
PhoneFrom = ConfigSection.Twilio.PhoneFrom;
}
}
}

View file

@ -8,6 +8,7 @@ namespace WebsitePanel.WebDav.Core.Config
string ApplicationName { get; }
ElementsRendering ElementsRendering { get; }
WebsitePanelConstantUserParameters WebsitePanelConstantUserParameters { get; }
TwilioParameters TwilioParameters { get; }
SessionKeysCollection SessionKeys { get; }
FileIconsDictionary FileIcons { get; }
HttpErrorsCollection HttpErrors { get; }

View file

@ -12,6 +12,7 @@ namespace WebsitePanel.WebDav.Core.Config.WebConfigSections
public const string WebDavManagerKey = "WebDavManagerSessionKey";
public const string UserGroupsKey = "UserGroupsKey";
public const string WebDavRootFolderPermissionsKey = "WebDavRootFolderPermissionsKey";
public const string PassswordResetSmsKey = "PassswordResetSmsKey";
public const string ResourseRenderCountKey = "ResourseRenderCountSessionKey";
public const string ItemIdSessionKey = "ItemId";
public const string OwaEditFoldersSessionKey = "OwaEditFoldersSession";

View file

@ -0,0 +1,32 @@
using System.Configuration;
namespace WebsitePanel.WebDav.Core.Config.WebConfigSections
{
public class TwilioElement : ConfigurationElement
{
private const string AccountSidPropName = "accountSid";
private const string AuthorizationTokenPropName = "authorizationToken";
private const string PhoneFromPropName = "phoneFrom";
[ConfigurationProperty(AccountSidPropName, IsKey = true, IsRequired = true)]
public string AccountSid
{
get { return this[AccountSidPropName].ToString(); }
set { this[AccountSidPropName] = value; }
}
[ConfigurationProperty(AuthorizationTokenPropName, IsKey = true, IsRequired = true)]
public string AuthorizationToken
{
get { return this[AuthorizationTokenPropName].ToString(); }
set { this[AuthorizationTokenPropName] = value; }
}
[ConfigurationProperty(PhoneFromPropName, IsKey = true, IsRequired = true)]
public string PhoneFrom
{
get { return this[PhoneFromPropName].ToString(); }
set { this[PhoneFromPropName] = value; }
}
}
}

View file

@ -20,6 +20,7 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections
private const string OfficeOnlineKey = "officeOnline";
private const string FilesToIgnoreKey = "filesToIgnore";
private const string TypeOpenerKey = "typeOpener";
private const string TwilioKey = "twilio";
public const string SectionName = "webDavExplorerConfigurationSettings";
@ -65,6 +66,13 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections
set { this[WebsitePanelConstantUserKey] = value; }
}
[ConfigurationProperty(TwilioKey, IsRequired = true)]
public TwilioElement Twilio
{
get { return (TwilioElement)this[TwilioKey]; }
set { this[TwilioKey] = value; }
}
[ConfigurationProperty(ElementsRenderingKey, IsRequired = true)]
public ElementsRenderingElement ElementsRendering
{

View file

@ -21,6 +21,7 @@ namespace WebsitePanel.WebDav.Core.Config
OwaSupportedBrowsers = new OwaSupportedBrowsersCollection();
FilesToIgnore = new FilesToIgnoreCollection();
FileOpener = new OpenerCollection();
TwilioParameters = new TwilioParameters();
}
public static WebDavAppConfigManager Instance
@ -55,6 +56,7 @@ namespace WebsitePanel.WebDav.Core.Config
public ElementsRendering ElementsRendering { get; private set; }
public WebsitePanelConstantUserParameters WebsitePanelConstantUserParameters { get; private set; }
public TwilioParameters TwilioParameters { get; private set; }
public SessionKeysCollection SessionKeys { get; private set; }
public FileIconsDictionary FileIcons { get; private set; }
public HttpErrorsCollection HttpErrors { get; private set; }

View file

@ -14,5 +14,6 @@ namespace WebsitePanel.WebDav.Core.Interfaces.Security
WspPrincipal LogIn(string login, string password);
void CreateAuthenticationTicket(WspPrincipal principal);
void LogOut();
bool ValidateAuthenticationData(string login, string password);
}
}

View file

@ -0,0 +1,11 @@
using System;
namespace WebsitePanel.WebDav.Core.Interfaces.Security
{
public interface ISmsAuthenticationService
{
bool VerifyResponse(Guid token, string response);
string SendRequestMessage(string phoneTo);
string GenerateResponse();
}
}

View file

@ -0,0 +1,9 @@
namespace WebsitePanel.WebDav.Core.Interfaces.Services
{
public interface ISmsDistributionService
{
bool SendMessage(string phoneFrom, string phone, string message);
bool SendMessage(string phone, string message);
}
}

View file

@ -47,7 +47,7 @@ namespace WebsitePanel.WebDav.Core.Managers
if (string.IsNullOrWhiteSpace(pathPart))
{
children = GetWebDavRootItems().Select(x => new WebDavResource
children = ConnectToWebDavServer().Select(x => new WebDavResource
{
Href = new Uri(x.Url),
ItemType = ItemType.Folder,
@ -82,9 +82,10 @@ namespace WebsitePanel.WebDav.Core.Managers
SystemFile[] items;
if (string.IsNullOrWhiteSpace(pathPart))
{
var rootItems = GetWebDavRootItems().Select(x => x.Name).ToList();
var rootItems = ConnectToWebDavServer().Select(x => x.Name).ToList();
rootItems.Insert(0, string.Empty);
items = WspContext.Services.EnterpriseStorage.SearchFiles(itemId, rootItems.ToArray(), searchValue, uesrPrincipalName, recursive);
@ -284,11 +285,25 @@ namespace WebsitePanel.WebDav.Core.Managers
}
}
private IList<SystemFile> GetWebDavRootItems()
private IList<SystemFile> ConnectToWebDavServer()
{
var rootFolders = new List<SystemFile>();
var user = WspContext.User;
var rootFolders = WspContext.Services.EnterpriseStorage.GetUserRootFolders(user.ItemId, user.AccountId,user.UserName, user.DisplayName);
var userGroups = WSP.Services.Organizations.GetSecurityGroupsByMember(user.ItemId, user.AccountId);
foreach (var folder in WSP.Services.EnterpriseStorage.GetEnterpriseFolders(WspContext.User.ItemId))
{
foreach (var rule in folder.Rules)
{
if ((rule.Users.Any(x=> string.Compare(x, user.AccountName, StringComparison.InvariantCultureIgnoreCase) == 0))
|| (userGroups.Any(x => rule.Roles.Any(r => string.Compare(r, x.AccountName, StringComparison.InvariantCultureIgnoreCase) == 0))))
{
rootFolders.Add(folder);
break;
}
}
}
return rootFolders;
}

View file

@ -26,14 +26,7 @@ namespace WebsitePanel.WebDav.Core.Security.Authentication
public WspPrincipal LogIn(string login, string password)
{
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
{
return null;
}
var user = UserPrincipal.FindByIdentity(_principalContext, IdentityType.UserPrincipalName, login);
if (user == null || _principalContext.ValidateCredentials(login, password) == false)
if (ValidateAuthenticationData(login, password) == false)
{
return null;
}
@ -47,6 +40,7 @@ namespace WebsitePanel.WebDav.Core.Security.Authentication
principal.ItemId = exchangeAccount.ItemId;
principal.OrganizationId = organization.OrganizationId;
principal.DisplayName = exchangeAccount.DisplayName;
principal.AccountName = exchangeAccount.AccountName;
principal.EncryptedPassword = _cryptography.Encrypt(password);
if (HttpContext.Current != null)
@ -83,5 +77,22 @@ namespace WebsitePanel.WebDav.Core.Security.Authentication
{
FormsAuthentication.SignOut();
}
public bool ValidateAuthenticationData(string login, string password)
{
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
{
return false;
}
var user = UserPrincipal.FindByIdentity(_principalContext, IdentityType.UserPrincipalName, login);
if (user == null || _principalContext.ValidateCredentials(login, password) == false)
{
return false;
}
return true;
}
}
}

View file

@ -14,6 +14,7 @@ namespace WebsitePanel.WebDav.Core.Security.Authentication.Principals
public string Login { get; set; }
public string DisplayName { get; set; }
public string AccountName { get; set; }
public string UserName
{

View file

@ -0,0 +1,46 @@
using System;
using System.Globalization;
using WebsitePanel.WebDav.Core.Config;
using WebsitePanel.WebDav.Core.Interfaces.Security;
using WebsitePanel.WebDav.Core.Interfaces.Services;
namespace WebsitePanel.WebDav.Core.Security.Authentication
{
public class SmsAuthenticationService : ISmsAuthenticationService
{
private ISmsDistributionService _smsService;
public SmsAuthenticationService(ISmsDistributionService smsService)
{
_smsService = smsService;
}
public bool VerifyResponse( Guid token, string response)
{
var accessToken = WspContext.Services.Organizations.GetPasswordresetAccessToken(token);
if (accessToken == null)
{
return false;
}
return string.Compare(accessToken.SmsResponse, response, StringComparison.InvariantCultureIgnoreCase) == 0;
}
public string SendRequestMessage(string phoneTo)
{
var response = GenerateResponse();
var result = _smsService.SendMessage(WebDavAppConfigManager.Instance.TwilioParameters.PhoneFrom, phoneTo, response);
return result ? response : string.Empty;
}
public string GenerateResponse()
{
var random = new Random(Guid.NewGuid().GetHashCode());
return random.Next(10000, 99999).ToString(CultureInfo.InvariantCulture);
}
}
}

View file

@ -0,0 +1,31 @@
using Twilio;
using WebsitePanel.WebDav.Core.Config;
using WebsitePanel.WebDav.Core.Interfaces.Services;
namespace WebsitePanel.WebDav.Core.Services
{
public class TwillioSmsDistributionService : ISmsDistributionService
{
private readonly TwilioRestClient _twilioRestClient;
public TwillioSmsDistributionService()
{
_twilioRestClient = new TwilioRestClient(WebDavAppConfigManager.Instance.TwilioParameters.AccountSid, WebDavAppConfigManager.Instance.TwilioParameters.AuthorizationToken);
}
public bool SendMessage(string phoneFrom, string phone, string message)
{
var result = _twilioRestClient.SendSmsMessage(phoneFrom, phone, message);
return string.IsNullOrEmpty(result.Status) == false;
}
public bool SendMessage(string phone, string message)
{
var result = _twilioRestClient.SendSmsMessage(WebDavAppConfigManager.Instance.TwilioParameters.PhoneFrom, phone, message);
return string.IsNullOrEmpty(result.Status) == false;
}
}
}

View file

@ -46,6 +46,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Bin\Microsoft.Web.Services3.dll</HintPath>
</Reference>
<Reference Include="RestSharp">
<HintPath>..\packages\RestSharp.105.0.1\lib\net4\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
@ -87,6 +90,10 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Twilio.Api">
<HintPath>..\packages\Twilio.3.6.29\lib\3.5\Twilio.Api.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="WebsitePanel.EnterpriseServer.Base">
<HintPath>..\..\Bin\WebsitePanel.EnterpriseServer.Base.dll</HintPath>
</Reference>
@ -108,6 +115,7 @@
<Compile Include="Config\Entities\OwaSupportedBrowsersCollection.cs" />
<Compile Include="Config\Entities\SessionKeysCollection.cs" />
<Compile Include="Config\Entities\OpenerCollection.cs" />
<Compile Include="Config\Entities\TwilioParameters.cs" />
<Compile Include="Config\Entities\WebsitePanelConstantUserParameters.cs" />
<Compile Include="Config\IWebDavAppConfig.cs" />
<Compile Include="Config\WebConfigSections\ApplicationNameElement.cs" />
@ -126,6 +134,7 @@
<Compile Include="Config\WebConfigSections\SessionKeysElement.cs" />
<Compile Include="Config\WebConfigSections\SessionKeysElementCollection.cs" />
<Compile Include="Config\WebConfigSections\OpenerElement.cs" />
<Compile Include="Config\WebConfigSections\TwilioElement.cs" />
<Compile Include="Config\WebConfigSections\UserDomainElement.cs" />
<Compile Include="Config\WebConfigSections\WebDavExplorerConfigurationSettingsSection.cs" />
<Compile Include="Config\WebConfigSections\WebdavRootElement.cs" />
@ -149,6 +158,9 @@
<Compile Include="IHierarchyItem.cs" />
<Compile Include="IItemContent.cs" />
<Compile Include="Interfaces\Managers\Users\IUserSettingsManager.cs" />
<Compile Include="Interfaces\Security\ISmsAuthenticationService.cs" />
<Compile Include="Security\Authentication\SmsAuthenticationService.cs" />
<Compile Include="Interfaces\Services\ISmsDistributionService.cs" />
<Compile Include="Interfaces\Storages\IKeyValueStorage.cs" />
<Compile Include="Interfaces\Storages\ITtlStorage.cs" />
<Compile Include="Managers\Users\UserSettingsManager.cs" />
@ -188,6 +200,7 @@
<Compile Include="Security\Authentication\FormsAuthenticationService.cs" />
<Compile Include="Security\Authentication\Principals\WspPrincipal.cs" />
<Compile Include="Owa\WopiServer.cs" />
<Compile Include="Services\TwillioSmsDistributionService.cs" />
<Compile Include="Storages\CacheTtlStorage.cs" />
<Compile Include="WebDavSession.cs" />
<Compile Include="WspContext.cs" />

View file

@ -5,4 +5,6 @@
<package id="Microsoft.AspNet.Razor" version="3.2.2" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages" version="3.2.2" targetFramework="net45" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
<package id="RestSharp" version="105.0.1" targetFramework="net45" />
<package id="Twilio" version="3.6.29" targetFramework="net45" />
</packages>

View file

@ -17,7 +17,8 @@ namespace WebsitePanel.WebDavPortal
bundles.Add(jQueryBundle);
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
"~/Scripts/jquery.validate*",
"~/Scripts/appScripts/validation/passwordeditor.unobtrusive.js"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.

View file

@ -12,6 +12,48 @@ namespace WebsitePanel.WebDavPortal
#region Account
routes.MapRoute(
name: AccountRouteNames.PhoneNumberIsAvailible,
url: "account/profile/phone-number-availible",
defaults: new { controller = "Account", action = "PhoneNumberIsAvailible" }
);
routes.MapRoute(
name: AccountRouteNames.UserProfile,
url: "account/profile",
defaults: new { controller = "Account", action = "UserProfile" }
);
routes.MapRoute(
name: AccountRouteNames.PasswordResetEmail,
url: "account/password-reset/step-1",
defaults: new { controller = "Account", action = "PasswordResetEmail" }
);
routes.MapRoute(
name: AccountRouteNames.PasswordResetSms,
url: "account/password-reset/step-2/{token}",
defaults: new { controller = "Account", action = "PasswordResetSms" }
);
routes.MapRoute(
name: AccountRouteNames.PasswordResetSendSms,
url: "account/password-reset/step-final/{token}",
defaults: new { controller = "Account", action = "PasswordResetSendSms" }
);
routes.MapRoute(
name: AccountRouteNames.PasswordResetFinalStep,
url: "account/password-reset/send-new-sms/{token}",
defaults: new { controller = "Account", action = "PasswordResetFinalStep" }
);
routes.MapRoute(
name: AccountRouteNames.PasswordChange,
url: "account/profile/password-change",
defaults: new { controller = "Account", action = "PasswordChange" }
);
routes.MapRoute(
name: AccountRouteNames.Logout,
url: "account/logout",

View file

@ -9,5 +9,14 @@ namespace WebsitePanel.WebDavPortal.UI.Routes
{
public const string Logout = "AccountLogout";
public const string Login = "AccountLogin";
public const string UserProfile = "UserProfileRoute";
public const string PasswordChange = "PasswordChangeRoute";
public const string PasswordResetEmail = "PasswordResetEmailRoute";
public const string PasswordResetSms = "PasswordResetSmsRoute";
public const string PasswordResetSendSms = "PasswordResetSendSmsRoute";
public const string PasswordResetFinalStep = "PasswordResetFinalStepRoute";
public const string PhoneNumberIsAvailible = "PhoneNumberIsAvailibleRoute";
}
}

View file

@ -1,6 +1,6 @@
namespace WebsitePanel.WebDavPortal.Constants
{
public class Formtas
public class Formats
{
public const string DateFormatWithTime = "MM/dd/yyyy hh:mm tt";
}

View file

@ -230,6 +230,26 @@ tr.selected-file {
color: white;
}
.forgot-your-password-link {
margin-left: 10px;
}
.navbar-fixed-top #user-profile {
font-size: 18px;
text-decoration: none;
}
.navbar-fixed-top #user-profile:hover {
text-decoration: none;
}
.user-profile .password-information {
padding-top: 7px;
}
.user-profile .login-name {
padding-top: 7px;
}
.web-dav-folder-progress {
margin-bottom: 0px;

View file

@ -1,12 +1,19 @@
using System.Linq;
using System;
using System.Linq;
using System.Net;
using System.Web.Mvc;
using System.Web.Routing;
using AutoMapper;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.WebDav.Core.Config;
using WebsitePanel.WebDav.Core.Security.Authentication;
using WebsitePanel.WebDav.Core.Security.Cryptography;
using WebsitePanel.WebDav.Core.Wsp.Framework;
using WebsitePanel.WebDavPortal.CustomAttributes;
using WebsitePanel.WebDavPortal.Models;
using WebsitePanel.WebDavPortal.Models.Account;
using WebsitePanel.WebDavPortal.Models.Common;
using WebsitePanel.WebDavPortal.Models.Common.EditorTemplates;
using WebsitePanel.WebDavPortal.Models.Common.Enums;
using WebsitePanel.WebDavPortal.UI.Routes;
using WebsitePanel.WebDav.Core.Interfaces.Security;
@ -14,19 +21,22 @@ using WebsitePanel.WebDav.Core;
namespace WebsitePanel.WebDavPortal.Controllers
{
[AllowAnonymous]
public class AccountController : Controller
[LdapAuthorization]
public class AccountController : BaseController
{
private readonly ICryptography _cryptography;
private readonly IAuthenticationService _authenticationService;
private readonly ISmsAuthenticationService _smsAuthService;
public AccountController(ICryptography cryptography, IAuthenticationService authenticationService)
public AccountController(ICryptography cryptography, IAuthenticationService authenticationService, ISmsAuthenticationService smsAuthService)
{
_cryptography = cryptography;
_authenticationService = authenticationService;
_smsAuthService = smsAuthService;
}
[HttpGet]
[AllowAnonymous]
public ActionResult Login()
{
if (WspContext.User != null && WspContext.User.Identity.IsAuthenticated)
@ -34,10 +44,21 @@ namespace WebsitePanel.WebDavPortal.Controllers
return RedirectToRoute(FileSystemRouteNames.ShowContentPath, new { org = WspContext.User.OrganizationId });
}
return View();
var model = new AccountModel();
var settings = WspContext.Services.Organizations.GetWebDavSystemSettings();
if (settings != null)
{
model.PasswordResetEnabled = settings.GetValueOrDefault(EnterpriseServer.SystemSettings.WEBDAV_PASSWORD_RESET_ENABLED_KEY, false);
}
return View(model);
}
[HttpPost]
[AllowAnonymous]
public ActionResult Login(AccountModel model)
{
var user = _authenticationService.LogIn(model.Login, model.Password);
@ -63,5 +84,308 @@ namespace WebsitePanel.WebDavPortal.Controllers
return RedirectToRoute(AccountRouteNames.Login);
}
[HttpGet]
public ActionResult UserProfile()
{
var model = GetUserProfileModel(WspContext.User.ItemId, WspContext.User.AccountId);
return View(model);
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult UserProfile(UserProfile model)
{
if (!ModelState.IsValid)
{
return View(model);
}
int result = UpdateUserProfile(WspContext.User.ItemId, WspContext.User.AccountId, model);
AddMessage(MessageType.Success, Resources.UI.UserProfileSuccessfullyUpdated);
return View(model);
}
public JsonResult PhoneNumberIsAvailible()
{
var value = Request.QueryString.AllKeys.Any() ? Request.QueryString.Get(0) :string.Empty;
var result = !WspContext.Services.Organizations.CheckPhoneNumberIsInUse(WspContext.User.ItemId,
value, WspContext.User.Login);
return Json(result, JsonRequestBehavior.AllowGet);
}
[HttpGet]
public ActionResult PasswordChange()
{
var model = new PasswordChangeModel();
return View(model);
}
[HttpPost]
public ActionResult PasswordChange(PasswordChangeModel model)
{
if (!ModelState.IsValid)
{
return View(model);
}
if (_authenticationService.ValidateAuthenticationData(WspContext.User.Login, model.OldPassword) == false)
{
AddMessage(MessageType.Error, Resources.Messages.OldPasswordIsNotCorrect);
return View(model);
}
WspContext.Services.Organizations.SetUserPassword(
WspContext.User.ItemId, WspContext.User.AccountId,
model.PasswordEditor.NewPassword);
var user = _authenticationService.LogIn(WspContext.User.Login, model.PasswordEditor.NewPassword);
_authenticationService.CreateAuthenticationTicket(user);
AddMessage(MessageType.Success, Resources.Messages.PasswordSuccessfullyChanged);
return RedirectToRoute(AccountRouteNames.UserProfile);
}
[HttpGet]
[AllowAnonymous]
public ActionResult PasswordResetEmail()
{
var model = new PasswordResetEmailModel();
return View(model);
}
[HttpPost]
[AllowAnonymous]
public ActionResult PasswordResetEmail(PasswordResetEmailModel model)
{
if (!ModelState.IsValid)
{
return View(model);
}
var exchangeAccount = WspContext.Services.ExchangeServer.GetAccountByAccountNameWithoutItemId(model.Email);
if (exchangeAccount == null)
{
AddMessage(MessageType.Error, Resources.Messages.AccountNotFound);
return View(model);
}
WspContext.Services.Organizations.SendResetUserPasswordEmail(exchangeAccount.ItemId, exchangeAccount.AccountId, Resources.Messages.PasswordResetUserReason, exchangeAccount.PrimaryEmailAddress);
return View("PasswordResetEmailSent");
}
[HttpGet]
[AllowAnonymous]
public ActionResult PasswordResetSms(Guid token)
{
var model = new PasswordResetSmsModel();
var accessToken = WspContext.Services.Organizations.GetPasswordresetAccessToken(token);
model.IsTokenExist = accessToken != null;
if (model.IsTokenExist == false)
{
AddMessage(MessageType.Error, Resources.Messages.IncorrectPasswordResetUrl);
return View(model);
}
if (accessToken.IsSmsSent == false)
{
var user = WspContext.Services.Organizations.GetUserGeneralSettings(accessToken.ItemId, accessToken.AccountId);
if (SendPasswordResetSms(accessToken.AccessTokenGuid, user.MobilePhone))
{
AddMessage(MessageType.Success, Resources.Messages.SmsWasSent);
}
else
{
AddMessage(MessageType.Error, Resources.Messages.SmsWasNotSent);
}
}
return View(model);
}
[HttpPost]
[AllowAnonymous]
public ActionResult PasswordResetSms(Guid token, PasswordResetSmsModel model)
{
if (!ModelState.IsValid)
{
return View(model);
}
if (_smsAuthService.VerifyResponse(token, model.Sms))
{
var tokenEntity = WspContext.Services.Organizations.GetPasswordresetAccessToken(token);
Session[WebDavAppConfigManager.Instance.SessionKeys.PasswordResetSmsKey] = model.Sms;
Session[WebDavAppConfigManager.Instance.SessionKeys.ItemId] = tokenEntity.ItemId;
return RedirectToRoute(AccountRouteNames.PasswordResetFinalStep);
}
AddMessage(MessageType.Error, Resources.Messages.IncorrectSmsResponse);
return View(model);
}
[HttpGet]
[AllowAnonymous]
public ActionResult PasswordResetFinalStep(Guid token)
{
var smsResponse = Session[WebDavAppConfigManager.Instance.SessionKeys.PasswordResetSmsKey] as string;
if (_smsAuthService.VerifyResponse(token, smsResponse) == false)
{
return RedirectToRoute(AccountRouteNames.PasswordResetSms);
}
var model = new PasswordEditor();
return View(model);
}
[HttpPost]
[AllowAnonymous]
public ActionResult PasswordResetFinalStep(Guid token, PasswordEditor model)
{
if (!ModelState.IsValid)
{
return View(model);
}
var smsResponse = Session[WebDavAppConfigManager.Instance.SessionKeys.PasswordResetSmsKey] as string;
if (_smsAuthService.VerifyResponse(token, smsResponse) == false)
{
AddMessage(MessageType.Error, Resources.Messages.IncorrectSmsResponse);
return RedirectToRoute(AccountRouteNames.PasswordResetSms);
}
var tokenEntity = WspContext.Services.Organizations.GetPasswordresetAccessToken(token);
WspContext.Services.Organizations.SetUserPassword(
tokenEntity.ItemId, tokenEntity.AccountId,
model.NewPassword);
WspContext.Services.Organizations.DeletePasswordresetAccessToken(token);
AddMessage(MessageType.Success, Resources.Messages.PasswordSuccessfullyChanged);
return RedirectToRoute(AccountRouteNames.Login);
}
[HttpGet]
[AllowAnonymous]
public ActionResult PasswordResetSendSms(Guid token)
{
var accessToken = WspContext.Services.Organizations.GetPasswordresetAccessToken(token);
if (accessToken == null)
{
return RedirectToRoute(AccountRouteNames.PasswordResetSms);
}
var user = WspContext.Services.Organizations.GetUserGeneralSettings(accessToken.ItemId,
accessToken.AccountId);
if (SendPasswordResetSms(accessToken.AccessTokenGuid, user.MobilePhone))
{
AddMessage(MessageType.Success, Resources.Messages.SmsWasSent);
}
else
{
AddMessage(MessageType.Error, Resources.Messages.SmsWasNotSent);
}
return RedirectToRoute(AccountRouteNames.PasswordResetSms);
}
#region Helpers
private bool SendPasswordResetSms(Guid token, string mobilePhone)
{
var response = _smsAuthService.SendRequestMessage(mobilePhone);
if (string.IsNullOrEmpty(response))
{
return false;
}
WspContext.Services.Organizations.SetAccessTokenResponse(token, response);
return true;
}
private UserProfile GetUserProfileModel(int itemId, int accountId)
{
var user = WspContext.Services.Organizations.GetUserGeneralSettings(itemId, accountId);
return Mapper.Map<OrganizationUser, UserProfile>(user);
}
private int UpdateUserProfile(int itemId, int accountId, UserProfile model)
{
var user = WspContext.Services.Organizations.GetUserGeneralSettings(itemId, accountId);
return WspContext.Services.Organizations.SetUserGeneralSettings(
itemId, accountId,
model.DisplayName,
string.Empty,
false,
user.Disabled,
user.Locked,
model.FirstName,
model.Initials,
model.LastName,
model.Address,
model.City,
model.State,
model.Zip,
model.Country,
user.JobTitle,
user.Company,
user.Department,
user.Office,
user.Manager == null ? null : user.Manager.AccountName,
model.BusinessPhone,
model.Fax,
model.HomePhone,
model.MobilePhone,
model.Pager,
model.WebPage,
model.Notes,
model.ExternalEmail,
user.SubscriberNumber,
user.LevelId,
user.IsVIP,
user.UserMustChangePassword);
}
#endregion
}
}

View file

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebsitePanel.WebDavPortal.Models.Common;
using WebsitePanel.WebDavPortal.Models.Common.Enums;
namespace WebsitePanel.WebDavPortal.Controllers
{
public class BaseController : Controller
{
public const string MessagesKey = "messagesKey";
public void AddMessage(MessageType type, string value)
{
var messages = TempData[MessagesKey] as List<Message>;
if (messages == null)
{
messages = new List<Message>();
}
messages.Add(new Message
{
Type = type,
Value = value
});
TempData[MessagesKey] = messages;
}
}
}

View file

@ -42,7 +42,7 @@ namespace WebsitePanel.WebDavPortal.Controllers
{
[ValidateInput(false)]
[LdapAuthorization]
public class FileSystemController : Controller
public class FileSystemController : BaseController
{
private readonly ICryptography _cryptography;
private readonly IWebDavManager _webdavManager;
@ -276,7 +276,7 @@ namespace WebsitePanel.WebDavPortal.Controllers
if (filePathes == null)
{
model.AddMessage(MessageType.Error, Resources.UI.NoFilesAreSelected);
AddMessage(MessageType.Error, Resources.UI.NoFilesAreSelected);
return Json(model);
}

View file

@ -0,0 +1,136 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.WebDav.Core;
using WebsitePanel.WebDav.Core.Config;
namespace WebsitePanel.WebDavPortal.CustomAttributes
{
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
public class OrganizationPasswordPolicyAttribute : ValidationAttribute, IClientValidatable
{
public int ItemId { get; private set; }
public OrganizationPasswordPolicyAttribute()
{
if (WspContext.User != null)
{
ItemId = WspContext.User.ItemId;
}
else if (HttpContext.Current != null && HttpContext.Current.Session[WebDavAppConfigManager.Instance.SessionKeys.ItemId] != null)
{
ItemId = (int)HttpContext.Current.Session[WebDavAppConfigManager.Instance.SessionKeys.ItemId];
}
}
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
{
if (value != null)
{
var resultMessages = new List<string>();
var settings = WspContext.Services.Organizations.GetOrganizationPasswordSettings(ItemId);
if (settings != null)
{
var valueString = value.ToString();
if (valueString.Length < settings.MinimumLength)
{
resultMessages.Add(string.Format(Resources.Messages.PasswordMinLengthFormat,
settings.MinimumLength));
}
if (valueString.Length > settings.MaximumLength)
{
resultMessages.Add(string.Format(Resources.Messages.PasswordMaxLengthFormat,
settings.MaximumLength));
}
if (settings.PasswordComplexityEnabled)
{
var symbolsCount = valueString.Count(Char.IsSymbol);
var numbersCount = valueString.Count(Char.IsDigit);
var upperLetterCount = valueString.Count(Char.IsUpper);
if (upperLetterCount < settings.UppercaseLettersCount)
{
resultMessages.Add(string.Format(Resources.Messages.PasswordUppercaseCountFormat,
settings.UppercaseLettersCount));
}
if (numbersCount < settings.NumbersCount)
{
resultMessages.Add(string.Format(Resources.Messages.PasswordNumbersCountFormat,
settings.NumbersCount));
}
if (symbolsCount < settings.SymbolsCount)
{
resultMessages.Add(string.Format(Resources.Messages.PasswordSymbolsCountFormat,
settings.SymbolsCount));
}
}
}
return resultMessages.Any()? new ValidationResult(string.Join("<br>", resultMessages)) : ValidationResult.Success;
}
return ValidationResult.Success;
}
public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context)
{
var settings = WspContext.Services.Organizations.GetOrganizationPasswordSettings(ItemId);
var rule = new ModelClientValidationRule();
rule.ErrorMessage = string.Format(Resources.Messages.PasswordMinLengthFormat, settings.MinimumLength);
rule.ValidationParameters.Add("count", settings.MinimumLength);
rule.ValidationType = "minimumlength";
yield return rule;
rule = new ModelClientValidationRule();
rule.ErrorMessage = string.Format(Resources.Messages.PasswordMaxLengthFormat, settings.MaximumLength);
rule.ValidationParameters.Add("count", settings.MaximumLength);
rule.ValidationType = "maximumlength";
yield return rule;
if (settings.PasswordComplexityEnabled)
{
rule = new ModelClientValidationRule();
rule.ErrorMessage = string.Format(Resources.Messages.PasswordUppercaseCountFormat, settings.UppercaseLettersCount);
rule.ValidationParameters.Add("count", settings.UppercaseLettersCount);
rule.ValidationType = "uppercasecount";
yield return rule;
rule = new ModelClientValidationRule();
rule.ErrorMessage = string.Format(Resources.Messages.PasswordNumbersCountFormat, settings.NumbersCount);
rule.ValidationParameters.Add("count", settings.NumbersCount);
rule.ValidationType = "numberscount";
yield return rule;
rule = new ModelClientValidationRule();
rule.ErrorMessage = string.Format(Resources.Messages.PasswordSymbolsCountFormat, settings.SymbolsCount);
rule.ValidationParameters.Add("count", settings.SymbolsCount);
rule.ValidationType = "symbolscount";
yield return rule;
}
}
}
}

View file

@ -0,0 +1,21 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
namespace WebsitePanel.WebDavPortal.CustomAttributes
{
public class PhoneNumberAttribute : RegularExpressionAttribute, IClientValidatable
{
public const string PhonePattern = @"^\+?\d+$";
public PhoneNumberAttribute()
: base(PhonePattern)
{
}
public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context)
{
yield return new ModelClientValidationRegexRule(FormatErrorMessage(metadata.GetDisplayName()), Pattern);
}
}
}

View file

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Web.Mvc;
using System.Web.Routing;
using WebsitePanel.WebDav.Core;
namespace WebsitePanel.WebDavPortal.CustomAttributes
{
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
public class UniqueAdPhoneNumberAttribute : RemoteAttribute
{
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
{
var valueString = value as string;
if (!string.IsNullOrEmpty(valueString) && WspContext.User != null)
{
var attributes =
validationContext.ObjectType.GetProperty(validationContext.MemberName)
.GetCustomAttributes(typeof(DisplayNameAttribute), true);
string displayName = attributes != null && attributes.Any()
? (attributes[0] as DisplayNameAttribute).DisplayName
: validationContext.DisplayName;
var result = !WspContext.Services.Organizations.CheckPhoneNumberIsInUse(WspContext.User.ItemId, valueString, WspContext.User.Login);
return result ? ValidationResult.Success :
new ValidationResult(string.Format(Resources.Messages.AlreadyInUse, displayName));
}
return ValidationResult.Success;
}
public UniqueAdPhoneNumberAttribute(string routeName) : base(routeName) { }
public UniqueAdPhoneNumberAttribute(string action, string controller) : base(action, controller) { }
public UniqueAdPhoneNumberAttribute(string action, string controller,
string area) : base(action, controller, area) { }
}
}

View file

@ -4,6 +4,7 @@ using WebsitePanel.WebDav.Core.Interfaces.Managers;
using WebsitePanel.WebDav.Core.Interfaces.Managers.Users;
using WebsitePanel.WebDav.Core.Interfaces.Owa;
using WebsitePanel.WebDav.Core.Interfaces.Security;
using WebsitePanel.WebDav.Core.Interfaces.Services;
using WebsitePanel.WebDav.Core.Interfaces.Storages;
using WebsitePanel.WebDav.Core.Managers;
using WebsitePanel.WebDav.Core.Managers.Users;
@ -11,6 +12,7 @@ using WebsitePanel.WebDav.Core.Owa;
using WebsitePanel.WebDav.Core.Security.Authentication;
using WebsitePanel.WebDav.Core.Security.Authorization;
using WebsitePanel.WebDav.Core.Security.Cryptography;
using WebsitePanel.WebDav.Core.Services;
using WebsitePanel.WebDav.Core.Storages;
using WebsitePanel.WebDavPortal.DependencyInjection.Providers;
@ -31,6 +33,8 @@ namespace WebsitePanel.WebDavPortal.DependencyInjection
kernel.Bind<ICobaltManager>().To<CobaltManager>();
kernel.Bind<ITtlStorage>().To<CacheTtlStorage>();
kernel.Bind<IUserSettingsManager>().To<UserSettingsManager>();
kernel.Bind<ISmsDistributionService>().To<TwillioSmsDistributionService>();
kernel.Bind<ISmsAuthenticationService>().To<SmsAuthenticationService>();
}
}
}

View file

@ -15,6 +15,7 @@ using WebsitePanel.WebDav.Core.Security.Authentication.Principals;
using WebsitePanel.WebDav.Core.Security.Cryptography;
using WebsitePanel.WebDavPortal.App_Start;
using WebsitePanel.WebDavPortal.Controllers;
using WebsitePanel.WebDavPortal.CustomAttributes;
using WebsitePanel.WebDavPortal.DependencyInjection;
using WebsitePanel.WebDavPortal.HttpHandlers;
using WebsitePanel.WebDavPortal.Mapping;
@ -39,6 +40,10 @@ namespace WebsitePanel.WebDavPortal
Mapper.AssertConfigurationIsValid();
log4net.Config.XmlConfigurator.Configure();
DataAnnotationsModelValidatorProvider.RegisterAdapter(
typeof(PhoneNumberAttribute),
typeof(RegularExpressionAttributeAdapter));
}
protected void Application_Error(object sender, EventArgs e)

View file

@ -1,4 +1,5 @@
using AutoMapper;
using WebsitePanel.WebDavPortal.Mapping.Profiles.Account;
using WebsitePanel.WebDavPortal.Mapping.Profiles.Webdav;
namespace WebsitePanel.WebDavPortal.Mapping
@ -10,6 +11,7 @@ namespace WebsitePanel.WebDavPortal.Mapping
Mapper.Initialize(
config =>
{
config.AddProfile<UserProfileProfile>();
config.AddProfile<ResourceTableItemProfile>();
});
}

View file

@ -0,0 +1,66 @@
using System;
using System.IO;
using AutoMapper;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.WebDav.Core.Client;
using WebsitePanel.WebDav.Core.Config;
using WebsitePanel.WebDav.Core.Extensions;
using WebsitePanel.WebDavPortal.Constants;
using WebsitePanel.WebDavPortal.FileOperations;
using WebsitePanel.WebDavPortal.Models.Account;
using WebsitePanel.WebDavPortal.Models.FileSystem;
namespace WebsitePanel.WebDavPortal.Mapping.Profiles.Account
{
public class UserProfileProfile : Profile
{
/// <summary>
/// Gets the name of the profile.
/// </summary>
/// <value>
/// The name of the profile.
/// </value>
public override string ProfileName
{
get
{
return this.GetType().Name;
}
}
/// <summary>
/// Override this method in a derived class and call the CreateMap method to associate that map with this profile.
/// Avoid calling the <see cref="T:AutoMapper.Mapper" /> class from this method.
/// </summary>
protected override void Configure()
{
Mapper.CreateMap<OrganizationUser, UserProfile>()
.ForMember(ti => ti.PrimaryEmailAddress, x => x.MapFrom(hi => hi.PrimaryEmailAddress))
.ForMember(ti => ti.DisplayName, x => x.MapFrom(hi => hi.DisplayName))
.ForMember(ti => ti.DisplayName, x => x.MapFrom(hi => hi.DisplayName))
.ForMember(ti => ti.AccountName, x => x.MapFrom(hi => hi.AccountName))
.ForMember(ti => ti.FirstName, x => x.MapFrom(hi => hi.FirstName))
.ForMember(ti => ti.Initials, x => x.MapFrom(hi => hi.Initials))
.ForMember(ti => ti.LastName, x => x.MapFrom(hi => hi.LastName))
.ForMember(ti => ti.JobTitle, x => x.MapFrom(hi => hi.JobTitle))
.ForMember(ti => ti.Company, x => x.MapFrom(hi => hi.Company))
.ForMember(ti => ti.Department, x => x.MapFrom(hi => hi.Department))
.ForMember(ti => ti.Office, x => x.MapFrom(hi => hi.Office))
.ForMember(ti => ti.BusinessPhone, x => x.MapFrom(hi => hi.BusinessPhone))
.ForMember(ti => ti.Fax, x => x.MapFrom(hi => hi.Fax))
.ForMember(ti => ti.HomePhone, x => x.MapFrom(hi => hi.HomePhone))
.ForMember(ti => ti.MobilePhone, x => x.MapFrom(hi => hi.MobilePhone))
.ForMember(ti => ti.Pager, x => x.MapFrom(hi => hi.Pager))
.ForMember(ti => ti.WebPage, x => x.MapFrom(hi => hi.WebPage))
.ForMember(ti => ti.Address, x => x.MapFrom(hi => hi.Address))
.ForMember(ti => ti.City, x => x.MapFrom(hi => hi.City))
.ForMember(ti => ti.State, x => x.MapFrom(hi => hi.State))
.ForMember(ti => ti.Zip, x => x.MapFrom(hi => hi.Zip))
.ForMember(ti => ti.Country, x => x.MapFrom(hi => hi.Country))
.ForMember(ti => ti.Notes, x => x.MapFrom(hi => hi.Notes))
.ForMember(ti => ti.PasswordExpirationDateTime, x => x.MapFrom(hi => hi.PasswordExpirationDateTime))
.ForMember(ti => ti.ExternalEmail, x => x.MapFrom(hi => hi.ExternalEmail));
}
}
}

View file

@ -44,12 +44,16 @@ namespace WebsitePanel.WebDavPortal.Mapping.Profiles.Webdav
.ForMember(ti => ti.IconHref, x => x.MapFrom(hi => hi.ItemType == ItemType.Folder ? WebDavAppConfigManager.Instance.FileIcons.FolderPath.Trim('~') : WebDavAppConfigManager.Instance.FileIcons[Path.GetExtension(hi.DisplayName.Trim('/'))].Trim('~')))
.ForMember(ti => ti.IsTargetBlank, x => x.MapFrom(hi => openerManager.GetIsTargetBlank(hi)))
.ForMember(ti => ti.LastModified, x => x.MapFrom(hi => hi.LastModified))
.ForMember(ti => ti.LastModifiedFormated, x => x.MapFrom(hi => hi.LastModified == DateTime.MinValue ? "--" : (new WebDavResource(null, hi)).LastModified.ToString(Formtas.DateFormatWithTime)))
.ForMember(ti => ti.LastModifiedFormated, x => x.MapFrom(hi => hi.LastModified == DateTime.MinValue ? "--" : (new WebDavResource(null, hi)).LastModified.ToString(Formats.DateFormatWithTime)))
.ForMember(ti => ti.Summary, x => x.MapFrom(hi => hi.Summary))
.ForMember(ti => ti.IsRoot, x => x.MapFrom(hi => hi.IsRootItem))
.ForMember(ti => ti.Size, x => x.MapFrom(hi => hi.ContentLength))
.ForMember(ti => ti.Quota, x => x.MapFrom(hi => hi.AllocatedSpace))
.ForMember(ti => ti.Url, x => x.Ignore())
.ForMember(ti => ti.FolderUrlAbsoluteString, x => x.Ignore())
.ForMember(ti => ti.FolderUrlLocalString, x => x.Ignore())
.ForMember(ti => ti.FolderName, x => x.Ignore())
.ForMember(ti => ti.IsFolder, x => x.MapFrom(hi => hi.ItemType == ItemType.Folder));
}
}

View file

@ -0,0 +1,23 @@
using System.ComponentModel.DataAnnotations;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.WebDavPortal.Models.Common;
using WebsitePanel.WebDavPortal.Models.Common.EditorTemplates;
namespace WebsitePanel.WebDavPortal.Models.Account
{
public class PasswordChangeModel
{
[Display(ResourceType = typeof (Resources.UI), Name = "OldPassword")]
[Required(ErrorMessageResourceType = typeof (Resources.Messages), ErrorMessageResourceName = "Required")]
public string OldPassword { get; set; }
[UIHint("PasswordEditor")]
public PasswordEditor PasswordEditor { get; set; }
public PasswordChangeModel()
{
PasswordEditor = new PasswordEditor();
}
}
}

View file

@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations;
using WebsitePanel.WebDavPortal.Models.Common;
using WebsitePanel.WebDavPortal.Resources;
namespace WebsitePanel.WebDavPortal.Models.Account
{
public class PasswordResetEmailModel
{
[Required]
[Display(ResourceType = typeof(Resources.UI), Name = "Email")]
[EmailAddress(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "EmailInvalid",ErrorMessage = null)]
public string Email { get; set; }
}
}

View file

@ -0,0 +1,12 @@
using System.ComponentModel.DataAnnotations;
using WebsitePanel.WebDavPortal.Models.Common;
namespace WebsitePanel.WebDavPortal.Models.Account
{
public class PasswordResetSmsModel
{
[Required]
public string Sms { get; set; }
public bool IsTokenExist { get; set; }
}
}

View file

@ -0,0 +1,78 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Security.AccessControl;
using WebsitePanel.WebDavPortal.CustomAttributes;
using WebsitePanel.WebDavPortal.Models.Common;
using WebsitePanel.WebDavPortal.UI.Routes;
namespace WebsitePanel.WebDavPortal.Models.Account
{
public class UserProfile
{
[Display(ResourceType = typeof(Resources.UI), Name = "PrimaryEmail")]
[Required(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "Required")]
[EmailAddress(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "EmailInvalid", ErrorMessage = null)]
public string PrimaryEmailAddress { get; set; }
[Display(ResourceType = typeof(Resources.UI), Name = "DisplayName")]
[Required(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "Required")]
public string DisplayName { get; set; }
public string AccountName { get; set; }
[Display(ResourceType = typeof(Resources.UI), Name = "FirstName")]
[Required(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "Required")]
public string FirstName { get; set; }
public string Initials { get; set; }
[Display(ResourceType = typeof(Resources.UI), Name = "LastName")]
[Required(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "Required")]
public string LastName { get; set; }
public string JobTitle { get; set; }
public string Company { get; set; }
public string Department { get; set; }
public string Office { get; set; }
[PhoneNumber(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "PhoneNumberInvalid")]
[UniqueAdPhoneNumber(AccountRouteNames.PhoneNumberIsAvailible, ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "AlreadyInUse")]
[Display(ResourceType = typeof(Resources.UI), Name = "BusinessPhone")]
public string BusinessPhone { get; set; }
[PhoneNumber(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "PhoneNumberInvalid")]
[UniqueAdPhoneNumber(AccountRouteNames.PhoneNumberIsAvailible, ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "AlreadyInUse")]
[Display(ResourceType = typeof(Resources.UI), Name = "Fax")]
public string Fax { get; set; }
[Display(ResourceType = typeof(Resources.UI), Name = "HomePhone")]
[PhoneNumber(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "PhoneNumberInvalid")]
[UniqueAdPhoneNumber(AccountRouteNames.PhoneNumberIsAvailible, ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "AlreadyInUse")]
public string HomePhone { get; set; }
[Display(ResourceType = typeof(Resources.UI), Name = "MobilePhone")]
[Required(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "Required")]
[PhoneNumber(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "PhoneNumberInvalid")]
[UniqueAdPhoneNumber(AccountRouteNames.PhoneNumberIsAvailible, ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "AlreadyInUse")]
public string MobilePhone { get; set; }
[PhoneNumber(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "PhoneNumberInvalid")]
[Display(ResourceType = typeof(Resources.UI), Name = "Pager")]
[UniqueAdPhoneNumber(AccountRouteNames.PhoneNumberIsAvailible,ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "AlreadyInUse")]
public string Pager { get; set; }
[Url(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "UrlInvalid", ErrorMessage = null)]
public string WebPage { get; set; }
public string Address { get; set; }
public string City { get; set; }
public string State { get; set; }
public string Zip { get; set; }
[EmailAddress(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "EmailInvalid", ErrorMessage = null)]
public string ExternalEmail { get; set; }
[UIHint("CountrySelector")]
public string Country { get; set; }
public string Notes { get; set; }
public DateTime PasswordExpirationDateTime { get; set; }
}
}

View file

@ -5,7 +5,7 @@ using WebsitePanel.WebDavPortal.Models.Common;
namespace WebsitePanel.WebDavPortal.Models
{
public class AccountModel : BaseModel
public class AccountModel
{
[Required]
[Display(Name = @"Login")]
@ -17,5 +17,7 @@ namespace WebsitePanel.WebDavPortal.Models
public string Password { get; set; }
public string LdapError { get; set; }
public bool PasswordResetEnabled { get; set; }
}
}

View file

@ -1,12 +1,11 @@
using System.Collections.Generic;
using System.Web.Mvc;
using WebsitePanel.WebDavPortal.Models.Common.Enums;
namespace WebsitePanel.WebDavPortal.Models.Common
{
public class BaseModel
public class AjaxModel
{
public BaseModel()
public AjaxModel()
{
Messages = new List<Message>();
}
@ -17,7 +16,7 @@ namespace WebsitePanel.WebDavPortal.Models.Common
{
Messages.Add(new Message
{
Type =type,
Type = type,
Value = value
});
}

View file

@ -0,0 +1,22 @@
using System.ComponentModel.DataAnnotations;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.WebDavPortal.CustomAttributes;
namespace WebsitePanel.WebDavPortal.Models.Common.EditorTemplates
{
public class PasswordEditor
{
[Display(ResourceType = typeof(Resources.UI), Name = "NewPassword")]
[Required(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "Required")]
[OrganizationPasswordPolicy]
public string NewPassword { get; set; }
[Display(ResourceType = typeof(Resources.UI), Name = "NewPasswordConfirmation")]
[Required(ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "Required")]
[Compare("NewPassword", ErrorMessageResourceType = typeof(Resources.Messages), ErrorMessageResourceName = "PasswordDoesntMatch")]
public string NewPasswordConfirmation { get; set; }
public OrganizationPasswordSettings Settings { get; set; }
}
}

View file

@ -3,7 +3,7 @@ using WebsitePanel.WebDavPortal.Models.Common;
namespace WebsitePanel.WebDavPortal.Models
{
public class ErrorModel : BaseModel
public class ErrorModel
{
public int HttpStatusCode { get; set; }
public string Message { get; set; }

View file

@ -3,7 +3,7 @@ using WebsitePanel.WebDavPortal.Models.Common;
namespace WebsitePanel.WebDavPortal.Models.FileSystem
{
public class DeleteFilesModel : BaseModel
public class DeleteFilesModel : AjaxModel
{
public DeleteFilesModel()
{

View file

@ -6,7 +6,7 @@ using WebsitePanel.WebDavPortal.Models.Common;
namespace WebsitePanel.WebDavPortal.Models
{
public class ModelForWebDav : BaseModel
public class ModelForWebDav
{
public IEnumerable<IHierarchyItem> Items { get; set; }
public string UrlSuffix { get; set; }

View file

@ -2,7 +2,7 @@
namespace WebsitePanel.WebDavPortal.Models
{
public class OfficeOnlineModel : BaseModel
public class OfficeOnlineModel
{
public string Url { get; set; }
public string FileName { get; set; }

View file

@ -0,0 +1,252 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.33440
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.WebDavPortal.Resources {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Messages {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Messages() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WebsitePanel.WebDavPortal.Resources.Messages", typeof(Messages).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to Account was not found.
/// </summary>
public static string AccountNotFound {
get {
return ResourceManager.GetString("AccountNotFound", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} is already in use.
/// </summary>
public static string AlreadyInUse {
get {
return ResourceManager.GetString("AlreadyInUse", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Email is invalid.
/// </summary>
public static string EmailInvalid {
get {
return ResourceManager.GetString("EmailInvalid", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Your password could not be reset. The url you followed is either incorrect, has been used or has expired..
/// </summary>
public static string IncorrectPasswordResetUrl {
get {
return ResourceManager.GetString("IncorrectPasswordResetUrl", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Incorrect text message (SMS) response..
/// </summary>
public static string IncorrectSmsResponse {
get {
return ResourceManager.GetString("IncorrectSmsResponse", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Old password is not correct.
/// </summary>
public static string OldPasswordIsNotCorrect {
get {
return ResourceManager.GetString("OldPasswordIsNotCorrect", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The password and confirmation password do not match..
/// </summary>
public static string PasswordDoesntMatch {
get {
return ResourceManager.GetString("PasswordDoesntMatch", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Password should be maximum {0} characters.
/// </summary>
public static string PasswordMaxLengthFormat {
get {
return ResourceManager.GetString("PasswordMaxLengthFormat", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Password should be at least {0} characters.
/// </summary>
public static string PasswordMinLengthFormat {
get {
return ResourceManager.GetString("PasswordMinLengthFormat", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Password should contain at least {0} numbers.
/// </summary>
public static string PasswordNumbersCountFormat {
get {
return ResourceManager.GetString("PasswordNumbersCountFormat", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to A message was sent to your email address. Please check your email for further instructions..
/// </summary>
public static string PasswordResetEmailSent {
get {
return ResourceManager.GetString("PasswordResetEmailSent", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Please enter the verification code we sent to your phone. If you didn&apos;t receive a code, you can {0}..
/// </summary>
public static string PasswordResetSmsHintFormat {
get {
return ResourceManager.GetString("PasswordResetSmsHintFormat", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Webdav portal user request..
/// </summary>
public static string PasswordResetUserReason {
get {
return ResourceManager.GetString("PasswordResetUserReason", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Your password have been successfully changed.
/// </summary>
public static string PasswordSuccessfullyChanged {
get {
return ResourceManager.GetString("PasswordSuccessfullyChanged", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Password should contain at least {0} non-alphanumeric symbols.
/// </summary>
public static string PasswordSymbolsCountFormat {
get {
return ResourceManager.GetString("PasswordSymbolsCountFormat", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Password should contain at least {0} UPPERCASE characters.
/// </summary>
public static string PasswordUppercaseCountFormat {
get {
return ResourceManager.GetString("PasswordUppercaseCountFormat", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Phone number is invalid.
/// </summary>
public static string PhoneNumberInvalid {
get {
return ResourceManager.GetString("PhoneNumberInvalid", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} field is required.
/// </summary>
public static string Required {
get {
return ResourceManager.GetString("Required", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Text message (SMS) was not sent to your mobile phone. Invalid phone number..
/// </summary>
public static string SmsWasNotSent {
get {
return ResourceManager.GetString("SmsWasNotSent", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Text message (SMS) was sent to your mobile phone..
/// </summary>
public static string SmsWasSent {
get {
return ResourceManager.GetString("SmsWasSent", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Url is invalid.
/// </summary>
public static string UrlInvalid {
get {
return ResourceManager.GetString("UrlInvalid", resourceCulture);
}
}
}
}

View file

@ -0,0 +1,183 @@
<?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="AccountNotFound" xml:space="preserve">
<value>Account was not found</value>
</data>
<data name="AlreadyInUse" xml:space="preserve">
<value>{0} is already in use</value>
</data>
<data name="EmailInvalid" xml:space="preserve">
<value>Email is invalid</value>
</data>
<data name="IncorrectPasswordResetUrl" xml:space="preserve">
<value>Your password could not be reset. The url you followed is either incorrect, has been used or has expired.</value>
</data>
<data name="IncorrectSmsResponse" xml:space="preserve">
<value>Incorrect text message (SMS) response.</value>
</data>
<data name="OldPasswordIsNotCorrect" xml:space="preserve">
<value>Old password is not correct</value>
</data>
<data name="PasswordDoesntMatch" xml:space="preserve">
<value>The password and confirmation password do not match.</value>
</data>
<data name="PasswordMaxLengthFormat" xml:space="preserve">
<value>Password should be maximum {0} characters</value>
</data>
<data name="PasswordMinLengthFormat" xml:space="preserve">
<value>Password should be at least {0} characters</value>
</data>
<data name="PasswordNumbersCountFormat" xml:space="preserve">
<value>Password should contain at least {0} numbers</value>
</data>
<data name="PasswordResetEmailSent" xml:space="preserve">
<value>A message was sent to your email address. Please check your email for further instructions.</value>
</data>
<data name="PasswordResetSmsHintFormat" xml:space="preserve">
<value>Please enter the verification code we sent to your phone. If you didn't receive a code, you can {0}.</value>
</data>
<data name="PasswordResetUserReason" xml:space="preserve">
<value>Webdav portal user request.</value>
</data>
<data name="PasswordSuccessfullyChanged" xml:space="preserve">
<value>Your password have been successfully changed</value>
</data>
<data name="PasswordSymbolsCountFormat" xml:space="preserve">
<value>Password should contain at least {0} non-alphanumeric symbols</value>
</data>
<data name="PasswordUppercaseCountFormat" xml:space="preserve">
<value>Password should contain at least {0} UPPERCASE characters</value>
</data>
<data name="PhoneNumberInvalid" xml:space="preserve">
<value>Phone number is invalid</value>
</data>
<data name="Required" xml:space="preserve">
<value>{0} field is required</value>
</data>
<data name="SmsWasNotSent" xml:space="preserve">
<value>Text message (SMS) was not sent to your mobile phone. Invalid phone number.</value>
</data>
<data name="SmsWasSent" xml:space="preserve">
<value>Text message (SMS) was sent to your mobile phone.</value>
</data>
<data name="UrlInvalid" xml:space="preserve">
<value>Url is invalid</value>
</data>
</root>

View file

@ -69,6 +69,42 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Address.
/// </summary>
public static string Address {
get {
return ResourceManager.GetString("Address", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Address Inforamtion.
/// </summary>
public static string AddressInforamtion {
get {
return ResourceManager.GetString("AddressInforamtion", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Back.
/// </summary>
public static string Back {
get {
return ResourceManager.GetString("Back", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Business Phone.
/// </summary>
public static string BusinessPhone {
get {
return ResourceManager.GetString("BusinessPhone", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Byte.
/// </summary>
@ -105,6 +141,24 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Change password.
/// </summary>
public static string ChangePassword {
get {
return ResourceManager.GetString("ChangePassword", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to City.
/// </summary>
public static string City {
get {
return ResourceManager.GetString("City", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Close.
/// </summary>
@ -114,6 +168,15 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Company Information.
/// </summary>
public static string CompanyInformation {
get {
return ResourceManager.GetString("CompanyInformation", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Confirm.
/// </summary>
@ -123,6 +186,24 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Contact Information.
/// </summary>
public static string ContactInformation {
get {
return ResourceManager.GetString("ContactInformation", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Country/Region.
/// </summary>
public static string Country {
get {
return ResourceManager.GetString("Country", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Create.
/// </summary>
@ -168,6 +249,24 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Display Name.
/// </summary>
public static string DisplayName {
get {
return ResourceManager.GetString("DisplayName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Email.
/// </summary>
public static string Email {
get {
return ResourceManager.GetString("Email", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Please enter file name.
/// </summary>
@ -204,6 +303,24 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to External Email.
/// </summary>
public static string ExternalEmail {
get {
return ResourceManager.GetString("ExternalEmail", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Fax.
/// </summary>
public static string Fax {
get {
return ResourceManager.GetString("Fax", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to File.
/// </summary>
@ -231,6 +348,33 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to First Name.
/// </summary>
public static string FirstName {
get {
return ResourceManager.GetString("FirstName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Forgot your password?.
/// </summary>
public static string ForgotYourPassword {
get {
return ResourceManager.GetString("ForgotYourPassword", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to General Information.
/// </summary>
public static string GeneralInformation {
get {
return ResourceManager.GetString("GeneralInformation", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Gb.
/// </summary>
@ -240,6 +384,24 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Here.
/// </summary>
public static string Here {
get {
return ResourceManager.GetString("Here", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Home Phone.
/// </summary>
public static string HomePhone {
get {
return ResourceManager.GetString("HomePhone", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Info.
/// </summary>
@ -249,6 +411,15 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Initials.
/// </summary>
public static string Initials {
get {
return ResourceManager.GetString("Initials", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to File already exist.
/// </summary>
@ -267,6 +438,15 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Job Title.
/// </summary>
public static string JobTitle {
get {
return ResourceManager.GetString("JobTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to KB.
/// </summary>
@ -276,6 +456,42 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Last Name.
/// </summary>
public static string LastName {
get {
return ResourceManager.GetString("LastName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Login.
/// </summary>
public static string Login {
get {
return ResourceManager.GetString("Login", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Login name.
/// </summary>
public static string LoginName {
get {
return ResourceManager.GetString("LoginName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Log out.
/// </summary>
public static string LogOut {
get {
return ResourceManager.GetString("LogOut", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to MB.
/// </summary>
@ -285,6 +501,15 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Mobile Phone.
/// </summary>
public static string MobilePhone {
get {
return ResourceManager.GetString("MobilePhone", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Modified.
/// </summary>
@ -303,6 +528,33 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to New password.
/// </summary>
public static string NewPassword {
get {
return ResourceManager.GetString("NewPassword", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Confirm password.
/// </summary>
public static string NewPasswordConfirmation {
get {
return ResourceManager.GetString("NewPasswordConfirmation", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Next.
/// </summary>
public static string Next {
get {
return ResourceManager.GetString("Next", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to No files are selected..
/// </summary>
@ -321,6 +573,24 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Notes.
/// </summary>
public static string Notes {
get {
return ResourceManager.GetString("Notes", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Old password.
/// </summary>
public static string OldPassword {
get {
return ResourceManager.GetString("OldPassword", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to or drag and drop files here..
/// </summary>
@ -330,6 +600,51 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Pager.
/// </summary>
public static string Pager {
get {
return ResourceManager.GetString("Pager", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Password.
/// </summary>
public static string Password {
get {
return ResourceManager.GetString("Password", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Will expire on {0}. If you want to change password then please click {1}..
/// </summary>
public static string PasswordExpirationFormat {
get {
return ResourceManager.GetString("PasswordExpirationFormat", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Password reset.
/// </summary>
public static string PasswordReset {
get {
return ResourceManager.GetString("PasswordReset", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Enter your login and password reset email will be sent to your email address. You may need to check your spam folder..
/// </summary>
public static string PasswordResetEmailInfo {
get {
return ResourceManager.GetString("PasswordResetEmailInfo", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to PB.
/// </summary>
@ -357,6 +672,15 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Primary Email.
/// </summary>
public static string PrimaryEmail {
get {
return ResourceManager.GetString("PrimaryEmail", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Processing.
/// </summary>
@ -375,6 +699,24 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Profile.
/// </summary>
public static string Profile {
get {
return ResourceManager.GetString("Profile", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Save Changes.
/// </summary>
public static string SaveChanges {
get {
return ResourceManager.GetString("SaveChanges", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Search.
/// </summary>
@ -402,6 +744,15 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Select.
/// </summary>
public static string Select {
get {
return ResourceManager.GetString("Select", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Select files to upload.
/// </summary>
@ -411,6 +762,15 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Send email.
/// </summary>
public static string SendEmail {
get {
return ResourceManager.GetString("SendEmail", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Size.
/// </summary>
@ -420,6 +780,24 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Sms.
/// </summary>
public static string Sms {
get {
return ResourceManager.GetString("Sms", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to State/Province.
/// </summary>
public static string State {
get {
return ResourceManager.GetString("State", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Table.
/// </summary>
@ -438,6 +816,15 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Try again.
/// </summary>
public static string TryAgain {
get {
return ResourceManager.GetString("TryAgain", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Type.
/// </summary>
@ -456,6 +843,24 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to User profile successfully updated.
/// </summary>
public static string UserProfileSuccessfullyUpdated {
get {
return ResourceManager.GetString("UserProfileSuccessfullyUpdated", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Web Page.
/// </summary>
public static string WebPage {
get {
return ResourceManager.GetString("WebPage", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Word document.
/// </summary>
@ -473,5 +878,14 @@ namespace WebsitePanel.WebDavPortal.Resources {
return ResourceManager.GetString("Yes", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Zip/Postal Code.
/// </summary>
public static string Zip {
get {
return ResourceManager.GetString("Zip", resourceCulture);
}
}
}
}

View file

@ -120,6 +120,18 @@
<data name="Actions" xml:space="preserve">
<value>Actions</value>
</data>
<data name="Address" xml:space="preserve">
<value>Address</value>
</data>
<data name="AddressInforamtion" xml:space="preserve">
<value>Address Inforamtion</value>
</data>
<data name="Back" xml:space="preserve">
<value>Back</value>
</data>
<data name="BusinessPhone" xml:space="preserve">
<value>Business Phone</value>
</data>
<data name="Byte" xml:space="preserve">
<value>Byte</value>
</data>
@ -132,12 +144,27 @@
<data name="CancelAll" xml:space="preserve">
<value>Cancel All</value>
</data>
<data name="ChangePassword" xml:space="preserve">
<value>Change password</value>
</data>
<data name="City" xml:space="preserve">
<value>City</value>
</data>
<data name="Close" xml:space="preserve">
<value>Close</value>
</data>
<data name="CompanyInformation" xml:space="preserve">
<value>Company Information</value>
</data>
<data name="Confirm" xml:space="preserve">
<value>Confirm</value>
</data>
<data name="ContactInformation" xml:space="preserve">
<value>Contact Information</value>
</data>
<data name="Country" xml:space="preserve">
<value>Country/Region</value>
</data>
<data name="Create" xml:space="preserve">
<value>Create</value>
</data>
@ -153,6 +180,12 @@
<data name="DialogsContentConfrimFileDeletion" xml:space="preserve">
<value>Are you sure you want to delete {0} item(s)?</value>
</data>
<data name="DisplayName" xml:space="preserve">
<value>Display Name</value>
</data>
<data name="Email" xml:space="preserve">
<value>Email</value>
</data>
<data name="EnterFileName" xml:space="preserve">
<value>Please enter file name</value>
</data>
@ -165,6 +198,12 @@
<data name="ExcelWorkbook" xml:space="preserve">
<value>Excel workbook</value>
</data>
<data name="ExternalEmail" xml:space="preserve">
<value>External Email</value>
</data>
<data name="Fax" xml:space="preserve">
<value>Fax</value>
</data>
<data name="File" xml:space="preserve">
<value>File</value>
</data>
@ -174,39 +213,99 @@
<data name="FileUpload" xml:space="preserve">
<value>File Upload</value>
</data>
<data name="FirstName" xml:space="preserve">
<value>First Name</value>
</data>
<data name="ForgotYourPassword" xml:space="preserve">
<value>Forgot your password?</value>
</data>
<data name="GeneralInformation" xml:space="preserve">
<value>General Information</value>
</data>
<data name="GigabyteShort" xml:space="preserve">
<value>Gb</value>
</data>
<data name="Here" xml:space="preserve">
<value>Here</value>
</data>
<data name="HomePhone" xml:space="preserve">
<value>Home Phone</value>
</data>
<data name="Info" xml:space="preserve">
<value>Info</value>
</data>
<data name="Initials" xml:space="preserve">
<value>Initials</value>
</data>
<data name="ItemExist" xml:space="preserve">
<value>File already exist</value>
</data>
<data name="ItemsWasRemovedFormat" xml:space="preserve">
<value>{0} items was removed.</value>
</data>
<data name="JobTitle" xml:space="preserve">
<value>Job Title</value>
</data>
<data name="KilobyteShort" xml:space="preserve">
<value>KB</value>
</data>
<data name="LastName" xml:space="preserve">
<value>Last Name</value>
</data>
<data name="LoginName" xml:space="preserve">
<value>Login name</value>
</data>
<data name="LogOut" xml:space="preserve">
<value>Log out</value>
</data>
<data name="MegabyteShort" xml:space="preserve">
<value>MB</value>
</data>
<data name="MobilePhone" xml:space="preserve">
<value>Mobile Phone</value>
</data>
<data name="Modified" xml:space="preserve">
<value>Modified</value>
</data>
<data name="Name" xml:space="preserve">
<value>Name</value>
</data>
<data name="NewPassword" xml:space="preserve">
<value>New password</value>
</data>
<data name="NewPasswordConfirmation" xml:space="preserve">
<value>Confirm password</value>
</data>
<data name="Next" xml:space="preserve">
<value>Next</value>
</data>
<data name="NoFilesAreSelected" xml:space="preserve">
<value>No files are selected.</value>
</data>
<data name="NotAFile" xml:space="preserve">
<value>Not a file.</value>
</data>
<data name="Notes" xml:space="preserve">
<value>Notes</value>
</data>
<data name="OldPassword" xml:space="preserve">
<value>Old password</value>
</data>
<data name="OrDragAndDropFilesHere" xml:space="preserve">
<value>or drag and drop files here.</value>
</data>
<data name="Pager" xml:space="preserve">
<value>Pager</value>
</data>
<data name="Password" xml:space="preserve">
<value>Password</value>
</data>
<data name="PasswordExpirationFormat" xml:space="preserve">
<value>Will expire on {0}. If you want to change password then please click {1}.</value>
</data>
<data name="PasswordReset" xml:space="preserve">
<value>Password reset</value>
</data>
<data name="PetabyteShort" xml:space="preserve">
<value>PB</value>
</data>
@ -216,12 +315,21 @@
<data name="PowerPointPresentation" xml:space="preserve">
<value>Powerpoint presentation</value>
</data>
<data name="PrimaryEmail" xml:space="preserve">
<value>Primary Email</value>
</data>
<data name="Processing" xml:space="preserve">
<value>Processing</value>
</data>
<data name="ProcessingWithDots" xml:space="preserve">
<value>Processing...</value>
</data>
<data name="Profile" xml:space="preserve">
<value>Profile</value>
</data>
<data name="SaveChanges" xml:space="preserve">
<value>Save Changes</value>
</data>
<data name="Search" xml:space="preserve">
<value>Search</value>
</data>
@ -231,12 +339,24 @@
<data name="SearchResults" xml:space="preserve">
<value>Search Results</value>
</data>
<data name="Select" xml:space="preserve">
<value>Select</value>
</data>
<data name="SelectFilesToUpload" xml:space="preserve">
<value>Select files to upload</value>
</data>
<data name="SendEmail" xml:space="preserve">
<value>Send email</value>
</data>
<data name="Size" xml:space="preserve">
<value>Size</value>
</data>
<data name="Sms" xml:space="preserve">
<value>Sms</value>
</data>
<data name="State" xml:space="preserve">
<value>State/Province</value>
</data>
<data name="Table" xml:space="preserve">
<value>Table</value>
</data>
@ -249,10 +369,28 @@
<data name="Upload" xml:space="preserve">
<value>Upload</value>
</data>
<data name="UserProfileSuccessfullyUpdated" xml:space="preserve">
<value>User profile successfully updated</value>
</data>
<data name="WebPage" xml:space="preserve">
<value>Web Page</value>
</data>
<data name="WordDocument" xml:space="preserve">
<value>Word document</value>
</data>
<data name="Yes" xml:space="preserve">
<value>Yes</value>
</data>
<data name="Zip" xml:space="preserve">
<value>Zip/Postal Code</value>
</data>
<data name="PasswordResetEmailInfo" xml:space="preserve">
<value>Enter your login and password reset email will be sent to your email address. You may need to check your spam folder.</value>
</data>
<data name="TryAgain" xml:space="preserve">
<value>Try again</value>
</data>
<data name="Login" xml:space="preserve">
<value>Login</value>
</data>
</root>

View file

@ -1,8 +1,9 @@
/// <reference path="jquery-ui-1.9.0.js" />
/// <autosync enabled="true" />
/// <autosync enabled="true" />
/// <reference path="bootstrap.js" />
/// <reference path="jquery-2.1.1.js" />
/// <reference path="jquery-ui-1.9.0.js" />
/// <reference path="jquery.cookie.js" />
/// <reference path="jquery.ui.widget.js" />
/// <reference path="jquery.validate.js" />
/// <reference path="jquery.validate.unobtrusive.js" />
/// <reference path="modernizr-2.8.3.js" />
@ -10,5 +11,36 @@
/// <reference path="respond.js" />
/// <reference path="respond.matchmedia.addlistener.js" />
/// <reference path="appscripts/authentication.js" />
/// <reference path="appscripts/dialogs.js" />
/// <reference path="appscripts/filebrowsing.js" />
/// <reference path="appscripts/messages.js" />
/// <reference path="appscripts/recalculateresourseheight.js" />
/// <reference path="appscripts/uploadingdata2.js" />
/// <reference path="appscripts/wsp-webdav.js" />
/// <reference path="appscripts/wsp.js" />
/// <reference path="datatables-1.10.4/datatables.autofill.js" />
/// <reference path="datatables-1.10.4/datatables.bootstrap.js" />
/// <reference path="datatables-1.10.4/datatables.colreorder.js" />
/// <reference path="datatables-1.10.4/datatables.colvis.js" />
/// <reference path="datatables-1.10.4/datatables.fixedcolumns.js" />
/// <reference path="datatables-1.10.4/datatables.fixedheader.js" />
/// <reference path="datatables-1.10.4/datatables.foundation.js" />
/// <reference path="datatables-1.10.4/datatables.jqueryui.js" />
/// <reference path="datatables-1.10.4/datatables.keytable.js" />
/// <reference path="datatables-1.10.4/datatables.responsive.js" />
/// <reference path="datatables-1.10.4/datatables.scroller.js" />
/// <reference path="datatables-1.10.4/datatables.tabletools.js" />
/// <reference path="datatables-1.10.4/jquery.datatables.js" />
/// <reference path="jquery.fileupload/jquery.fileupload-angular.js" />
/// <reference path="jquery.fileupload/jquery.fileupload-audio.js" />
/// <reference path="jquery.fileupload/jquery.fileupload-image.js" />
/// <reference path="jquery.fileupload/jquery.fileupload-jquery-ui.js" />
/// <reference path="jquery.fileupload/jquery.fileupload-process.js" />
/// <reference path="jquery.fileupload/jquery.fileupload-ui.js" />
/// <reference path="jquery.fileupload/jquery.fileupload-validate.js" />
/// <reference path="jquery.fileupload/jquery.fileupload-video.js" />
/// <reference path="jquery.fileupload/jquery.fileupload.js" />
/// <reference path="jquery.fileupload/jquery.iframe-transport.js" />
/// <reference path="jquery.fileupload/tmpl.min.js" />
/// <reference path="jquery.fileupload/cors/jquery.postmessage-transport.js" />
/// <reference path="jquery.fileupload/cors/jquery.xdr-transport.js" />

View file

@ -0,0 +1,54 @@
/// <reference path="jquery.validate.js" />
/// <reference path="jquery.validate.unobtrusive.js" />
$.validator.unobtrusive.adapters.addSingleVal("minimumlength", "count");
$.validator.addMethod("minimumlength", function (value, element, count) {
if (value.length < count) {
return false;
}
return true;
});
$.validator.unobtrusive.adapters.addSingleVal("maximumlength", "count");
$.validator.addMethod("maximumlength", function (value, element, count) {
if (value.length > count) {
return false;
}
return true;
});
$.validator.unobtrusive.adapters.addSingleVal("uppercasecount", "count");
$.validator.addMethod("uppercasecount", function (value, element, count) {
if (value.replace(/[^A-Z]/g, "").length < count) {
return false;
}
return true;
});
$.validator.unobtrusive.adapters.addSingleVal("numberscount", "count");
$.validator.addMethod("numberscount", function (value, element, count) {
if (value.replace(/[^0-9]/g, "").length < count) {
return false;
}
return true;
});
$.validator.unobtrusive.adapters.addSingleVal("symbolscount", "count");
$.validator.addMethod("symbolscount", function (value, element, count) {
if (value.replace(/[a-zA-Z0-9_]/g, "").length < count) {
return false;
}
return true;
});

View file

@ -10,25 +10,11 @@ $(document).on('click', '.processing-dialog', function (e) {
});
$(document).ready(function() {
$(document).ready(function () {
//bootstrap jquery validate styles fix
$.validator.setDefaults({
highlight: function(element) {
$(element).closest('.form-group').addClass('has-error');
},
unhighlight: function(element) {
$(element).closest('.form-group').removeClass('has-error');
},
errorElement: 'span',
errorClass: 'help-block',
errorPlacement: function(error, element) {
if (element.parent('.input-group').length) {
error.insertAfter(element.parent());
} else {
error.insertAfter(element);
}
}
});
BindBootstrapValidationStyles();
$.validator.addMethod("synchronousRemote", function(value, element, param) {
if (this.optional(element)) {
@ -86,6 +72,60 @@ $(document).ready(function() {
}, "Please fix this field.");
});
function BindBootstrapValidationStyles() {
$.validator.setDefaults({
highlight: function (element) {
$(element).closest('.form-group').addClass('has-error');
},
unhighlight: function (element) {
$(element).closest('.form-group').removeClass('has-error');
},
errorElement: 'span',
errorClass: 'help-block',
errorPlacement: function (error, element) {
if (element.parent('.input-group').length) {
error.insertAfter(element.parent());
} else {
error.insertAfter(element);
}
}
});
$('.bs-val-styles').each(function () {
var form = $(this);
var formData = $.data(form[0]);
if (formData && formData.validator) {
var settings = formData.validator.settings;
// Store existing event handlers in local variables
var oldErrorPlacement = settings.errorPlacement;
var oldSuccess = settings.success;
settings.errorPlacement = function (label, element) {
oldErrorPlacement(label, element);
element.closest('.form-group').addClass('has-error');
label.addClass('text-danger');
};
settings.success = function (label, element) {
$(element).closest('.form-group').removeClass('has-error');
oldSuccess(label);
}
}
});
$('.input-validation-error').each(function () {
$(this).closest('.form-group').addClass('has-error');
});
$('.field-validation-error').each(function () {
$(this).addClass('text-danger');
});
}
$.fn.clearValidation = function () { var v = $(this).validate(); $('[name]', this).each(function () { v.successList.push(this); v.showErrors(); }); v.resetForm(); v.reset(); $(this).find('.form-group').removeClass('has-error'); };

View file

@ -1,11 +1,15 @@
@model WebsitePanel.WebDavPortal.Models.AccountModel
@using WebsitePanel.WebDavPortal.Resources
@using WebsitePanel.WebDavPortal.UI.Routes
@model WebsitePanel.WebDavPortal.Models.AccountModel
@{
ViewBag.Title = "Login";
//Layout = "~/Views/Shared/_Layout.cshtml";
}
<br/>
<div class="container row">
<form class="form-horizontal" method="POST" role="form">
@Html.HiddenFor(x=>x.PasswordResetEnabled)
<div class="form-group">
<h3 class="col-sm-offset-1">Sign In</h3>
</div>
@ -30,6 +34,10 @@
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Sign in</button>
@if (Model.PasswordResetEnabled)
{
<a href="@Url.RouteUrl(AccountRouteNames.PasswordResetEmail)" class="forgot-your-password-link">@UI.ForgotYourPassword</a>
}
</div>
</div>
</form>

View file

@ -0,0 +1,31 @@
@using WebsitePanel.WebDavPortal.Resources
@using WebsitePanel.WebDavPortal.UI.Routes
@model WebsitePanel.WebDavPortal.Models.Account.PasswordChangeModel
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="container row">
@using (Html.BeginRouteForm(AccountRouteNames.PasswordChange, FormMethod.Post, new { @class = "form-horizontal user-password-change bs-val-styles col-lg-10 col-lg-offset-3", id = "user-password-change" }))
{
<div class="form-group">
<h3>@UI.ChangePassword</h3>
</div>
<div class="form-group">
<label for="@Html.IdFor(x => x.OldPassword)" class="col-sm-2 control-label">@UI.OldPassword</label>
<div class="col-sm-10">
@Html.PasswordFor(x => x.OldPassword, new { @class = "form-control", placeholder = UI.OldPassword })
@Html.ValidationMessageFor(x => x.OldPassword)
</div>
</div>
@Html.EditorFor(x=>x.PasswordEditor)
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">@UI.ChangePassword</button>
</div>
</div>
}
</div>

View file

@ -0,0 +1,23 @@
@using WebsitePanel.WebDavPortal.Resources
@using WebsitePanel.WebDavPortal.UI.Routes
@model WebsitePanel.WebDavPortal.Models.Account.PasswordResetEmailModel
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="container row">
@using (Html.BeginRouteForm(AccountRouteNames.PasswordResetEmail, FormMethod.Post, new { @class = "user-password-reset-email bs-val-styles col-lg-10 col-lg-offset-3", id = "user-password-reset" }))
{
<div class="form-group">
<h3>@UI.PasswordReset</h3>
</div>
<div class="form-group">
<label for="@Html.IdFor(x => x.Email)" class="control-label">@UI.PasswordResetEmailInfo</label>
@Html.TextBoxFor(x => x.Email, new { @class = "form-control", placeholder = UI.Login })
@Html.ValidationMessageFor(x => x.Email)
</div>
<button type="submit" class="btn btn-default">@UI.SendEmail</button>
}
</div>

View file

@ -0,0 +1,18 @@
@using WebsitePanel.WebDavPortal.Resources
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="container row">
<div class="col-lg-10 col-lg-offset-3">
<div class="form-group">
<h3>@UI.PasswordReset</h3>
</div>
<div class="form-group">
<label class="control-label">@Messages.PasswordResetEmailSent</label>
</div>
</div>
</div>

View file

@ -0,0 +1,27 @@
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
@using WebsitePanel.WebDavPortal.Resources
@using WebsitePanel.WebDavPortal.UI.Routes
@model WebsitePanel.WebDavPortal.Models.Common.EditorTemplates.PasswordEditor
<div class="container row">
@using (Html.BeginRouteForm(AccountRouteNames.PasswordResetFinalStep, FormMethod.Post, new { @class = "form-horizontal user-password-reset-final-step bs-val-styles col-lg-9 col-lg-offset-3", id = "user-password-reset" }))
{
<div class="form-group">
<h3>@UI.PasswordReset</h3>
</div>
@Html.EditorFor(x=>x)
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">@UI.ChangePassword</button>
</div>
</div>
}
</div>

View file

@ -0,0 +1,30 @@
@using WebsitePanel.WebDavPortal.Resources
@using WebsitePanel.WebDavPortal.UI.Routes
@model WebsitePanel.WebDavPortal.Models.Account.PasswordResetSmsModel
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
@if (Model.IsTokenExist)
{
<div class="container row">
@using (Html.BeginRouteForm(AccountRouteNames.PasswordResetSms, FormMethod.Post, new {@class = "user-password-reset-sms bs-val-styles col-lg-9 col-lg-offset-3", id = "user-password-reset"}))
{
@Html.HiddenFor(x=>x.IsTokenExist)
<div class="form-group">
<h3>@UI.PasswordReset</h3>
</div>
<div class="form-group">
<label for="@Html.IdFor(x => x.Sms)" class="control-label">@Html.Raw(string.Format(Messages.PasswordResetSmsHintFormat, Html.RouteLink(UI.TryAgain.ToLowerInvariant(), AccountRouteNames.PasswordResetSendSms)))</label>
<div >
@Html.TextBoxFor(x => x.Sms, new {@class = "form-control", placeholder = UI.Sms})
@Html.ValidationMessageFor(x => x.Sms)
</div>
</div>
<button type="submit" class="btn btn-default">@UI.Next</button>
}
</div>
}

View file

@ -0,0 +1,225 @@
@using WebsitePanel.WebDavPortal.Constants
@using WebsitePanel.WebDavPortal.Resources
@using WebsitePanel.WebDavPortal.UI.Routes
@model WebsitePanel.WebDavPortal.Models.Account.UserProfile
@{
Layout = "~/Views/Shared/_Layout.cshtml";
var passwordExpriationText = string.Format(UI.PasswordExpirationFormat, Model.PasswordExpirationDateTime.ToString(Formats.DateFormatWithTime), Html.RouteLink(UI.Here.ToLowerInvariant(), AccountRouteNames.PasswordChange));
}
<div class="container row">
@using (Html.BeginRouteForm(AccountRouteNames.UserProfile, FormMethod.Post, new { @class = "form-horizontal user-profile bs-val-styles", id = "user-profile-form" }))
{
@Html.HiddenFor(x => x.PasswordExpirationDateTime)
@Html.HiddenFor(x => x.PrimaryEmailAddress)
@Html.AntiForgeryToken()
if (ViewData.ModelState.Any(x => x.Value.Errors.Any()))
{
<div class="alert alert-danger">
<a class="close" data-dismiss="alert">&times;</a>
@Html.ValidationSummary(false)
</div>
}
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="heading-general-information">
<h4 class="panel-title">
<a data-toggle="collapse" href="#general-information" aria-expanded="true" aria-controls="general-information">
@UI.GeneralInformation
</a>
</h4>
</div>
<div id="general-information" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="heading-general-information">
<div class="panel-body">
<div class="form-group">
<label for="@Html.IdFor(x=>x.PrimaryEmailAddress)" class="col-sm-2 control-label">@UI.LoginName</label>
<div class="col-sm-10 login-name">
<label>@Html.Raw(Model.PrimaryEmailAddress)</label>
</div>
</div>
<div class="form-group">
<label for="@Html.IdFor(x=>x.DisplayName)" class="col-sm-2 control-label">@UI.DisplayName</label>
<div class="col-sm-10">
@Html.TextBoxFor(x => x.DisplayName, new { @class = "form-control", placeholder = UI.DisplayName })
</div>
</div>
<div class="form-group">
<label for="@Html.IdFor(x=>x.FirstName)" class="col-sm-2 control-label">@UI.FirstName</label>
<div class="col-sm-10">
@Html.TextBoxFor(x => x.FirstName, new { @class = "form-control", placeholder = UI.FirstName })
</div>
</div>
<div class="form-group">
<label for="@Html.IdFor(x => x.Initials)" class="col-sm-2 control-label">@UI.Initials</label>
<div class="col-sm-10">
@Html.TextBoxFor(x => x.Initials, new { @class = "form-control", placeholder = UI.Initials })
</div>
</div>
<div class="form-group">
<label for="@Html.IdFor(x => x.LastName)" class="col-sm-2 control-label">@UI.LastName</label>
<div class="col-sm-10">
@Html.TextBoxFor(x => x.LastName, new { @class = "form-control", placeholder = UI.LastName })
</div>
</div>
<div class="form-group">
<label for="@Html.IdFor(x => x.Notes)" class="col-sm-2 control-label">@UI.Notes</label>
<div class="col-sm-10">
@Html.TextAreaFor(x => x.Notes, new { @class = "form-control", placeholder = UI.Notes })
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">@UI.Password</label>
<div class="col-sm-10 password-information">
<label>@Html.Raw(passwordExpriationText)</label>
</div>
</div>
<div class="form-group">
<label for="@Html.IdFor(x=>x.ExternalEmail)" class="col-sm-2 control-label">@UI.ExternalEmail</label>
<div class="col-sm-10">
@Html.TextBoxFor(x => x.ExternalEmail, new { @class = "form-control", placeholder = UI.ExternalEmail })
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="heading-contact-information">
<h4 class="panel-title">
<a class="collapsed" data-toggle="collapse" href="#contact-information" aria-expanded="false" aria-controls="contact-information">
@UI.ContactInformation
</a>
</h4>
</div>
<div id="contact-information" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading-contact-information">
<div class="panel-body">
<div class="form-group">
<label for="@Html.IdFor(x => x.BusinessPhone)" class="col-sm-2 control-label">@UI.BusinessPhone</label>
<div class="col-sm-10">
@Html.TextBoxFor(x => x.BusinessPhone, new { @class = "form-control", placeholder = UI.BusinessPhone })
@Html.ValidationMessageFor(x => x.BusinessPhone)
</div>
</div>
<div class="form-group">
<label for="@Html.IdFor(x => x.Fax)" class="col-sm-2 control-label">@UI.Fax</label>
<div class="col-sm-10">
@Html.TextBoxFor(x => x.Fax, new { @class = "form-control", placeholder = UI.Fax })
@Html.ValidationMessageFor(x => x.Fax)
</div>
</div>
<div class="form-group">
<label for="@Html.IdFor(x => x.HomePhone)" class="col-sm-2 control-label">@UI.HomePhone</label>
<div class="col-sm-10">
@Html.TextBoxFor(x => x.HomePhone, new { @class = "form-control", placeholder = UI.HomePhone })
@Html.ValidationMessageFor(x => x.HomePhone)
</div>
</div>
<div class="form-group">
<label for="@Html.IdFor(x => x.MobilePhone)" class="col-sm-2 control-label">@UI.MobilePhone</label>
<div class="col-sm-10">
@Html.TextBoxFor(x => x.MobilePhone, new { @class = "form-control", placeholder = UI.MobilePhone })
@Html.ValidationMessageFor(x=>x.MobilePhone)
</div>
</div>
<div class="form-group">
<label for="@Html.IdFor(x => x.Pager)" class="col-sm-2 control-label">@UI.Pager</label>
<div class="col-sm-10">
@Html.TextBoxFor(x => x.Pager, new { @class = "form-control", placeholder = UI.Pager })
@Html.ValidationMessageFor(x => x.Pager)
</div>
</div>
<div class="form-group">
<label for="@Html.IdFor(x => x.WebPage)" class="col-sm-2 control-label">@UI.WebPage</label>
<div class="col-sm-10">
@Html.TextBoxFor(x => x.WebPage, new { @class = "form-control", placeholder = UI.WebPage })
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="heading-address-information">
<h4 class="panel-title">
<a class="collapsed" data-toggle="collapse" href="#address-information" aria-expanded="false" aria-controls="address-information">
@UI.AddressInforamtion
</a>
</h4>
</div>
<div id="address-information" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading-address-information">
<div class="panel-body">
<div class="form-group">
<label for="@Html.IdFor(x => x.Address)" class="col-sm-2 control-label">@UI.Address</label>
<div class="col-sm-10">
@Html.TextBoxFor(x => x.Address, new { @class = "form-control", placeholder = UI.Address })
</div>
</div>
<div class="form-group">
<label for="@Html.IdFor(x => x.City)" class="col-sm-2 control-label">@UI.City</label>
<div class="col-sm-10">
@Html.TextBoxFor(x => x.City, new { @class = "form-control", placeholder = UI.City })
</div>
</div>
<div class="form-group">
<label for="@Html.IdFor(x => x.State)" class="col-sm-2 control-label">@UI.State</label>
<div class="col-sm-10">
@Html.TextBoxFor(x => x.State, new { @class = "form-control", placeholder = UI.State })
</div>
</div>
<div class="form-group">
<label for="@Html.IdFor(x => x.Zip)" class="col-sm-2 control-label">@UI.Zip</label>
<div class="col-sm-10">
@Html.TextBoxFor(x => x.Zip, new { @class = "form-control", placeholder = UI.Zip })
</div>
</div>
<div class="form-group">
<label for="@Html.IdFor(x => x.Country)" class="col-sm-2 control-label">@UI.Country</label>
<div class="col-sm-10">
@Html.EditorFor(x => x.Country)
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-12">
<button type="submit" class="btn btn-default pull-right">@UI.SaveChanges</button>
</div>
</div>
}
</div>
@section scripts{
<script>
$(document).ready(function () {
var validator = $("#user-profile-form").data('validator');
validator.settings.ignore = "";
});
</script>
}

Some files were not shown because too many files have changed in this diff Show more