Initial project's source code check-in.

This commit is contained in:
ptsurbeleu 2011-07-13 16:07:32 -07:00
commit b03b0b373f
4573 changed files with 981205 additions and 0 deletions

View file

@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="AutoDiscovery.asmx.cs" Class="WebsitePanel.Server.AutoDiscovery" %>

View file

@ -0,0 +1,57 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System.ComponentModel;
using System.Web.Services;
using WebsitePanel.Providers.Common;
using WebsitePanel.Server.Code;
namespace WebsitePanel.Server
{
/// <summary>
/// Summary description for AutoDiscovery
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
public class AutoDiscovery : WebService
{
[WebMethod]
public BoolResult IsInstalled(string providerName)
{
return AutoDiscoveryHelper.IsInstalled(providerName);
}
[WebMethod]
public string GetServerVersion()
{
return AutoDiscoveryHelper.GetServerVersion();
}
}
}

View file

@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="BlackBerry.asmx.cs" Class="WebsitePanel.Server.BlackBerry" %>

View file

@ -0,0 +1,90 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System.ComponentModel;
using System.Web.Services;
using System.Web.Services.Protocols;
using WebsitePanel.Providers;
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.ResultObjects;
using Microsoft.Web.Services3;
namespace WebsitePanel.Server
{
/// </summary>
[WebService(Namespace = "http://smbsaas/websitepanel/server/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Policy("ServerPolicy")]
[ToolboxItem(false)]
public class BlackBerry : HostingServiceProviderWebService, IBlackBerry
{
private IBlackBerry BlackBerryProvider
{
get { return (IBlackBerry)Provider; }
}
[WebMethod, SoapHeader("settings")]
public ResultObject CreateBlackBerryUser(string primaryEmailAddress)
{
return BlackBerryProvider.CreateBlackBerryUser(primaryEmailAddress);
}
[WebMethod, SoapHeader("settings")]
public ResultObject DeleteBlackBerryUser(string primaryEmailAddress)
{
return BlackBerryProvider.DeleteBlackBerryUser(primaryEmailAddress);
}
[WebMethod, SoapHeader("settings")]
public BlackBerryUserStatsResult GetBlackBerryUserStats(string primaryEmailAddress)
{
return BlackBerryProvider.GetBlackBerryUserStats(primaryEmailAddress);
}
[WebMethod, SoapHeader("settings")]
public ResultObject SetActivationPasswordWithExpirationTime(string primaryEmailAddress, string password, int time)
{
return BlackBerryProvider.SetActivationPasswordWithExpirationTime(primaryEmailAddress, password, time);
}
[WebMethod, SoapHeader("settings")]
public ResultObject SetEmailActivationPassword(string primaryEmailAddress)
{
return BlackBerryProvider.SetEmailActivationPassword(primaryEmailAddress);
}
[WebMethod, SoapHeader("settings")]
public ResultObject DeleteDataFromBlackBerryDevice(string primaryEmailAddress)
{
return BlackBerryProvider.DeleteDataFromBlackBerryDevice(primaryEmailAddress);
}
}
}

View file

@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="CRM.asmx.cs" Class="WebsitePanel.Server.CRM" %>

View file

@ -0,0 +1,130 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.ComponentModel;
using System.Web.Services;
using System.Web.Services.Protocols;
using WebsitePanel.Providers;
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.ResultObjects;
using Microsoft.Web.Services3;
namespace WebsitePanel.Server
{
/// <summary>
///
/// </summary>
[WebService(Namespace = "http://smbsaas/websitepanel/server/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Policy("ServerPolicy")]
[ToolboxItem(false)]
public class CRM : HostingServiceProviderWebService, ICRM
{
private ICRM CrmProvider
{
get { return (ICRM)Provider; }
}
[WebMethod, SoapHeader("settings")]
public OrganizationResult CreateOrganization(Guid organizationId, string organizationUniqueName, string organizationFriendlyName, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string initialUserDomainName, string initialUserFirstName, string initialUserLastName, string initialUserPrimaryEmail, string organizationCollation)
{
return CrmProvider.CreateOrganization(organizationId, organizationUniqueName, organizationFriendlyName, baseCurrencyCode, baseCurrencyName, baseCurrencySymbol, initialUserDomainName, initialUserFirstName, initialUserLastName, initialUserPrimaryEmail, organizationCollation);
}
[WebMethod, SoapHeader("settings")]
public string[] GetSupportedCollationNames()
{
return CrmProvider.GetSupportedCollationNames();
}
[WebMethod, SoapHeader("settings")]
public Currency[] GetCurrencyList()
{
return CrmProvider.GetCurrencyList();
}
[WebMethod, SoapHeader("settings")]
public ResultObject DeleteOrganization(Guid orgId)
{
return CrmProvider.DeleteOrganization(orgId);
}
[WebMethod, SoapHeader("settings")]
public UserResult CreateCRMUser(OrganizationUser user, string orgName, Guid organizationId, Guid baseUnitId)
{
return CrmProvider.CreateCRMUser(user, orgName, organizationId, baseUnitId);
}
[WebMethod, SoapHeader("settings")]
public CRMBusinessUnitsResult GetOrganizationBusinessUnits(Guid organizationId, string orgName)
{
return CrmProvider.GetOrganizationBusinessUnits(organizationId, orgName);
}
[WebMethod, SoapHeader("settings")]
public CrmRolesResult GetAllCrmRoles(string orgName, Guid businessUnitId)
{
return CrmProvider.GetAllCrmRoles(orgName, businessUnitId);
}
[WebMethod, SoapHeader("settings")]
public CrmRolesResult GetCrmUserRoles(string orgName, Guid userId)
{
return CrmProvider.GetCrmUserRoles(orgName, userId);
}
[WebMethod, SoapHeader("settings")]
public ResultObject SetUserRoles(string orgName, Guid userId, Guid []roles)
{
return CrmProvider.SetUserRoles(orgName, userId, roles);
}
[WebMethod, SoapHeader("settings")]
public CrmUserResult GetCrmUserByDomainName(string domainName, string orgName)
{
return CrmProvider.GetCrmUserByDomainName(domainName, orgName);
}
[WebMethod, SoapHeader("settings")]
public CrmUserResult GetCrmUserById(Guid crmUserId, string orgName)
{
return CrmProvider.GetCrmUserById(crmUserId, orgName);
}
[WebMethod, SoapHeader("settings")]
public ResultObject ChangeUserState(bool disable, string orgName, Guid crmUserId)
{
return CrmProvider.ChangeUserState(disable, orgName, crmUserId);
}
}
}

View file

@ -0,0 +1,97 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Configuration;
using WebsitePanel.Providers;
using WebsitePanel.Providers.Common;
using WebsitePanel.Server.Utils;
using System.Reflection;
namespace WebsitePanel.Server.Code
{
public class AutoDiscoveryHelper
{
public const string DisableAutoDiscovery = "DisableAutoDiscovery";
public static BoolResult IsInstalled(string name)
{
Log.WriteStart("IsInstalled started. Name:{0}", name);
BoolResult res = new BoolResult {IsSuccess = true};
try
{
bool disableAutoDiscovery;
if (!bool.TryParse(ConfigurationManager.AppSettings[DisableAutoDiscovery], out disableAutoDiscovery))
disableAutoDiscovery = false;
if (disableAutoDiscovery)
{
res.Value = true;
}
else
{
if (string.IsNullOrEmpty(name))
{
res.IsSuccess = false;
res.ErrorCodes.Add(ErrorCodes.PROVIDER_NANE_IS_NOT_SPECIFIED);
return res;
}
Type providerType = Type.GetType(name);
IHostingServiceProvider provider = (IHostingServiceProvider)Activator.CreateInstance(providerType);
res.Value = provider.IsInstalled();
}
}
catch (Exception ex)
{
res.IsSuccess = false;
res.ErrorCodes.Add(ErrorCodes.CANNOT_CREATE_PROVIDER_INSTANCE);
Log.WriteError(ex);
}
finally
{
Log.WriteEnd("IsInstalled ended. Name:{0}", name);
}
return res;
}
public static string GetServerVersion()
{
object[] attrs = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), true);
if (attrs.Length > 0)
return ((AssemblyInformationalVersionAttribute)attrs[0]).InformationalVersion;
else
return typeof(AutoDiscoveryHelper).Assembly.GetName().Version.ToString(3);
}
}
}

View file

@ -0,0 +1,126 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Data;
using System.Configuration;
using System.Collections.Generic;
using System.Web;
using System.Xml;
namespace WebsitePanel.Server
{
/// <summary>
/// Summary description for ServerConfiguration
/// </summary>
public class ServerConfiguration : IConfigurationSectionHandler
{
#region Public Properties
private static SecuritySettings security = null;
public static SecuritySettings Security
{
get
{
return security;
}
}
#endregion
private ServerConfiguration()
{
}
static ServerConfiguration()
{
LoadConfiguration();
}
private static void LoadConfiguration()
{
ConfigurationManager.GetSection("websitepanel.server");
}
public object Create(object parent, object configContext, System.Xml.XmlNode section)
{
// parse "security" section
XmlNode nodeSecurity = section.SelectSingleNode("security");
if (nodeSecurity == null)
throw new Exception("'websitepanel/security' section is missing");
security = new SecuritySettings();
security.ParseSection(nodeSecurity);
return null;
}
#region Inner Classes
public class SecuritySettings
{
private bool securityEnabled;
private string password;
public bool SecurityEnabled
{
get { return this.securityEnabled; }
set { this.securityEnabled = value; }
}
public string Password
{
get { return this.password; }
set { this.password = value; }
}
public void ParseSection(XmlNode section)
{
// enabled
XmlNode nodeEnabled = section.SelectSingleNode("enabled");
if (nodeEnabled == null)
throw new Exception("'websitepanel/security/enabled' node is missing");
if (nodeEnabled.Attributes["value"] == null)
throw new Exception("'websitepanel/security/enabled/@value' attribute is missing");
securityEnabled = true;
Boolean.TryParse(nodeEnabled.Attributes["value"].Value, out securityEnabled);
// password
XmlNode nodePassword = section.SelectSingleNode("password");
if (nodePassword == null)
throw new Exception("'websitepanel/security/password' node is missing");
if (nodePassword.Attributes["value"] == null)
throw new Exception("'websitepanel/security/password/@value' attribute is missing");
password = nodePassword.Attributes["value"].Value;
}
}
#endregion
}
}

View file

@ -0,0 +1,74 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Configuration;
using System.Diagnostics;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using Microsoft.Web.Services3;
using Microsoft.Web.Services3.Design;
using Microsoft.Web.Services3.Security;
using Microsoft.Web.Services3.Security.Tokens;
namespace WebsitePanel.Server
{
public class ServerUsernameTokenManager : UsernameTokenManager
{
/// <summary>
/// Constructs an instance of this security token manager.
/// </summary>
public ServerUsernameTokenManager()
{
}
/// <summary>
/// Constructs an instance of this security token manager.
/// </summary>
/// <param name="nodes">An XmlNodeList containing XML elements from a configuration file.</param>
public ServerUsernameTokenManager(XmlNodeList nodes)
: base(nodes)
{
}
/// <summary>
/// Returns the password or password equivalent for the username provided.
/// </summary>
/// <param name="token">The username token</param>
/// <returns>The password (or password equivalent) for the username</returns>
protected override string AuthenticateToken(UsernameToken token)
{
string password = ServerConfiguration.Security.Password;
if (String.IsNullOrEmpty(password))
throw new Exception("Empty password");
return password;
}
}
}

View file

@ -0,0 +1,187 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Configuration;
using System.Xml;
using System.Diagnostics;
using System.Collections.Generic;
using System.Text;
using System.Web;
using Microsoft.Web.Services3;
using Microsoft.Web.Services3.Design;
using Microsoft.Web.Services3.Security;
using Microsoft.Web.Services3.Security.Tokens;
namespace WebsitePanel.Server
{
public class UsernameAssertion : SecurityPolicyAssertion
{
public override SoapFilter CreateServiceInputFilter(FilterCreationContext context)
{
return new ServiceInputFilter(this, context);
}
public override SoapFilter CreateServiceOutputFilter(FilterCreationContext context)
{
return null;
}
public override SoapFilter CreateClientInputFilter(FilterCreationContext context)
{
// this assertion is intended to work only on service side
return null;
}
public override SoapFilter CreateClientOutputFilter(FilterCreationContext context)
{
// this assertion is intended to work only on service side
return null;
}
public override void ReadXml(XmlReader reader, IDictionary<string, Type> extensions)
{
if (reader == null)
throw new ArgumentNullException("reader");
if (extensions == null)
throw new ArgumentNullException("extensions");
// find the current extension
string tagName = null;
foreach (string extName in extensions.Keys)
{
if (extensions[extName] == typeof(UsernameAssertion))
{
tagName = extName;
break;
}
}
// read the first element (maybe empty)
reader.ReadStartElement(tagName);
}
public override void WriteXml(XmlWriter writer)
{
// Typically this is not needed for custom policies
}
#region ServiceInputFilter
public class ServiceInputFilter : ReceiveSecurityFilter
{
UsernameAssertion parentAssertion;
FilterCreationContext filterContext;
public ServiceInputFilter(UsernameAssertion parentAssertion, FilterCreationContext filterContext)
: base(parentAssertion.ServiceActor, false, parentAssertion.ClientActor)
{
this.parentAssertion = parentAssertion;
this.filterContext = filterContext;
}
public override void ValidateMessageSecurity(SoapEnvelope envelope, Security security)
{
if (!ServerConfiguration.Security.SecurityEnabled)
return;
// by default we consider that SOAP messages is not signed
bool IsSigned = false;
// if security element is null
// the call is made not from WSE-enabled client
if (security != null)
{
foreach (ISecurityElement element in security.Elements)
{
if (element is MessageSignature)
{
// The given context contains a Signature element.
MessageSignature sign = element as MessageSignature;
if (CheckSignature(envelope, security, sign))
{
// The SOAP message is signed.
if (sign.SigningToken is UsernameToken)
{
UsernameToken token = sign.SigningToken as UsernameToken;
// The SOAP message is signed
// with a UsernameToken.
IsSigned = true;
}
}
}
}
}
// throw an exception if the message did not pass all the tests
if (!IsSigned)
throw new SecurityFault("Message did not meet security requirements.");
}
private bool CheckSignature(SoapEnvelope envelope, Security security, MessageSignature signature)
{
//
// Now verify which parts of the message were actually signed.
//
SignatureOptions actualOptions = signature.SignatureOptions;
SignatureOptions expectedOptions = SignatureOptions.IncludeSoapBody;
if (security != null && security.Timestamp != null)
expectedOptions |= SignatureOptions.IncludeTimestamp;
//
// The <Action> and <To> are required addressing elements.
//
expectedOptions |= SignatureOptions.IncludeAction;
expectedOptions |= SignatureOptions.IncludeTo;
if (envelope.Context.Addressing.FaultTo != null && envelope.Context.Addressing.FaultTo.TargetElement != null)
expectedOptions |= SignatureOptions.IncludeFaultTo;
if (envelope.Context.Addressing.From != null && envelope.Context.Addressing.From.TargetElement != null)
expectedOptions |= SignatureOptions.IncludeFrom;
if (envelope.Context.Addressing.MessageID != null && envelope.Context.Addressing.MessageID.TargetElement != null)
expectedOptions |= SignatureOptions.IncludeMessageId;
if (envelope.Context.Addressing.RelatesTo != null && envelope.Context.Addressing.RelatesTo.TargetElement != null)
expectedOptions |= SignatureOptions.IncludeRelatesTo;
if (envelope.Context.Addressing.ReplyTo != null && envelope.Context.Addressing.ReplyTo.TargetElement != null)
expectedOptions |= SignatureOptions.IncludeReplyTo;
//
// Check if the all the expected options are the present.
//
return ((expectedOptions & actualOptions) == expectedOptions);
}
}
#endregion
}
}

View file

@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="DNSServer.asmx.cs" Class="WebsitePanel.Server.DNSServer" %>

View file

@ -0,0 +1,238 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.ComponentModel;
using System.Web.Services;
using System.Web.Services.Protocols;
using WebsitePanel.Providers;
using WebsitePanel.Providers.DNS;
using WebsitePanel.Server.Utils;
using Microsoft.Web.Services3;
namespace WebsitePanel.Server
{
/// <summary>
/// Summary description for DNSServer
/// </summary>
[WebService(Namespace = "http://smbsaas/websitepanel/server/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Policy("ServerPolicy")]
[ToolboxItem(false)]
public class DNSServer : HostingServiceProviderWebService, IDnsServer
{
private IDnsServer DnsProvider
{
get { return (IDnsServer)Provider; }
}
#region Zones
[WebMethod, SoapHeader("settings")]
public bool ZoneExists(string zoneName)
{
try
{
Log.WriteStart("'{0}' ZoneExists", ProviderSettings.ProviderName);
bool result = DnsProvider.ZoneExists(zoneName);
Log.WriteEnd("'{0}' ZoneExists", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ZoneExists", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public string[] GetZones()
{
try
{
Log.WriteStart("'{0}' GetZones", ProviderSettings.ProviderName);
string[] result = DnsProvider.GetZones();
Log.WriteEnd("'{0}' GetZones", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetZones", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void AddPrimaryZone(string zoneName, string[] secondaryServers)
{
try
{
Log.WriteStart("'{0}' AddPrimaryZone", ProviderSettings.ProviderName);
DnsProvider.AddPrimaryZone(zoneName, secondaryServers);
Log.WriteEnd("'{0}' AddPrimaryZone", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' AddPrimaryZone", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void AddSecondaryZone(string zoneName, string[] masterServers)
{
try
{
Log.WriteStart("'{0}' AddSecondaryZone", ProviderSettings.ProviderName);
DnsProvider.AddSecondaryZone(zoneName, masterServers);
Log.WriteEnd("'{0}' AddSecondaryZone", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' AddSecondaryZone", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteZone(string zoneName)
{
try
{
Log.WriteStart("'{0}' DeleteZone", ProviderSettings.ProviderName);
DnsProvider.DeleteZone(zoneName);
Log.WriteEnd("'{0}' DeleteZone", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteZone", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void UpdateSoaRecord(string zoneName, string host, string primaryNsServer, string primaryPerson)
{
try
{
Log.WriteStart("'{0}' UpdateSoaRecord", ProviderSettings.ProviderName);
DnsProvider.UpdateSoaRecord(zoneName, host, primaryNsServer, primaryPerson);
Log.WriteEnd("'{0}' UpdateSoaRecord", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UpdateSoaRecord", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region Records
[WebMethod, SoapHeader("settings")]
public DnsRecord[] GetZoneRecords(string zoneName)
{
try
{
Log.WriteStart("'{0}' GetZoneRecords", ProviderSettings.ProviderName);
DnsRecord[] result = DnsProvider.GetZoneRecords(zoneName);
Log.WriteEnd("'{0}' GetZoneRecords", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetZoneRecords", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void AddZoneRecord(string zoneName, DnsRecord record)
{
try
{
Log.WriteStart("'{0}' AddZoneRecord", ProviderSettings.ProviderName);
DnsProvider.AddZoneRecord(zoneName, record);
Log.WriteEnd("'{0}' AddZoneRecord", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' AddZoneRecord", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteZoneRecord(string zoneName, DnsRecord record)
{
try
{
Log.WriteStart("'{0}' DeleteZoneRecord", ProviderSettings.ProviderName);
DnsProvider.DeleteZoneRecord(zoneName, record);
Log.WriteEnd("'{0}' DeleteZoneRecord", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteZoneRecord", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void AddZoneRecords(string zoneName, DnsRecord[] records)
{
try
{
Log.WriteStart("'{0}' AddZoneRecords", ProviderSettings.ProviderName);
DnsProvider.AddZoneRecords(zoneName, records);
Log.WriteEnd("'{0}' AddZoneRecords", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' AddZoneRecords", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteZoneRecords(string zoneName, DnsRecord[] records)
{
try
{
Log.WriteStart("'{0}' DeleteZoneRecords", ProviderSettings.ProviderName);
DnsProvider.DeleteZoneRecords(zoneName, records);
Log.WriteEnd("'{0}' DeleteZoneRecords", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteZoneRecords", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
}
}

View file

@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="DatabaseServer.asmx.cs" Class="WebsitePanel.Server.DatabaseServer" %>

View file

@ -0,0 +1,444 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using Microsoft.Web.Services3;
using WebsitePanel.Server.Utils;
using WebsitePanel.Providers;
using WebsitePanel.Providers.Database;
namespace WebsitePanel.Server
{
/// <summary>
/// Summary description for DatabaseServer
/// </summary>
[WebService(Namespace = "http://smbsaas/websitepanel/server/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Policy("ServerPolicy")]
[ToolboxItem(false)]
public class DatabaseServer : HostingServiceProviderWebService, IDatabaseServer
{
private IDatabaseServer DatabaseProvider
{
get { return (IDatabaseServer)Provider; }
}
#region General methods
[WebMethod, SoapHeader("settings")]
public bool CheckConnectivity(string databaseName, string username, string password)
{
try
{
Log.WriteStart("'{0}' CheckConnectivity", ProviderSettings.ProviderName);
bool result = DatabaseProvider.CheckConnectivity(databaseName, username, password);
Log.WriteEnd("'{0}' CheckConnectivity", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CheckConnectivity", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public DataSet ExecuteSqlQuery(string databaseName, string commandText)
{
try
{
Log.WriteStart("'{0}' ExecuteSqlQuery", ProviderSettings.ProviderName);
DataSet result = DatabaseProvider.ExecuteSqlQuery(databaseName, commandText);
Log.WriteEnd("'{0}' ExecuteSqlQuery", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ExecuteSqlQuery", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void ExecuteSqlNonQuery(string databaseName, string commandText)
{
try
{
Log.WriteStart("'{0}' ExecuteSqlNonQuery", ProviderSettings.ProviderName);
DatabaseProvider.ExecuteSqlNonQuery(databaseName, commandText);
Log.WriteEnd("'{0}' ExecuteSqlNonQuery", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ExecuteSqlNonQuery", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public DataSet ExecuteSqlQuerySafe(string databaseName, string username, string password, string commandText)
{
try
{
Log.WriteStart("'{0}' ExecuteSqlQuerySafe", ProviderSettings.ProviderName);
DataSet result = DatabaseProvider.ExecuteSqlQuerySafe(databaseName, username, password, commandText);
Log.WriteEnd("'{0}' ExecuteSqlQuerySafe", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ExecuteSqlQuerySafe", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void ExecuteSqlNonQuerySafe(string databaseName, string username, string password, string commandText)
{
try
{
Log.WriteStart("'{0}' ExecuteSqlNonQuerySafe", ProviderSettings.ProviderName);
DatabaseProvider.ExecuteSqlNonQuerySafe(databaseName, username, password, commandText);
Log.WriteEnd("'{0}' ExecuteSqlNonQuerySafe", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ExecuteSqlNonQuerySafe", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region Databases
[WebMethod, SoapHeader("settings")]
public bool DatabaseExists(string databaseName)
{
try
{
Log.WriteStart("'{0}' DatabaseExists", ProviderSettings.ProviderName);
bool result = DatabaseProvider.DatabaseExists(databaseName);
Log.WriteEnd("'{0}' DatabaseExists", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DatabaseExists", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public string[] GetDatabases()
{
try
{
Log.WriteStart("'{0}' GetDatabases", ProviderSettings.ProviderName);
string[] result = DatabaseProvider.GetDatabases();
Log.WriteEnd("'{0}' GetDatabases", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetDatabases", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public SqlDatabase GetDatabase(string databaseName)
{
try
{
Log.WriteStart("'{0}' GetDatabase", ProviderSettings.ProviderName);
SqlDatabase result = DatabaseProvider.GetDatabase(databaseName);
Log.WriteEnd("'{0}' GetDatabase", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetDatabase", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void CreateDatabase(SqlDatabase database)
{
try
{
Log.WriteStart("'{0}' CreateDatabase", ProviderSettings.ProviderName);
DatabaseProvider.CreateDatabase(database);
Log.WriteEnd("'{0}' CreateDatabase", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CreateDatabase", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void UpdateDatabase(SqlDatabase database)
{
try
{
Log.WriteStart("'{0}' UpdateDatabase", ProviderSettings.ProviderName);
DatabaseProvider.UpdateDatabase(database);
Log.WriteEnd("'{0}' UpdateDatabase", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UpdateDatabase", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteDatabase(string databaseName)
{
try
{
Log.WriteStart("'{0}' DeleteDatabase", ProviderSettings.ProviderName);
DatabaseProvider.DeleteDatabase(databaseName);
Log.WriteEnd("'{0}' DeleteDatabase", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteDatabase", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void TruncateDatabase(string databaseName)
{
try
{
Log.WriteStart("'{0}' TruncateDatabase", ProviderSettings.ProviderName);
DatabaseProvider.TruncateDatabase(databaseName);
Log.WriteEnd("'{0}' TruncateDatabase", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' TruncateDatabase", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public byte[] GetTempFileBinaryChunk(string path, int offset, int length)
{
try
{
Log.WriteStart("'{0}' GetTempFileBinaryChunk", ProviderSettings.ProviderName);
byte[] result = DatabaseProvider.GetTempFileBinaryChunk(path, offset, length);
Log.WriteEnd("'{0}' GetTempFileBinaryChunk", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetTempFileBinaryChunk", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public string AppendTempFileBinaryChunk(string fileName, string path, byte[] chunk)
{
try
{
Log.WriteStart("'{0}' AppendTempFileBinaryChunk", ProviderSettings.ProviderName);
string result = DatabaseProvider.AppendTempFileBinaryChunk(fileName, path, chunk);
Log.WriteEnd("'{0}' AppendTempFileBinaryChunk", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' AppendTempFileBinaryChunk", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public string BackupDatabase(string databaseName, string backupName, bool zipBackup)
{
try
{
Log.WriteStart("'{0}' BackupDatabase", ProviderSettings.ProviderName);
string result = DatabaseProvider.BackupDatabase(databaseName, backupName, zipBackup);
Log.WriteEnd("'{0}' BackupDatabase", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' BackupDatabase", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void RestoreDatabase(string databaseName, string[] fileNames)
{
try
{
Log.WriteStart("'{0}' RestoreDatabase", ProviderSettings.ProviderName);
DatabaseProvider.RestoreDatabase(databaseName, fileNames);
Log.WriteEnd("'{0}' RestoreDatabase", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' RestoreDatabase", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region Users
[WebMethod, SoapHeader("settings")]
public bool UserExists(string userName)
{
try
{
Log.WriteStart("'{0}' UserExists", ProviderSettings.ProviderName);
bool result = DatabaseProvider.UserExists(userName);
Log.WriteEnd("'{0}' UserExists", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UserExists", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public string[] GetUsers()
{
try
{
Log.WriteStart("'{0}' GetUsers", ProviderSettings.ProviderName);
string[] result = DatabaseProvider.GetUsers();
Log.WriteEnd("'{0}' GetUsers", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetUsers", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public SqlUser GetUser(string username, string[] databases)
{
try
{
Log.WriteStart("'{0}' GetUser", ProviderSettings.ProviderName);
SqlUser result = DatabaseProvider.GetUser(username, databases);
Log.WriteEnd("'{0}' GetUser", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetUser", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void CreateUser(SqlUser user, string password)
{
try
{
Log.WriteStart("'{0}' CreateUser", ProviderSettings.ProviderName);
DatabaseProvider.CreateUser(user, password);
Log.WriteEnd("'{0}' CreateUser", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CreateUser", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void UpdateUser(SqlUser user, string[] databases)
{
try
{
Log.WriteStart("'{0}' UpdateUser", ProviderSettings.ProviderName);
DatabaseProvider.UpdateUser(user, databases);
Log.WriteEnd("'{0}' UpdateUser", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UpdateUser", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteUser(string username, string[] databases)
{
try
{
Log.WriteStart("'{0}' DeleteUser", ProviderSettings.ProviderName);
DatabaseProvider.DeleteUser(username, databases);
Log.WriteEnd("'{0}' DeleteUser", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteUser", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void ChangeUserPassword(string username, string password)
{
try
{
Log.WriteStart("'{0}' ChangeUserPassword", ProviderSettings.ProviderName);
DatabaseProvider.ChangeUserPassword(username, password);
Log.WriteEnd("'{0}' ChangeUserPassword", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ChangeUserPassword", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
}
}

View file

@ -0,0 +1,82 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebsitePanel.Server.DefaultPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>WebsitePanel Server</title>
<style>
BODY
{
margin:0px;
padding: 10px;
font-family: Tahoma, Arial;
font-size: 10pt;
}
.Content
{
width: 400px;
margin-top: 30px;
margin-left: auto;
margin-right: auto;
}
H1
{
font-family: Arial, Tahoma;
font-size: 18pt;
margin-top: 40px;
margin-bottom: 5px;
font-weight: bold;
padding: 4px;
}
TABLE
{
background-color: #e0e0e0;
padding: 4px;
}
TD
{
padding: 8px;
background-color: #ffffff;
}
.FieldName
{
width: 100px;
font-weight: bold;
}
</style>
</head>
<body>
<form id="AspForm" runat="server">
<div class="Content">
<div>
<asp:Image ID="imgLogo" runat="server" />
</div>
<h1>Server</h1>
<table cellpadding="0" cellspacing="1">
<tr>
<td class="FieldName">Status:</td>
<td>Running</td>
</tr>
<tr>
<td class="FieldName">Version:</td>
<td><asp:Literal id="litVersion" runat="server"></asp:Literal></td>
</tr>
<tr>
<td class="FieldName">URL:</td>
<td><asp:Literal id="litUrl" runat="server"/></td>
</tr>
<tr>
<td class="FieldName">ASP.NET Mode:</td>
<td><asp:Literal id="litAspNetMode" runat="server"/></td>
</tr>
</table>
</div>
</form>
</body>
</html>

View file

@ -0,0 +1,63 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Reflection;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace WebsitePanel.Server
{
public partial class DefaultPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// set url
string url = Request.Url.ToString();
litUrl.Text = url.Substring(0, url.LastIndexOf("/"));
// set version
object[] attrs = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), true);
if(attrs.Length > 0)
litVersion.Text = ((AssemblyInformationalVersionAttribute)attrs[0]).InformationalVersion;
// asp.net mode
litAspNetMode.Text = (IntPtr.Size == 8) ? "64-bit" : "32-bit";
imgLogo.ImageUrl = Page.ClientScript.GetWebResourceUrl(
typeof(DefaultPage), "WebsitePanel.Server.Images.logo.png");
}
}
}

View file

@ -0,0 +1,76 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.312
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Server {
/// <summary>
/// DefaultPage class.
/// </summary>
/// <remarks>
/// Auto-generated class.
/// </remarks>
public partial class DefaultPage {
/// <summary>
/// Head1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlHead Head1;
/// <summary>
/// AspForm control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm AspForm;
/// <summary>
/// imgLogo control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Image imgLogo;
/// <summary>
/// litVersion control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litVersion;
/// <summary>
/// litUrl control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litUrl;
/// <summary>
/// litAspNetMode control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litAspNetMode;
}
}

View file

@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="ExchangeServer.asmx.cs" Class="WebsitePanel.Server.ExchangeServer" %>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="ExchangeServerHostedEdition.asmx.cs" Class="WebsitePanel.Server.ExchangeServerHostedEdition" %>

View file

@ -0,0 +1,201 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
using WebsitePanel.Providers;
using WebsitePanel.Providers.ExchangeHostedEdition;
using Microsoft.Web.Services3;
using System.Web.Services.Protocols;
using WebsitePanel.Server.Utils;
namespace WebsitePanel.Server
{
/// <summary>
/// Summary description for ExchangeHostedEdition
/// </summary>
[WebService(Namespace = "http://smbsaas/websitepanel/server/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Policy("ServerPolicy")]
public class ExchangeServerHostedEdition : HostingServiceProviderWebService, IExchangeHostedEdition
{
private IExchangeHostedEdition ExchangeServer
{
get { return (IExchangeHostedEdition)Provider; }
}
[WebMethod, SoapHeader("settings")]
public void CreateOrganization(string organizationId, string programId, string offerId, string domain,
string adminName, string adminEmail, string adminPassword)
{
try
{
Log.WriteStart("'{0}' CreateOrganization", ProviderSettings.ProviderName);
ExchangeServer.CreateOrganization(organizationId, programId, offerId, domain, adminName, adminEmail, adminPassword);
Log.WriteEnd("'{0}' CreateOrganization", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CreateOrganization", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public List<ExchangeOrganizationDomain> GetOrganizationDomains(string organizationId)
{
try
{
Log.WriteStart("'{0}' GetOrganizationDomains", ProviderSettings.ProviderName);
List<ExchangeOrganizationDomain> result = ExchangeServer.GetOrganizationDomains(organizationId);
Log.WriteEnd("'{0}' GetOrganizationDomains", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetOrganizationDomains", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void AddOrganizationDomain(string organizationId, string domain)
{
try
{
Log.WriteStart("'{0}' AddOrganizationDomain", ProviderSettings.ProviderName);
ExchangeServer.AddOrganizationDomain(organizationId, domain);
Log.WriteEnd("'{0}' AddOrganizationDomain", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' AddOrganizationDomain", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteOrganizationDomain(string organizationId, string domain)
{
try
{
Log.WriteStart("'{0}' DeleteOrganizationDomain", ProviderSettings.ProviderName);
ExchangeServer.DeleteOrganizationDomain(organizationId, domain);
Log.WriteEnd("'{0}' DeleteOrganizationDomain", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteOrganizationDomain", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public ExchangeOrganization GetOrganizationDetails(string organizationId)
{
try
{
Log.WriteStart("'{0}' GetOrganizationDetails", ProviderSettings.ProviderName);
ExchangeOrganization result = ExchangeServer.GetOrganizationDetails(organizationId);
Log.WriteEnd("'{0}' GetOrganizationDetails", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetOrganizationDetails", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void UpdateOrganizationQuotas(string organizationId, int mailboxesNumber, int contactsNumber, int distributionListsNumber)
{
try
{
Log.WriteStart("'{0}' UpdateOrganizationQuotas", ProviderSettings.ProviderName);
ExchangeServer.UpdateOrganizationQuotas(organizationId, mailboxesNumber, contactsNumber, distributionListsNumber);
Log.WriteEnd("'{0}' UpdateOrganizationQuotas", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UpdateOrganizationQuotas", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void UpdateOrganizationCatchAllAddress(string organizationId, string catchAllEmail)
{
try
{
Log.WriteStart("'{0}' UpdateOrganizationCatchAllAddress", ProviderSettings.ProviderName);
ExchangeServer.UpdateOrganizationCatchAllAddress(organizationId, catchAllEmail);
Log.WriteEnd("'{0}' UpdateOrganizationCatchAllAddress", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UpdateOrganizationCatchAllAddress", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void UpdateOrganizationServicePlan(string organizationId, string programId, string offerId)
{
try
{
Log.WriteStart("'{0}' UpdateOeganizationServicePlan", ProviderSettings.ProviderName);
ExchangeServer.UpdateOrganizationServicePlan(organizationId, programId, offerId);
Log.WriteEnd("'{0}' UpdateOeganizationServicePlan", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UpdateOeganizationServicePlan", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteOrganization(string organizationId)
{
try
{
Log.WriteStart("'{0}' DeleteOrganization", ProviderSettings.ProviderName);
ExchangeServer.DeleteOrganization(organizationId);
Log.WriteEnd("'{0}' DeleteOrganization", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteOrganization", ProviderSettings.ProviderName), ex);
throw;
}
}
}
}

View file

@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="FTPServer.asmx.cs" Class="WebsitePanel.Server.FTPServer" %>

View file

@ -0,0 +1,296 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using Microsoft.Web.Services3;
using WebsitePanel.Providers;
using WebsitePanel.Providers.FTP;
using WebsitePanel.Server.Utils;
namespace WebsitePanel.Server
{
/// <summary>
/// Summary description for FTPServer
/// </summary>
[WebService(Namespace = "http://smbsaas/websitepanel/server/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Policy("ServerPolicy")]
[ToolboxItem(false)]
public class FTPServer : HostingServiceProviderWebService, IFtpServer
{
private IFtpServer FtpProvider
{
get { return (IFtpServer)Provider; }
}
#region Sites
[WebMethod, SoapHeader("settings")]
public void ChangeSiteState(string siteId, ServerState state)
{
try
{
Log.WriteStart("'{0}' ChangeSiteState", ProviderSettings.ProviderName);
FtpProvider.ChangeSiteState(siteId, state);
Log.WriteEnd("'{0}' ChangeSiteState", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ChangeSiteState", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public ServerState GetSiteState(string siteId)
{
try
{
Log.WriteStart("'{0}' GetSiteState", ProviderSettings.ProviderName);
ServerState result = FtpProvider.GetSiteState(siteId);
Log.WriteEnd("'{0}' GetSiteState", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetSiteState", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public bool SiteExists(string siteId)
{
try
{
Log.WriteStart("'{0}' SiteIdExists", ProviderSettings.ProviderName);
bool result = FtpProvider.SiteExists(siteId);
Log.WriteEnd("'{0}' SiteIdExists", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' SiteIdExists", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public FtpSite[] GetSites()
{
try
{
Log.WriteStart("'{0}' GetSites", ProviderSettings.ProviderName);
FtpSite[] result = FtpProvider.GetSites();
Log.WriteEnd("'{0}' GetSites", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetSites", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public FtpSite GetSite(string siteId)
{
try
{
Log.WriteStart("'{0}' GetSite", ProviderSettings.ProviderName);
FtpSite result = FtpProvider.GetSite(siteId);
Log.WriteEnd("'{0}' GetSite", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetSite", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public string CreateSite(FtpSite site)
{
try
{
Log.WriteStart("'{0}' CreateSite", ProviderSettings.ProviderName);
string result = FtpProvider.CreateSite(site);
Log.WriteEnd("'{0}' CreateSite", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CreateSite", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void UpdateSite(FtpSite site)
{
try
{
Log.WriteStart("'{0}' UpdateSite", ProviderSettings.ProviderName);
FtpProvider.UpdateSite(site);
Log.WriteEnd("'{0}' UpdateSite", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UpdateSite", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteSite(string siteId)
{
try
{
Log.WriteStart("'{0}' DeleteSite", ProviderSettings.ProviderName);
FtpProvider.DeleteSite(siteId);
Log.WriteEnd("'{0}' DeleteSite", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteSite", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region Accounts
[WebMethod, SoapHeader("settings")]
public bool AccountExists(string accountName)
{
try
{
Log.WriteStart("'{0}' AccountExists", ProviderSettings.ProviderName);
bool result = FtpProvider.AccountExists(accountName);
Log.WriteEnd("'{0}' AccountExists", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' AccountExists", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public FtpAccount[] GetAccounts()
{
try
{
Log.WriteStart("'{0}' GetAccounts", ProviderSettings.ProviderName);
FtpAccount[] result = FtpProvider.GetAccounts();
Log.WriteEnd("'{0}' GetAccounts", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetAccounts", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public FtpAccount GetAccount(string accountName)
{
try
{
Log.WriteStart("'{0}' GetAccount", ProviderSettings.ProviderName);
FtpAccount result = FtpProvider.GetAccount(accountName);
Log.WriteEnd("'{0}' GetAccount", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetAccount", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void CreateAccount(FtpAccount account)
{
try
{
Log.WriteStart("'{0}' CreateAccount", ProviderSettings.ProviderName);
FtpProvider.CreateAccount(account);
Log.WriteEnd("'{0}' CreateAccount", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CreateAccount", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void UpdateAccount(FtpAccount account)
{
try
{
Log.WriteStart("'{0}' UpdateAccount", ProviderSettings.ProviderName);
FtpProvider.UpdateAccount(account);
Log.WriteEnd("'{0}' UpdateAccount", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UpdateAccount", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteAccount(string accountName)
{
try
{
Log.WriteStart("'{0}' DeleteAccount", ProviderSettings.ProviderName);
FtpProvider.DeleteAccount(accountName);
Log.WriteEnd("'{0}' DeleteAccount", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteAccount", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
}
}

View file

@ -0,0 +1 @@
<%@ Application Codebehind="Global.asax.cs" Inherits="WebsitePanel.Server.Global" Language="C#" %>

View file

@ -0,0 +1,82 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Net;
using System.Timers;
namespace WebsitePanel.Server
{
public class Global : System.Web.HttpApplication
{
private int keepAliveMinutes = 10;
private static string keepAliveUrl = "";
private static Timer timer = null;
protected void Application_Start(object sender, EventArgs e)
{
}
protected void Application_End(object sender, EventArgs e)
{
}
protected void Application_BeginRequest(object sender, EventArgs e)
{
// ASP.NET Integration Mode workaround
if (String.IsNullOrEmpty(keepAliveUrl))
{
// init keep-alive
keepAliveUrl = HttpContext.Current.Request.Url.ToString();
if (this.keepAliveMinutes > 0)
{
timer = new Timer(60000 * this.keepAliveMinutes);
timer.Elapsed += new ElapsedEventHandler(KeepAlive);
timer.Start();
}
}
}
public override void Init()
{
}
private void KeepAlive(Object sender, System.Timers.ElapsedEventArgs e)
{
using (HttpWebRequest.Create(keepAliveUrl).GetResponse()) { }
}
}
}

View file

@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="HostedSharePointServer.asmx.cs" Class="WebsitePanel.Server.HostedSharePointServer" %>

View file

@ -0,0 +1,267 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.ComponentModel;
using System.Web.Services;
using System.Web.Services.Protocols;
using WebsitePanel.Providers;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.SharePoint;
using WebsitePanel.Server.Utils;
using Microsoft.Web.Services3;
namespace WebsitePanel.Server
{
/// <summary>
/// Summary description for HostedSharePointServer
/// </summary>
[WebService(Namespace = "http://smbsaas/websitepanel/server/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Policy("ServerPolicy")]
[ToolboxItem(false)]
public class HostedSharePointServer : HostingServiceProviderWebService
{
private delegate TReturn Action<TReturn>();
/// <summary>
/// Gets hosted SharePoint provider instance.
/// </summary>
private IHostedSharePointServer HostedSharePointServerProvider
{
get { return (IHostedSharePointServer)Provider; }
}
/// <summary>
/// Gets list of supported languages by this installation of SharePoint.
/// </summary>
/// <returns>List of supported languages</returns>
[WebMethod, SoapHeader("settings")]
public int[] GetSupportedLanguages()
{
return ExecuteAction<int[]>(delegate
{
return HostedSharePointServerProvider.GetSupportedLanguages();
}, "GetSupportedLanguages");
}
/// <summary>
/// Gets list of SharePoint collections within root web application.
/// </summary>
/// <returns>List of SharePoint collections within root web application.</returns>
[WebMethod, SoapHeader("settings")]
public SharePointSiteCollection[] GetSiteCollections()
{
return ExecuteAction<SharePointSiteCollection[]>(delegate
{
return HostedSharePointServerProvider.GetSiteCollections();
}, "GetSiteCollections");
}
/// <summary>
/// Gets SharePoint collection within root web application with given name.
/// </summary>
/// <param name="url">Url that uniquely identifies site collection to be loaded.</param>
/// <returns>SharePoint collection within root web application with given name.</returns>
[WebMethod, SoapHeader("settings")]
public SharePointSiteCollection GetSiteCollection(string url)
{
return ExecuteAction<SharePointSiteCollection>(delegate
{
return HostedSharePointServerProvider.GetSiteCollection(url);
}, "GetSiteCollection");
}
/// <summary>
/// Creates site collection within predefined root web application.
/// </summary>
/// <param name="siteCollection">Information about site coolection to be created.</param>
[WebMethod, SoapHeader("settings")]
public void CreateSiteCollection(SharePointSiteCollection siteCollection)
{
siteCollection.OwnerLogin = AttachNetbiosDomainName(siteCollection.OwnerLogin);
ExecuteAction<object>(delegate
{
HostedSharePointServerProvider.CreateSiteCollection(siteCollection);
return new object();
}, "CreateSiteCollection");
}
[WebMethod, SoapHeader("settings")]
public void UpdateQuotas(string url, long maxSize, long warningSize)
{
ExecuteAction<object>(delegate
{
HostedSharePointServerProvider.UpdateQuotas(url, maxSize, warningSize);
return new object();
}, "UpdateQuotas");
}
[WebMethod, SoapHeader("settings")]
public SharePointSiteDiskSpace[] CalculateSiteCollectionsDiskSpace(string[] urls)
{
SharePointSiteDiskSpace []ret = null;
ret = ExecuteAction<SharePointSiteDiskSpace[]>(delegate
{
return HostedSharePointServerProvider.CalculateSiteCollectionsDiskSpace(urls);
}, "CalculateSiteCollectionDiskSpace");
return ret;
}
/// <summary>
/// Deletes site collection under given url.
/// </summary>
/// <param name="url">Url that uniquely identifies site collection to be deleted.</param>
[WebMethod, SoapHeader("settings")]
public void DeleteSiteCollection(string url)
{
ExecuteAction<object>(delegate
{
HostedSharePointServerProvider.DeleteSiteCollection(url);
return new object();
}, "DeleteSiteCollection");
}
/// <summary>
/// Backups site collection under give url.
/// </summary>
/// <param name="url">Url that uniquely identifies site collection to be deleted.</param>
/// <param name="filename">Resulting backup file name.</param>
/// <param name="zip">A value which shows whether created backup must be archived.</param>
/// <returns>Created backup full path.</returns>
[WebMethod, SoapHeader("settings")]
public string BackupSiteCollection(string url, string filename, bool zip)
{
return ExecuteAction<string>(delegate
{
return
HostedSharePointServerProvider.BackupSiteCollection(url, filename, zip);
}, "BackupSiteCollection");
}
/// <summary>
/// Restores site collection under given url from backup.
/// </summary>
/// <param name="siteCollection">Site collection to be restored.</param>
/// <param name="filename">Backup file name to restore from.</param>
[WebMethod, SoapHeader("settings")]
public void RestoreSiteCollection(SharePointSiteCollection siteCollection, string filename)
{
siteCollection.OwnerLogin = AttachNetbiosDomainName(siteCollection.OwnerLogin);
ExecuteAction<object>(delegate
{
HostedSharePointServerProvider.RestoreSiteCollection(siteCollection, filename);
return new object();
}, "RestoreSiteCollection");
}
/// <summary>
/// Gets binary data chunk of specified size from specified offset.
/// </summary>
/// <param name="path">Path to file to get bunary data chunk from.</param>
/// <param name="offset">Offset from which to start data reading.</param>
/// <param name="length">Binary data chunk length.</param>
/// <returns>Binary data chunk read from file.</returns>
[WebMethod, SoapHeader("settings")]
public byte[] GetTempFileBinaryChunk(string path, int offset, int length)
{
return ExecuteAction<byte[]>(delegate
{
return
HostedSharePointServerProvider.GetTempFileBinaryChunk(path, offset, length);
}, "GetTempFileBinaryChunk");
}
/// <summary>
/// Appends supplied binary data chunk to file.
/// </summary>
/// <param name="fileName">Non existent file name to append to.</param>
/// <param name="path">Full path to existent file to append to.</param>
/// <param name="chunk">Binary data chunk to append to.</param>
/// <returns>Path to file that was appended with chunk.</returns>
[WebMethod, SoapHeader("settings")]
public virtual string AppendTempFileBinaryChunk(string fileName, string path, byte[] chunk)
{
return ExecuteAction<string>(delegate
{
return
HostedSharePointServerProvider.AppendTempFileBinaryChunk(fileName, path, chunk);
}, "AppendTempFileBinaryChunk");
}
[WebMethod, SoapHeader("settings")]
public long GetSiteCollectionSize(string url)
{
return ExecuteAction<long>(delegate
{
return
HostedSharePointServerProvider.GetSiteCollectionSize(url);
}, "GetSiteCollectionSize");
}
/// <summary>
/// Executes supplied action and performs logging.
/// </summary>
/// <typeparam name="TReturn">Type of action's return value.</typeparam>
/// <param name="action">Action to be executed.</param>
/// <param name="actionName">Action name for logging purposes.</param>
/// <returns>Action execution result.</returns>
private TReturn ExecuteAction<TReturn>(Action<TReturn> action, string actionName)
{
try
{
Log.WriteStart("'{0}' {1}", ProviderSettings.ProviderName, actionName);
TReturn result = action();
Log.WriteEnd("'{0}' {1}", ProviderSettings.ProviderName, actionName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("Can't {1} '{0}' provider", ProviderSettings.ProviderName, actionName), ex);
throw;
}
}
/// <summary>
/// Returns fully qualified netbios account name.
/// </summary>
/// <param name="accountName">Account name.</param>
/// <returns>Fully qualified netbios account name.</returns>
private string AttachNetbiosDomainName(string accountName)
{
string domainNetbiosName = String.Format("{0}\\", ActiveDirectoryUtils.GetNETBIOSDomainName(ServerSettings.ADRootDomain));
return String.Format("{0}{1}", domainNetbiosName, accountName.Replace(domainNetbiosName, String.Empty));
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View file

@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="MailServer.asmx.cs" Class="WebsitePanel.Server.MailServer" %>

View file

@ -0,0 +1,634 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using Microsoft.Web.Services3;
using WebsitePanel.Providers;
using WebsitePanel.Providers.Mail;
using WebsitePanel.Server.Utils;
using Microsoft.Web.Services3.Messaging;
namespace WebsitePanel.Server
{
/// <summary>
/// Summary description for MailServer
/// </summary>
[WebService(Namespace = "http://smbsaas/websitepanel/server/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Policy("ServerPolicy")]
[ToolboxItem(false)]
public class MailServer : HostingServiceProviderWebService, IMailServer
{
private IMailServer MailProvider
{
get { return (IMailServer)Provider; }
}
#region Domains
[WebMethod, SoapHeader("settings")]
public bool DomainExists(string domainName)
{
try
{
Log.WriteStart("'{0}' DomainExists", ProviderSettings.ProviderName);
bool result = MailProvider.DomainExists(domainName);
Log.WriteEnd("'{0}' DomainExists", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DomainExists", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public MailDomain GetDomain(string domainName)
{
try
{
Log.WriteStart("'{0}' GetDomain", ProviderSettings.ProviderName);
MailDomain result = MailProvider.GetDomain(domainName);
Log.WriteEnd("'{0}' GetDomain", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetDomain", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public string[] GetDomains()
{
try
{
Log.WriteStart("'{0}' GetDomains", ProviderSettings.ProviderName);
string[] result = MailProvider.GetDomains();
Log.WriteEnd("'{0}' GetDomains", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetDomain", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void CreateDomain(MailDomain domain)
{
try
{
Log.WriteStart("'{0}' CreateDomain", ProviderSettings.ProviderName);
MailProvider.CreateDomain(domain);
Log.WriteEnd("'{0}' CreateDomain", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CreateDomain", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void UpdateDomain(MailDomain domain)
{
try
{
Log.WriteStart("'{0}' UpdateDomain", ProviderSettings.ProviderName);
MailProvider.UpdateDomain(domain);
Log.WriteEnd("'{0}' UpdateDomain", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UpdateDomain", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteDomain(string domainName)
{
try
{
Log.WriteStart("'{0}' DeleteDomain", ProviderSettings.ProviderName);
MailProvider.DeleteDomain(domainName);
Log.WriteEnd("'{0}' DeleteDomain", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteDomain", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region Domain Aliases
[WebMethod, SoapHeader("settings")]
public bool DomainAliasExists(string domainName, string aliasName)
{
try
{
Log.WriteStart("'{0}' DomainAliasExists", ProviderSettings.ProviderName);
bool result = MailProvider.DomainAliasExists(domainName, aliasName);
Log.WriteEnd("'{0}' DomainAliasExists", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DomainAliasExists", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public string[] GetDomainAliases(string domainName)
{
try
{
Log.WriteStart("'{0}' GetDomainAliases", ProviderSettings.ProviderName);
string[] result = MailProvider.GetDomainAliases(domainName);
Log.WriteEnd("'{0}' GetDomainAliases", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DomainAliasExists", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void AddDomainAlias(string domainName, string aliasName)
{
try
{
Log.WriteStart("'{0}' AddDomainAlias", ProviderSettings.ProviderName);
MailProvider.AddDomainAlias(domainName, aliasName);
Log.WriteEnd("'{0}' AddDomainAlias", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' AddDomainAlias", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteDomainAlias(string domainName, string aliasName)
{
try
{
Log.WriteStart("'{0}' DeleteDomainAlias", ProviderSettings.ProviderName);
MailProvider.DeleteDomainAlias(domainName, aliasName);
Log.WriteEnd("'{0}' DeleteDomainAlias", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteDomainAlias", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region Accounts
[WebMethod, SoapHeader("settings")]
public bool AccountExists(string accountName)
{
try
{
Log.WriteStart("'{0}' AccountExists", ProviderSettings.ProviderName);
bool result = MailProvider.AccountExists(accountName);
Log.WriteEnd("'{0}' AccountExists", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' AccountExists", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public MailAccount[] GetAccounts(string domainName)
{
try
{
Log.WriteStart("'{0}' GetAccounts", ProviderSettings.ProviderName);
MailAccount[] result = MailProvider.GetAccounts(domainName);
Log.WriteEnd("'{0}' GetAccounts", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetAccounts", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public MailAccount GetAccount(string accountName)
{
try
{
Log.WriteStart("'{0}' GetAccount", ProviderSettings.ProviderName);
MailAccount result = MailProvider.GetAccount(accountName);
Log.WriteEnd("'{0}' GetAccount", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetAccount", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void CreateAccount(MailAccount account)
{
try
{
Log.WriteStart("'{0}' CreateAccount", ProviderSettings.ProviderName);
MailProvider.CreateAccount(account);
Log.WriteEnd("'{0}' CreateAccount", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CreateAccount", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void UpdateAccount(MailAccount account)
{
try
{
Log.WriteStart("'{0}' UpdateAccount", ProviderSettings.ProviderName);
MailProvider.UpdateAccount(account);
Log.WriteEnd("'{0}' UpdateAccount", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UpdateAccount", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteAccount(string accountName)
{
try
{
Log.WriteStart("'{0}' DeleteAccount", ProviderSettings.ProviderName);
MailProvider.DeleteAccount(accountName);
Log.WriteEnd("'{0}' DeleteAccount", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteAccount", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region Mail Aliases
[WebMethod, SoapHeader("settings")]
public bool MailAliasExists(string mailAliasName)
{
try
{
Log.WriteStart("'{0}' MailAliasExists", ProviderSettings.ProviderName);
bool result = MailProvider.MailAliasExists(mailAliasName);
Log.WriteEnd("'{0}' MailAliasExists", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' MailAliasExists", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public MailAlias[] GetMailAliases(string domainName)
{
try
{
Log.WriteStart("'{0}' GetMailAliases", ProviderSettings.ProviderName);
MailAlias[] result = MailProvider.GetMailAliases(domainName);
Log.WriteEnd("'{0}' GetMailAliases", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetMailAliases", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public MailAlias GetMailAlias(string mailAliasName)
{
try
{
Log.WriteStart("'{0}' GetMailAlias", ProviderSettings.ProviderName);
MailAlias result = MailProvider.GetMailAlias(mailAliasName);
Log.WriteEnd("'{0}' GetMailAlias", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetMailAlias", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void CreateMailAlias(MailAlias mailAlias)
{
try
{
Log.WriteStart("'{0}' CreateMailAlias", ProviderSettings.ProviderName);
MailProvider.CreateMailAlias(mailAlias);
Log.WriteEnd("'{0}' CreateMailAlias", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CreateMailAlias", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void UpdateMailAlias(MailAlias mailAlias)
{
try
{
Log.WriteStart("'{0}' UpdateMailAlias", ProviderSettings.ProviderName);
MailProvider.UpdateMailAlias(mailAlias);
Log.WriteEnd("'{0}' UpdateMailAlias", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UpdateMailAlias", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteMailAlias(string mailAliasName)
{
try
{
Log.WriteStart("'{0}' DeleteMailAlias", ProviderSettings.ProviderName);
MailProvider.DeleteMailAlias(mailAliasName);
Log.WriteEnd("'{0}' DeleteMailAlias", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteMailAlias", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region Groups
[WebMethod, SoapHeader("settings")]
public bool GroupExists(string groupName)
{
try
{
Log.WriteStart("'{0}' GroupExists", ProviderSettings.ProviderName);
bool result = MailProvider.GroupExists(groupName);
Log.WriteEnd("'{0}' GroupExists", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GroupExists", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public MailGroup[] GetGroups(string domainName)
{
try
{
Log.WriteStart("'{0}' GetGroups", ProviderSettings.ProviderName);
MailGroup[] result = MailProvider.GetGroups(domainName);
Log.WriteEnd("'{0}' GetGroups", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetGroups", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public MailGroup GetGroup(string groupName)
{
try
{
Log.WriteStart("'{0}' GetGroup", ProviderSettings.ProviderName);
MailGroup result = MailProvider.GetGroup(groupName);
Log.WriteEnd("'{0}' GetGroup", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetGroup", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void CreateGroup(MailGroup group)
{
try
{
Log.WriteStart("'{0}' CreateGroup", ProviderSettings.ProviderName);
MailProvider.CreateGroup(group);
Log.WriteEnd("'{0}' CreateGroup", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CreateGroup", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void UpdateGroup(MailGroup group)
{
try
{
Log.WriteStart("'{0}' UpdateGroup", ProviderSettings.ProviderName);
MailProvider.UpdateGroup(group);
Log.WriteEnd("'{0}' UpdateGroup", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UpdateGroup", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteGroup(string groupName)
{
try
{
Log.WriteStart("'{0}' DeleteGroup", ProviderSettings.ProviderName);
MailProvider.DeleteGroup(groupName);
Log.WriteEnd("'{0}' DeleteGroup", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteGroup", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region Lists
[WebMethod, SoapHeader("settings")]
public bool ListExists(string listName)
{
try
{
Log.WriteStart("'{0}' ListExists", ProviderSettings.ProviderName);
bool result = MailProvider.ListExists(listName);
Log.WriteEnd("'{0}' ListExists", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ListExists", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public MailList[] GetLists(string domainName)
{
try
{
Log.WriteStart("'{0}' GetLists", ProviderSettings.ProviderName);
MailList[] result = MailProvider.GetLists(domainName);
Log.WriteEnd("'{0}' GetLists", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetLists", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public MailList GetList(string listName)
{
try
{
Log.WriteStart("'{0}' GetList", ProviderSettings.ProviderName);
MailList result = MailProvider.GetList(listName);
Log.WriteEnd("'{0}' GetList", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetList", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void CreateList(MailList list)
{
try
{
Log.WriteStart("'{0}' CreateList", ProviderSettings.ProviderName);
MailProvider.CreateList(list);
Log.WriteEnd("'{0}' CreateList", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CreateList", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void UpdateList(MailList list)
{
try
{
Log.WriteStart("'{0}' UpdateList", ProviderSettings.ProviderName);
MailProvider.UpdateList(list);
Log.WriteEnd("'{0}' UpdateList", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UpdateList", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteList(string listName)
{
try
{
Log.WriteStart("'{0}' DeleteList", ProviderSettings.ProviderName);
MailProvider.DeleteList(listName);
Log.WriteEnd("'{0}' DeleteList", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteList", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
}
}

View file

@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="OCSEdgeServer.asmx.cs" Class="WebsitePanel.Server.OCSEdgeServer" %>

View file

@ -0,0 +1,91 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.ComponentModel;
using System.Web.Services;
using System.Web.Services.Protocols;
using WebsitePanel.Providers;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Server.Utils;
using Microsoft.Web.Services3;
namespace WebsitePanel.Server
{
/// <summary>
/// OCS Web Service
/// </summary>
[WebService(Namespace = "http://smbsaas/websitepanel/server/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Policy("ServerPolicy")]
[ToolboxItem(false)]
public class OCSEdgeServer : HostingServiceProviderWebService
{
private IOCSEdgeServer OCS
{
get { return (IOCSEdgeServer)Provider; }
}
#region Domains
[WebMethod, SoapHeader("settings")]
public void AddDomain(string domainName)
{
try
{
Log.WriteStart("{0}.AddDomain", ProviderSettings.ProviderName);
OCS.AddDomain(domainName);
Log.WriteEnd("{0}.AddDomain", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("Error: {0}.AddDomain", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteDomain(string domainName)
{
try
{
Log.WriteStart("{0}.DeleteDomain", ProviderSettings.ProviderName);
OCS.DeleteDomain(domainName);
Log.WriteEnd("{0}.DeleteDomain", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("Error: {0}.DeleteDomain", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
}
}

View file

@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="OCSServer.asmx.cs" Class="WebsitePanel.Server.OCSServer" %>

View file

@ -0,0 +1,146 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.ComponentModel;
using System.Web.Services;
using System.Web.Services.Protocols;
using WebsitePanel.Providers;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Server.Utils;
using Microsoft.Web.Services3;
namespace WebsitePanel.Server
{
/// <summary>
/// OCS Web Service
/// </summary>
[WebService(Namespace = "http://smbsaas/websitepanel/server/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Policy("ServerPolicy")]
[ToolboxItem(false)]
public class OCSServer : HostingServiceProviderWebService
{
private IOCSServer OCS
{
get { return (IOCSServer)Provider; }
}
#region Users
[WebMethod, SoapHeader("settings")]
public string CreateUser(string userUpn, string userDistinguishedName)
{
try
{
Log.WriteStart("{0}.CreateUser", ProviderSettings.ProviderName);
string ret = OCS.CreateUser(userUpn, userDistinguishedName);
Log.WriteEnd("{0}.CreateUser", ProviderSettings.ProviderName);
return ret;
}
catch (Exception ex)
{
Log.WriteError(String.Format("Error: {0}.CreateUser", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public OCSUser GetUserGeneralSettings(string instanceId)
{
try
{
Log.WriteStart("{0}.GetUserGeneralSettings", ProviderSettings.ProviderName);
OCSUser ret = OCS.GetUserGeneralSettings(instanceId);
Log.WriteEnd("{0}.GetUserGeneralSettings", ProviderSettings.ProviderName);
return ret;
}
catch (Exception ex)
{
Log.WriteError(String.Format("Error: {0}.GetUserGeneralSettings", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void SetUserGeneralSettings(string instanceId, bool enabledForFederation, bool enabledForPublicIMConectivity, bool archiveInternalCommunications, bool archiveFederatedCommunications, bool enabledForEnhancedPresence)
{
try
{
Log.WriteStart("{0}.SetUserGeneralSettings", ProviderSettings.ProviderName);
OCS.SetUserGeneralSettings(instanceId, enabledForFederation, enabledForPublicIMConectivity, archiveInternalCommunications, archiveFederatedCommunications, enabledForEnhancedPresence);
Log.WriteEnd("{0}.SetUserGeneralSettings", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("Error: {0}.SetUserGeneralSettings", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteUser(string instanceId)
{
try
{
Log.WriteStart("{0}.DeleteUser", ProviderSettings.ProviderName);
OCS.DeleteUser(instanceId);
Log.WriteEnd("{0}.DeleteUser", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("Error: {0}.DeleteUser", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void SetUserPrimaryUri(string instanceId, string userUpn)
{
try
{
Log.WriteStart("{0}.SetUserPrimaryUri", ProviderSettings.ProviderName);
OCS.SetUserPrimaryUri(instanceId, userUpn);
Log.WriteEnd("{0}.SetUserPrimaryUri", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("Error: {0}.SetUserPrimaryUri", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
}
}

View file

@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="OperatingSystem.asmx.cs" Class="WebsitePanel.Server.OperatingSystem" %>

View file

@ -0,0 +1,674 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using Microsoft.Web.Services3;
using WebsitePanel.Providers;
using WebsitePanel.Providers.OS;
using WebsitePanel.Server.Utils;
namespace WebsitePanel.Server
{
/// <summary>
/// Summary description for OperatingSystem
/// </summary>
[WebService(Namespace = "http://smbsaas/websitepanel/server/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Policy("ServerPolicy")]
[ToolboxItem(false)]
public class OperatingSystem : HostingServiceProviderWebService, IOperatingSystem
{
private IOperatingSystem OsProvider
{
get { return (IOperatingSystem)Provider; }
}
#region Files
[WebMethod, SoapHeader("settings")]
public string CreatePackageFolder(string initialPath)
{
try
{
Log.WriteStart("'{0}' CreatePackageFolder", ProviderSettings.ProviderName);
string result = OsProvider.CreatePackageFolder(initialPath);
Log.WriteEnd("'{0}' CreatePackageFolder", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CreatePackageFolder", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public bool FileExists(string path)
{
try
{
Log.WriteStart("'{0}' FileExists", ProviderSettings.ProviderName);
bool result = OsProvider.FileExists(path);
Log.WriteEnd("'{0}' FileExists", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' FileExists", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public bool DirectoryExists(string path)
{
try
{
Log.WriteStart("'{0}' DirectoryExists", ProviderSettings.ProviderName);
bool result = OsProvider.DirectoryExists(path);
Log.WriteEnd("'{0}' DirectoryExists", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DirectoryExists", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public SystemFile GetFile(string path)
{
try
{
Log.WriteStart("'{0}' GetFile", ProviderSettings.ProviderName);
SystemFile result = OsProvider.GetFile(path);
Log.WriteEnd("'{0}' GetFile", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetFile", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public SystemFile[] GetFiles(string path)
{
try
{
Log.WriteStart("'{0}' GetFiles", ProviderSettings.ProviderName);
SystemFile[] result = OsProvider.GetFiles(path);
Log.WriteEnd("'{0}' GetFiles", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetFiles", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public SystemFile[] GetDirectoriesRecursive(string rootFolder, string path)
{
try
{
Log.WriteStart("'{0}' GetDirectoriesRecursive", ProviderSettings.ProviderName);
SystemFile[] result = OsProvider.GetDirectoriesRecursive(rootFolder, path);
Log.WriteEnd("'{0}' GetDirectoriesRecursive", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetDirectoriesRecursive", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public SystemFile[] GetFilesRecursive(string rootFolder, string path)
{
try
{
Log.WriteStart("'{0}' GetFilesRecursive", ProviderSettings.ProviderName);
SystemFile[] result = OsProvider.GetFilesRecursive(rootFolder, path);
Log.WriteEnd("'{0}' GetFilesRecursive", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetFilesRecursive", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public SystemFile[] GetFilesRecursiveByPattern(string rootFolder, string path, string pattern)
{
try
{
Log.WriteStart("'{0}' GetFilesRecursiveByPattern", ProviderSettings.ProviderName);
SystemFile[] result = OsProvider.GetFilesRecursiveByPattern(rootFolder, path, pattern);
Log.WriteEnd("'{0}' GetFilesRecursiveByPattern", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetFilesRecursiveByPattern", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public byte[] GetFileBinaryContent(string path)
{
try
{
Log.WriteStart("'{0}' GetFileBinaryContent", ProviderSettings.ProviderName);
byte[] result = OsProvider.GetFileBinaryContent(path);
Log.WriteEnd("'{0}' GetFileBinaryContent", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetFileBinaryContent", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public byte[] GetFileBinaryContentUsingEncoding(string path, string encoding)
{
try
{
Log.WriteStart("'{0}' GetFileBinaryContentUsingEncoding", ProviderSettings.ProviderName);
byte[] result = OsProvider.GetFileBinaryContentUsingEncoding(path, encoding);
Log.WriteEnd("'{0}' GetFileBinaryContentUsingEncoding", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetFileBinaryContentUsingEncoding", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public byte[] GetFileBinaryChunk(string path, int offset, int length)
{
try
{
Log.WriteStart("'{0}' GetFileBinaryChunk", ProviderSettings.ProviderName);
byte[] result = OsProvider.GetFileBinaryChunk(path, offset, length);
Log.WriteEnd("'{0}' GetFileBinaryChunk", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetFileBinaryContent", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public string GetFileTextContent(string path)
{
try
{
Log.WriteStart("'{0}' GetFileTextContent", ProviderSettings.ProviderName);
string result = OsProvider.GetFileTextContent(path);
Log.WriteEnd("'{0}' GetFileTextContent", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetFileTextContent", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void CreateFile(string path)
{
try
{
Log.WriteStart("'{0}' CreateFile", ProviderSettings.ProviderName);
OsProvider.CreateFile(path);
Log.WriteEnd("'{0}' CreateFile", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CreateFile", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void CreateDirectory(string path)
{
try
{
Log.WriteStart("'{0}' CreateDirectory", ProviderSettings.ProviderName);
OsProvider.CreateDirectory(path);
Log.WriteEnd("'{0}' CreateDirectory", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CreateDirectory", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void ChangeFileAttributes(string path, DateTime createdTime, DateTime changedTime)
{
try
{
Log.WriteStart("'{0}' ChangeFileAttributes", ProviderSettings.ProviderName);
OsProvider.ChangeFileAttributes(path, createdTime, changedTime);
Log.WriteEnd("'{0}' ChangeFileAttributes", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ChangeFileAttributes", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteFile(string path)
{
try
{
Log.WriteStart("'{0}' DeleteFile", ProviderSettings.ProviderName);
OsProvider.DeleteFile(path);
Log.WriteEnd("'{0}' DeleteFile", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteFile", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteFiles(string[] files)
{
try
{
Log.WriteStart("'{0}' DeleteFiles", ProviderSettings.ProviderName);
OsProvider.DeleteFiles(files);
Log.WriteEnd("'{0}' DeleteFiles", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteFiles", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteEmptyDirectories(string[] directories)
{
try
{
Log.WriteStart("'{0}' DeleteEmptyDirectories", ProviderSettings.ProviderName);
OsProvider.DeleteEmptyDirectories(directories);
Log.WriteEnd("'{0}' DeleteEmptyDirectories", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteEmptyDirectories", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void UpdateFileBinaryContent(string path, byte[] content)
{
try
{
Log.WriteStart("'{0}' UpdateFileBinaryContent", ProviderSettings.ProviderName);
OsProvider.UpdateFileBinaryContent(path, content);
Log.WriteEnd("'{0}' UpdateFileBinaryContent", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UpdateFileBinaryContent", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void UpdateFileBinaryContentUsingEncoding(string path, byte[] content, string encoding)
{
try
{
Log.WriteStart("'{0}' UpdateFileBinaryContentUsingEncoding", ProviderSettings.ProviderName);
OsProvider.UpdateFileBinaryContentUsingEncoding(path, content, encoding);
Log.WriteEnd("'{0}' UpdateFileBinaryContentUsingEncoding", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UpdateFileBinaryContentUsingEncoding", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void AppendFileBinaryContent(string path, byte[] chunk)
{
try
{
Log.WriteStart("'{0}' AppendFileBinaryContent", ProviderSettings.ProviderName);
OsProvider.AppendFileBinaryContent(path, chunk);
Log.WriteEnd("'{0}' AppendFileBinaryContent", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' AppendFileBinaryContent", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void UpdateFileTextContent(string path, string content)
{
try
{
Log.WriteStart("'{0}' UpdateFileTextContent", ProviderSettings.ProviderName);
OsProvider.UpdateFileTextContent(path, content);
Log.WriteEnd("'{0}' UpdateFileTextContent", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UpdateFileTextContent", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void MoveFile(string sourcePath, string destinationPath)
{
try
{
Log.WriteStart("'{0}' MoveFile", ProviderSettings.ProviderName);
OsProvider.MoveFile(sourcePath, destinationPath);
Log.WriteEnd("'{0}' MoveFile", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' MoveFile", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void CopyFile(string sourcePath, string destinationPath)
{
try
{
Log.WriteStart("'{0}' CopyFile", ProviderSettings.ProviderName);
OsProvider.CopyFile(sourcePath, destinationPath);
Log.WriteEnd("'{0}' CopyFile", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CopyFile", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void ZipFiles(string zipFile, string rootPath, string[] files)
{
try
{
Log.WriteStart("'{0}' ZipFiles", ProviderSettings.ProviderName);
OsProvider.ZipFiles(zipFile, rootPath, files);
Log.WriteEnd("'{0}' ZipFiles", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ZipFiles", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public string[] UnzipFiles(string zipFile, string destFolder)
{
try
{
Log.WriteStart("'{0}' UnzipFiles", ProviderSettings.ProviderName);
string[] result = OsProvider.UnzipFiles(zipFile, destFolder);
Log.WriteEnd("'{0}' UnzipFiles", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UnzipFiles", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void CreateAccessDatabase(string databasePath)
{
try
{
Log.WriteStart("'{0}' CreateAccessDatabase", ProviderSettings.ProviderName);
OsProvider.CreateAccessDatabase(databasePath);
Log.WriteEnd("'{0}' CreateAccessDatabase", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CreateAccessDatabase", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public UserPermission[] GetGroupNtfsPermissions(string path, UserPermission[] users, string usersOU)
{
try
{
Log.WriteStart("'{0}' GetGroupNtfsPermissions", ProviderSettings.ProviderName);
UserPermission[] result = OsProvider.GetGroupNtfsPermissions(path, users, usersOU);
Log.WriteEnd("'{0}' GetGroupNtfsPermissions", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetGroupNtfsPermissions", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void GrantGroupNtfsPermissions(string path, UserPermission[] users, string usersOU, bool resetChildPermissions)
{
try
{
Log.WriteStart("'{0}' GrantGroupNtfsPermissions", ProviderSettings.ProviderName);
OsProvider.GrantGroupNtfsPermissions(path, users, usersOU, resetChildPermissions);
Log.WriteEnd("'{0}' GrantGroupNtfsPermissions", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GrantGroupNtfsPermissions", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region Synchronizing
[WebMethod, SoapHeader("settings")]
public FolderGraph GetFolderGraph(string path)
{
try
{
Log.WriteStart("'{0}' GetFolderGraph", ProviderSettings.ProviderName);
FolderGraph result = OsProvider.GetFolderGraph(path);
Log.WriteEnd("'{0}' GetFolderGraph", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetFolderGraph", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void ExecuteSyncActions(FileSyncAction[] actions)
{
try
{
Log.WriteStart("'{0}' ExecuteSyncActions", ProviderSettings.ProviderName);
OsProvider.ExecuteSyncActions(actions);
Log.WriteEnd("'{0}' ExecuteSyncActions", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ExecuteSyncActions", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region ODBC DSNs
[WebMethod, SoapHeader("settings")]
public string[] GetInstalledOdbcDrivers()
{
try
{
Log.WriteStart("'{0}' GetInstalledOdbcDrivers", ProviderSettings.ProviderName);
string[] result = OsProvider.GetInstalledOdbcDrivers();
Log.WriteEnd("'{0}' GetInstalledOdbcDrivers", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetInstalledOdbcDrivers", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public string[] GetDSNNames()
{
try
{
Log.WriteStart("'{0}' GetDSNNames", ProviderSettings.ProviderName);
string[] result = OsProvider.GetDSNNames();
Log.WriteEnd("'{0}' GetDSNNames", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetDSNNames", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public SystemDSN GetDSN(string dsnName)
{
try
{
Log.WriteStart("'{0}' GetDSN", ProviderSettings.ProviderName);
SystemDSN result = OsProvider.GetDSN(dsnName);
Log.WriteEnd("'{0}' GetDSN", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetDSN", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void CreateDSN(SystemDSN dsn)
{
try
{
Log.WriteStart("'{0}' CreateDSN", ProviderSettings.ProviderName);
OsProvider.CreateDSN(dsn);
Log.WriteEnd("'{0}' CreateDSN", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CreateDSN", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void UpdateDSN(SystemDSN dsn)
{
try
{
Log.WriteStart("'{0}' UpdateDSN", ProviderSettings.ProviderName);
OsProvider.UpdateDSN(dsn);
Log.WriteEnd("'{0}' UpdateDSN", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UpdateDSN", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteDSN(string dsnName)
{
try
{
Log.WriteStart("'{0}' DeleteDSN", ProviderSettings.ProviderName);
OsProvider.DeleteDSN(dsnName);
Log.WriteEnd("'{0}' DeleteDSN", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteDSN", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
}
}

View file

@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="Organizations.asmx.cs" Class="WebsitePanel.Server.Organizations" %>

View file

@ -0,0 +1,151 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.ComponentModel;
using System.Web.Services;
using System.Web.Services.Protocols;
using WebsitePanel.Providers;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.ResultObjects;
using WebsitePanel.Server.Utils;
namespace WebsitePanel.Server
{
/// <summary>
/// Summary description for Organizations
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
public class Organizations : HostingServiceProviderWebService
{
private IOrganization Organization
{
get { return (IOrganization)Provider; }
}
[WebMethod, SoapHeader("settings")]
public bool OrganizationExists(string organizationId)
{
try
{
Log.WriteStart("'{0}' OrganizationExists", ProviderSettings.ProviderName);
bool ret = Organization.OrganizationExists(organizationId);
Log.WriteEnd("'{0}' OrganizationExists", ProviderSettings.ProviderName);
return ret;
}
catch (Exception ex)
{
Log.WriteError(String.Format("Can't CreateOrganization '{0}' provider", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public Organization CreateOrganization(string organizationId)
{
try
{
Log.WriteStart("'{0}' CreateOrganization", ProviderSettings.ProviderName);
Organization ret = Organization.CreateOrganization(organizationId);
Log.WriteEnd("'{0}' CreateOrganization", ProviderSettings.ProviderName);
return ret;
}
catch (Exception ex)
{
Log.WriteError(String.Format("Can't CreateOrganization '{0}' provider", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteOrganization(string organizationId)
{
Organization.DeleteOrganization(organizationId);
}
[WebMethod, SoapHeader("settings")]
public void CreateUser(string organizationId, string loginName, string displayName, string upn, string password, bool enabled)
{
Log.WriteStart("'{0} CreateUser", ProviderSettings.ProviderName);
Organization.CreateUser(organizationId, loginName, displayName, upn, password, enabled);
Log.WriteEnd("'{0}' CreateUser", ProviderSettings.ProviderName);
}
[WebMethod, SoapHeader("settings")]
public void DeleteUser(string loginName, string organizationId)
{
Organization.DeleteUser(loginName, organizationId);
}
[WebMethod, SoapHeader("settings")]
public OrganizationUser GeUserGeneralSettings(string loginName, string organizationId)
{
return Organization.GetUserGeneralSettings(loginName, organizationId);
}
[WebMethod, SoapHeader("settings")]
public void SetUserGeneralSettings(string organizationId, string accountName, string displayName, string password,
bool hideFromAddressBook, bool disabled, bool locked, string firstName, string initials, string lastName,
string address, string city, string state, string zip, string country, string jobTitle,
string company, string department, string office, string managerAccountName,
string businessPhone, string fax, string homePhone, string mobilePhone, string pager,
string webPage, string notes, string externalEmail)
{
Organization.SetUserGeneralSettings(organizationId, accountName, displayName, password, hideFromAddressBook,
disabled, locked, firstName, initials, lastName, address, city, state, zip, country, jobTitle,
company, department, office, managerAccountName, businessPhone, fax, homePhone,
mobilePhone, pager, webPage, notes, externalEmail);
}
[WebMethod, SoapHeader("settings")]
public void DeleteOrganizationDomain(string organizationDistinguishedName, string domain)
{
Organization.DeleteOrganizationDomain(organizationDistinguishedName, domain);
}
[WebMethod, SoapHeader("settings")]
public void CreateOrganizationDomain(string organizationDistinguishedName, string domain)
{
Organization.CreateOrganizationDomain(organizationDistinguishedName, domain);
}
[WebMethod, SoapHeader("settings")]
public PasswordPolicyResult GetPasswordPolicy()
{
return Organization.GetPasswordPolicy();
}
}
}

View file

@ -0,0 +1,25 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Web.UI;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WebsitePanel.Server")]
[assembly: AssemblyProduct("WebsitePanel.Server")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")]
// embedded resources
[assembly: WebResource("WebsitePanel.Server.Images.logo.png", "image/png")]

View file

@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="ServiceProvider.asmx.cs" Class="WebsitePanel.Server.ServiceProvider" %>

View file

@ -0,0 +1,206 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using Microsoft.Web.Services3;
using WebsitePanel.Providers;
using WebsitePanel.Server.Utils;
namespace WebsitePanel.Server
{
/// <summary>
/// Summary description for ServiceProvider
/// </summary>
[WebService(Namespace = "http://smbsaas/websitepanel/server/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Policy("ServerPolicy")]
[ToolboxItem(false)]
public class ServiceProvider : HostingServiceProviderWebService
{
[WebMethod, SoapHeader("settings")]
public string[] Install()
{
try
{
Log.WriteStart("'{0}' Install", ProviderSettings.ProviderName);
return Provider.Install();
}
catch (Exception ex)
{
Log.WriteError(String.Format("Can't Install '{0}' provider", ProviderSettings.ProviderName), ex);
throw;
}
finally
{
Log.WriteEnd("'{0}' Install", ProviderSettings.ProviderName);
}
}
[WebMethod, SoapHeader("settings")]
public SettingPair[] GetProviderDefaultSettings()
{
try
{
Log.WriteStart("'{0}' GetProviderDefaultSettings", ProviderSettings.ProviderName);
return Provider.GetProviderDefaultSettings();
}
catch (Exception ex)
{
Log.WriteError(String.Format("Can't GetProviderDefaultSettings '{0}' provider", ProviderSettings.ProviderName), ex);
throw;
}
finally
{
Log.WriteEnd("'{0}' GetProviderDefaultSettings", ProviderSettings.ProviderName);
}
}
[WebMethod, SoapHeader("settings")]
public void Uninstall()
{
try
{
Log.WriteStart("'{0}' Uninstall", ProviderSettings.ProviderName);
Provider.Uninstall();
Log.WriteEnd("'{0}' Uninstall", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("Can't Uninstall '{0}' provider", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public bool IsInstalled()
{
try
{
Log.WriteStart("'{0}' IsInstalled", ProviderSettings.ProviderName);
return Provider.IsInstalled();
}
catch (Exception ex)
{
Log.WriteError(String.Format("Can't check '{0}' provider IsInstalled", ProviderSettings.ProviderName), ex);
throw;
}
finally
{
Log.WriteEnd("'{0}' IsInstalled", ProviderSettings.ProviderName);
}
}
[WebMethod, SoapHeader("settings")]
public void ChangeServiceItemsState(SoapServiceProviderItem[] items, bool enabled)
{
try
{
Log.WriteStart("'{0}' ChangeServiceItemsState", ProviderSettings.ProviderName);
Provider.ChangeServiceItemsState(UnwrapServiceProviderItems(items), enabled);
Log.WriteEnd("'{0}' ChangeServiceItemsState", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("Error on ChangeServiceItemsState() in '{0}' provider", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteServiceItems(SoapServiceProviderItem[] items)
{
try
{
Log.WriteStart("'{0}' DeleteServiceItems", ProviderSettings.ProviderName);
Provider.DeleteServiceItems(UnwrapServiceProviderItems(items));
Log.WriteEnd("'{0}' DeleteServiceItems", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("Error on DeleteServiceItems() in '{0}' provider", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public ServiceProviderItemDiskSpace[] GetServiceItemsDiskSpace(SoapServiceProviderItem[] items)
{
try
{
Log.WriteStart("'{0}' GetServiceItemsDiskSpace", ProviderSettings.ProviderName);
return Provider.GetServiceItemsDiskSpace(UnwrapServiceProviderItems(items));
}
catch (Exception ex)
{
Log.WriteError(String.Format("Error on GetServiceItemsDiskSpace() in '{0}' provider", ProviderSettings.ProviderName), ex);
throw;
}
finally
{
Log.WriteEnd("'{0}' GetServiceItemsDiskSpace", ProviderSettings.ProviderName);
}
}
[WebMethod, SoapHeader("settings")]
public ServiceProviderItemBandwidth[] GetServiceItemsBandwidth(SoapServiceProviderItem[] items, DateTime since)
{
try
{
Log.WriteStart("'{0}' GetServiceItemsBandwidth", ProviderSettings.ProviderName);
return Provider.GetServiceItemsBandwidth(UnwrapServiceProviderItems(items), since);
}
catch (Exception ex)
{
Log.WriteError(String.Format("Error on GetServiceItemsBandwidth() in '{0}' provider", ProviderSettings.ProviderName), ex);
throw;
}
finally
{
Log.WriteEnd("'{0}' GetServiceItemsBandwidth", ProviderSettings.ProviderName);
}
}
private ServiceProviderItem[] UnwrapServiceProviderItems(SoapServiceProviderItem[] soapItems)
{
if (soapItems == null)
return null;
ServiceProviderItem[] items = new ServiceProviderItem[soapItems.Length];
for (int i = 0; i < items.Length; i++)
items[i] = SoapServiceProviderItem.Unwrap(soapItems[i]);
return items;
}
}
}

View file

@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="SharePointServer.asmx.cs" Class="WebsitePanel.Server.SharePointServer" %>

View file

@ -0,0 +1,431 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using Microsoft.Web.Services3;
using WebsitePanel.Providers;
using WebsitePanel.Providers.OS;
using WebsitePanel.Providers.SharePoint;
using WebsitePanel.Server.Utils;
namespace WebsitePanel.Server
{
/// <summary>
/// Summary description for SharePointServer
/// </summary>
[WebService(Namespace = "http://smbsaas/websitepanel/server/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Policy("ServerPolicy")]
[ToolboxItem(false)]
public class SharePointServer : HostingServiceProviderWebService
{
private ISharePointServer SPS
{
get { return (ISharePointServer)Provider; }
}
#region Sites
[WebMethod, SoapHeader("settings")]
public void ExtendVirtualServer(SharePointSite site)
{
try
{
Log.WriteStart("'{0}' ExtendVirtualServer", ProviderSettings.ProviderName);
SPS.ExtendVirtualServer(site);
Log.WriteEnd("'{0}' ExtendVirtualServer", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("Can't ExtendVirtualServer '{0}' provider", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void UnextendVirtualServer(string url, bool deleteContent)
{
try
{
Log.WriteStart("'{0}' GetProviderProperties", ProviderSettings.ProviderName);
SPS.UnextendVirtualServer(url, deleteContent);
Log.WriteEnd("'{0}' GetProviderProperties", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("Can't GetProviderProperties '{0}' provider", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region Backup/Restore
[WebMethod, SoapHeader("settings")]
public string BackupVirtualServer(string url, string fileName, bool zipBackup)
{
try
{
Log.WriteStart("'{0}' BackupVirtualServer", ProviderSettings.ProviderName);
string result = SPS.BackupVirtualServer(url, fileName, zipBackup);
Log.WriteEnd("'{0}' BackupVirtualServer", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("Can't BackupVirtualServer '{0}' provider", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void RestoreVirtualServer(string url, string fileName)
{
try
{
Log.WriteStart("'{0}' RestoreVirtualServer", ProviderSettings.ProviderName);
SPS.RestoreVirtualServer(url, fileName);
Log.WriteEnd("'{0}' RestoreVirtualServer", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("Can't RestoreVirtualServer '{0}' provider", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public byte[] GetTempFileBinaryChunk(string path, int offset, int length)
{
try
{
Log.WriteStart("'{0}' GetTempFileBinaryChunk", ProviderSettings.ProviderName);
byte[] result = SPS.GetTempFileBinaryChunk(path, offset, length);
Log.WriteEnd("'{0}' GetTempFileBinaryChunk", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("Can't GetTempFileBinaryChunk '{0}' provider", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public string AppendTempFileBinaryChunk(string fileName, string path, byte[] chunk)
{
try
{
Log.WriteStart("'{0}' AppendTempFileBinaryChunk", ProviderSettings.ProviderName);
string result = SPS.AppendTempFileBinaryChunk(fileName, path, chunk);
Log.WriteEnd("'{0}' AppendTempFileBinaryChunk", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("Can't AppendTempFileBinaryChunk '{0}' provider", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region Web Parts
[WebMethod, SoapHeader("settings")]
public string[] GetInstalledWebParts(string url)
{
try
{
Log.WriteStart("'{0}' GetInstalledWebParts", ProviderSettings.ProviderName);
string[] result = SPS.GetInstalledWebParts(url);
Log.WriteEnd("'{0}' GetInstalledWebParts", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("Can't GetInstalledWebParts '{0}' provider", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void InstallWebPartsPackage(string url, string packageName)
{
try
{
Log.WriteStart("'{0}' InstallWebPartsPackage", ProviderSettings.ProviderName);
SPS.InstallWebPartsPackage(url, packageName);
Log.WriteEnd("'{0}' InstallWebPartsPackage", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("Can't InstallWebPartsPackage '{0}' provider", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteWebPartsPackage(string url, string packageName)
{
try
{
Log.WriteStart("'{0}' DeleteWebPartsPackage", ProviderSettings.ProviderName);
SPS.DeleteWebPartsPackage(url, packageName);
Log.WriteEnd("'{0}' DeleteWebPartsPackage", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("Can't DeleteWebPartsPackage '{0}' provider", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region Users
[WebMethod, SoapHeader("settings")]
public bool UserExists(string username)
{
try
{
Log.WriteStart("'{0}' UserExists", ProviderSettings.ProviderName);
bool result = SPS.UserExists(username);
Log.WriteEnd("'{0}' UserExists", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UserExists", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public string[] GetUsers()
{
try
{
Log.WriteStart("'{0}' GetUsers", ProviderSettings.ProviderName);
string[] result = SPS.GetUsers();
Log.WriteEnd("'{0}' GetUsers", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetUsers", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public SystemUser GetUser(string username)
{
try
{
Log.WriteStart("'{0}' GetUser", ProviderSettings.ProviderName);
SystemUser result = SPS.GetUser(username);
Log.WriteEnd("'{0}' GetUser", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetUser", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void CreateUser(SystemUser user)
{
try
{
Log.WriteStart("'{0}' CreateUser", ProviderSettings.ProviderName);
SPS.CreateUser(user);
Log.WriteEnd("'{0}' CreateUser", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CreateUser", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void UpdateUser(SystemUser user)
{
try
{
Log.WriteStart("'{0}' UpdateUser", ProviderSettings.ProviderName);
SPS.UpdateUser(user);
Log.WriteEnd("'{0}' UpdateUser", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UpdateUser", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void ChangeUserPassword(string username, string password)
{
try
{
Log.WriteStart("'{0}' ChangeUserPassword", ProviderSettings.ProviderName);
SPS.ChangeUserPassword(username, password);
Log.WriteEnd("'{0}' ChangeUserPassword", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ChangeUserPassword", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteUser(string username)
{
try
{
Log.WriteStart("'{0}' DeleteUser", ProviderSettings.ProviderName);
SPS.DeleteUser(username);
Log.WriteEnd("'{0}' DeleteUser", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteUser", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region Groups
[WebMethod, SoapHeader("settings")]
public bool GroupExists(string groupName)
{
try
{
Log.WriteStart("'{0}' GroupExists", ProviderSettings.ProviderName);
bool result = SPS.GroupExists(groupName);
Log.WriteEnd("'{0}' GroupExists", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GroupExists", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public string[] GetGroups()
{
try
{
Log.WriteStart("'{0}' GetGroups", ProviderSettings.ProviderName);
string[] result = SPS.GetGroups();
Log.WriteEnd("'{0}' GetGroups", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetGroups", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public SystemGroup GetGroup(string groupName)
{
try
{
Log.WriteStart("'{0}' GetGroup", ProviderSettings.ProviderName);
SystemGroup result = SPS.GetGroup(groupName);
Log.WriteEnd("'{0}' GetGroup", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetGroup", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void CreateGroup(SystemGroup group)
{
try
{
Log.WriteStart("'{0}' CreateGroup", ProviderSettings.ProviderName);
SPS.CreateGroup(group);
Log.WriteEnd("'{0}' CreateGroup", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CreateGroup", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void UpdateGroup(SystemGroup group)
{
try
{
Log.WriteStart("'{0}' UpdateGroup", ProviderSettings.ProviderName);
SPS.UpdateGroup(group);
Log.WriteEnd("'{0}' UpdateGroup", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UpdateGroup", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteGroup(string groupName)
{
try
{
Log.WriteStart("'{0}' DeleteGroup", ProviderSettings.ProviderName);
SPS.DeleteGroup(groupName);
Log.WriteEnd("'{0}' DeleteGroup", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteGroup", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
}
}

View file

@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="StatisticsServer.asmx.cs" Class="WebsitePanel.Server.StatisticsServer" %>

View file

@ -0,0 +1,179 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using Microsoft.Web.Services3;
using WebsitePanel.Providers;
using WebsitePanel.Providers.Statistics;
using WebsitePanel.Server.Utils;
namespace WebsitePanel.Server
{
/// <summary>
/// Summary description for StatisticsServer
/// </summary>
[WebService(Namespace = "http://smbsaas/websitepanel/server/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Policy("ServerPolicy")]
[ToolboxItem(false)]
public class StatisticsServer : HostingServiceProviderWebService, IStatisticsServer
{
private IStatisticsServer StatsProvider
{
get { return (IStatisticsServer)Provider; }
}
#region Sites
[WebMethod, SoapHeader("settings")]
public StatsServer[] GetServers()
{
try
{
Log.WriteStart("'{0}' GetServers", ProviderSettings.ProviderName);
StatsServer[] result = StatsProvider.GetServers();
Log.WriteEnd("'{0}' GetServers", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetServers", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public string GetSiteId(string siteName)
{
try
{
Log.WriteStart("'{0}' GetSiteId", ProviderSettings.ProviderName);
string result = StatsProvider.GetSiteId(siteName);
Log.WriteEnd("'{0}' GetSiteId", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetSiteId", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public string[] GetSites()
{
try
{
Log.WriteStart("'{0}' GetSites", ProviderSettings.ProviderName);
string[] result = StatsProvider.GetSites();
Log.WriteEnd("'{0}' GetSites", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetSites", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public StatsSite GetSite(string siteId)
{
try
{
Log.WriteStart("'{0}' GetSite", ProviderSettings.ProviderName);
StatsSite result = StatsProvider.GetSite(siteId);
Log.WriteEnd("'{0}' GetSite", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetSite", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public string AddSite(StatsSite site)
{
try
{
Log.WriteStart("'{0}' AddSite", ProviderSettings.ProviderName);
string result = StatsProvider.AddSite(site);
Log.WriteEnd("'{0}' AddSite", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' AddSite", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void UpdateSite(StatsSite site)
{
try
{
Log.WriteStart("'{0}' UpdateSite", ProviderSettings.ProviderName);
StatsProvider.UpdateSite(site);
Log.WriteEnd("'{0}' UpdateSite", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UpdateSite", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteSite(string siteId)
{
try
{
Log.WriteStart("'{0}' DeleteSite", ProviderSettings.ProviderName);
StatsProvider.DeleteSite(siteId);
Log.WriteEnd("'{0}' DeleteSite", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteSite", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
}
}

View file

@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="VirtualizationServer.asmx.cs" Class="WebsitePanel.Server.VirtualizationServer" %>

View file

@ -0,0 +1,874 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using Microsoft.Web.Services3;
using WebsitePanel.Providers;
using WebsitePanel.Providers.Virtualization;
using WebsitePanel.Server.Utils;
using System.Collections.Generic;
namespace WebsitePanel.Server
{
/// <summary>
/// Summary description for VirtualizationServer
/// </summary>
[WebService(Namespace = "http://smbsaas/websitepanel/server/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Policy("ServerPolicy")]
[ToolboxItem(false)]
public class VirtualizationServer : HostingServiceProviderWebService, IVirtualizationServer
{
private IVirtualizationServer VirtualizationProvider
{
get { return (IVirtualizationServer)Provider; }
}
#region Virtual Machines
[WebMethod, SoapHeader("settings")]
public VirtualMachine GetVirtualMachine(string vmId)
{
try
{
Log.WriteStart("'{0}' GetVirtualMachine", ProviderSettings.ProviderName);
VirtualMachine result = VirtualizationProvider.GetVirtualMachine(vmId);
Log.WriteEnd("'{0}' GetVirtualMachine", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetVirtualMachine", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public VirtualMachine GetVirtualMachineEx(string vmId)
{
try
{
Log.WriteStart("'{0}' GetVirtualMachineEx", ProviderSettings.ProviderName);
VirtualMachine result = VirtualizationProvider.GetVirtualMachineEx(vmId);
Log.WriteEnd("'{0}' GetVirtualMachineEx", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetVirtualMachineEx", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public List<VirtualMachine> GetVirtualMachines()
{
try
{
Log.WriteStart("'{0}' GetVirtualMachines", ProviderSettings.ProviderName);
List<VirtualMachine> result = VirtualizationProvider.GetVirtualMachines();
Log.WriteEnd("'{0}' GetVirtualMachines", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetVirtualMachines", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public byte[] GetVirtualMachineThumbnailImage(string vmId, ThumbnailSize size)
{
try
{
Log.WriteStart("'{0}' GetVirtualMachineThumbnailImage", ProviderSettings.ProviderName);
byte[] result = VirtualizationProvider.GetVirtualMachineThumbnailImage(vmId, size);
Log.WriteEnd("'{0}' GetVirtualMachineThumbnailImage", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetVirtualMachineThumbnailImage", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public VirtualMachine CreateVirtualMachine(VirtualMachine vm)
{
try
{
Log.WriteStart("'{0}' CreateVirtualMachine", ProviderSettings.ProviderName);
VirtualMachine result = VirtualizationProvider.CreateVirtualMachine(vm);
Log.WriteEnd("'{0}' CreateVirtualMachine", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CreateVirtualMachine", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public VirtualMachine UpdateVirtualMachine(VirtualMachine vm)
{
try
{
Log.WriteStart("'{0}' UpdateVirtualMachine", ProviderSettings.ProviderName);
VirtualMachine result = VirtualizationProvider.UpdateVirtualMachine(vm);
Log.WriteEnd("'{0}' UpdateVirtualMachine", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UpdateVirtualMachine", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public JobResult ChangeVirtualMachineState(string vmId, VirtualMachineRequestedState newState)
{
try
{
Log.WriteStart("'{0}' ChangeVirtualMachineState", ProviderSettings.ProviderName);
JobResult result = VirtualizationProvider.ChangeVirtualMachineState(vmId, newState);
Log.WriteEnd("'{0}' ChangeVirtualMachineState", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ChangeVirtualMachineState", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public ReturnCode ShutDownVirtualMachine(string vmId, bool force, string reason)
{
try
{
Log.WriteStart("'{0}' ShutDownVirtualMachine", ProviderSettings.ProviderName);
ReturnCode result = VirtualizationProvider.ShutDownVirtualMachine(vmId, force, reason);
Log.WriteEnd("'{0}' ShutDownVirtualMachine", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ShutDownVirtualMachine", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public List<ConcreteJob> GetVirtualMachineJobs(string vmId)
{
try
{
Log.WriteStart("'{0}' GetVirtualMachineJobs", ProviderSettings.ProviderName);
List<ConcreteJob> result = VirtualizationProvider.GetVirtualMachineJobs(vmId);
Log.WriteEnd("'{0}' GetVirtualMachineJobs", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetVirtualMachineJobs", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public JobResult RenameVirtualMachine(string vmId, string name)
{
try
{
Log.WriteStart("'{0}' RenameVirtualMachine", ProviderSettings.ProviderName);
JobResult result = VirtualizationProvider.RenameVirtualMachine(vmId, name);
Log.WriteEnd("'{0}' RenameVirtualMachine", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' RenameVirtualMachine", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public JobResult DeleteVirtualMachine(string vmId)
{
try
{
Log.WriteStart("'{0}' DeleteVirtualMachine", ProviderSettings.ProviderName);
JobResult result = VirtualizationProvider.DeleteVirtualMachine(vmId);
Log.WriteEnd("'{0}' DeleteVirtualMachine", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteVirtualMachine", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public JobResult ExportVirtualMachine(string vmId, string exportPath)
{
try
{
Log.WriteStart("'{0}' ExportVirtualMachine", ProviderSettings.ProviderName);
JobResult result = VirtualizationProvider.ExportVirtualMachine(vmId, exportPath);
Log.WriteEnd("'{0}' ExportVirtualMachine", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ExportVirtualMachine", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region Snapshots
[WebMethod, SoapHeader("settings")]
public List<VirtualMachineSnapshot> GetVirtualMachineSnapshots(string vmId)
{
try
{
Log.WriteStart("'{0}' GetVirtualMachineSnapshots", ProviderSettings.ProviderName);
List<VirtualMachineSnapshot> result = VirtualizationProvider.GetVirtualMachineSnapshots(vmId);
Log.WriteEnd("'{0}' GetVirtualMachineSnapshots", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetVirtualMachineSnapshots", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public VirtualMachineSnapshot GetSnapshot(string snapshotId)
{
try
{
Log.WriteStart("'{0}' GetSnapshot", ProviderSettings.ProviderName);
VirtualMachineSnapshot result = VirtualizationProvider.GetSnapshot(snapshotId);
Log.WriteEnd("'{0}' GetSnapshot", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetSnapshot", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public JobResult CreateSnapshot(string vmId)
{
try
{
Log.WriteStart("'{0}' CreateSnapshot", ProviderSettings.ProviderName);
JobResult result = VirtualizationProvider.CreateSnapshot(vmId);
Log.WriteEnd("'{0}' CreateSnapshot", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CreateSnapshot", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public JobResult RenameSnapshot(string vmId, string snapshotId, string name)
{
try
{
Log.WriteStart("'{0}' RenameSnapshot", ProviderSettings.ProviderName);
JobResult result = VirtualizationProvider.RenameSnapshot(vmId, snapshotId, name);
Log.WriteEnd("'{0}' RenameSnapshot", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' RenameSnapshot", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public JobResult ApplySnapshot(string vmId, string snapshotId)
{
try
{
Log.WriteStart("'{0}' ApplySnapshot", ProviderSettings.ProviderName);
JobResult result = VirtualizationProvider.ApplySnapshot(vmId, snapshotId);
Log.WriteEnd("'{0}' ApplySnapshot", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ApplySnapshot", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public JobResult DeleteSnapshot(string snapshotId)
{
try
{
Log.WriteStart("'{0}' DeleteSnapshot", ProviderSettings.ProviderName);
JobResult result = VirtualizationProvider.DeleteSnapshot(snapshotId);
Log.WriteEnd("'{0}' DeleteSnapshot", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteSnapshot", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public JobResult DeleteSnapshotSubtree(string snapshotId)
{
try
{
Log.WriteStart("'{0}' DeleteSnapshotSubtree", ProviderSettings.ProviderName);
JobResult result = VirtualizationProvider.DeleteSnapshotSubtree(snapshotId);
Log.WriteEnd("'{0}' DeleteSnapshotSubtree", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteSnapshotSubtree", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public byte[] GetSnapshotThumbnailImage(string snapshotId, ThumbnailSize size)
{
try
{
Log.WriteStart("'{0}' GetSnapshotThumbnailImage", ProviderSettings.ProviderName);
byte[] result = VirtualizationProvider.GetSnapshotThumbnailImage(snapshotId, size);
Log.WriteEnd("'{0}' GetSnapshotThumbnailImage", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetSnapshotThumbnailImage", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region Virtual Switches
[WebMethod, SoapHeader("settings")]
public List<VirtualSwitch> GetExternalSwitches(string computerName)
{
try
{
Log.WriteStart("'{0}' GetExternalSwitches", ProviderSettings.ProviderName);
List<VirtualSwitch> result = VirtualizationProvider.GetExternalSwitches(computerName);
Log.WriteEnd("'{0}' GetExternalSwitches", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetExternalSwitches", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public List<VirtualSwitch> GetSwitches()
{
try
{
Log.WriteStart("'{0}' GetSwitches", ProviderSettings.ProviderName);
List<VirtualSwitch> result = VirtualizationProvider.GetSwitches();
Log.WriteEnd("'{0}' GetSwitches", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetSwitches", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public bool SwitchExists(string switchId)
{
try
{
Log.WriteStart("'{0}' SwitchExists", ProviderSettings.ProviderName);
bool result = VirtualizationProvider.SwitchExists(switchId);
Log.WriteEnd("'{0}' SwitchExists", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' SwitchExists", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public VirtualSwitch CreateSwitch(string name)
{
try
{
Log.WriteStart("'{0}' CreateSwitch", ProviderSettings.ProviderName);
VirtualSwitch result = VirtualizationProvider.CreateSwitch(name);
Log.WriteEnd("'{0}' CreateSwitch", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' CreateSwitch", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public ReturnCode DeleteSwitch(string switchId)
{
try
{
Log.WriteStart("'{0}' DeleteSwitch", ProviderSettings.ProviderName);
ReturnCode result = VirtualizationProvider.DeleteSwitch(switchId);
Log.WriteEnd("'{0}' DeleteSwitch", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteSwitch", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region DVD operations
[WebMethod, SoapHeader("settings")]
public string GetInsertedDVD(string vmId)
{
try
{
Log.WriteStart("'{0}' GetInsertedDVD", ProviderSettings.ProviderName);
string result = VirtualizationProvider.GetInsertedDVD(vmId);
Log.WriteEnd("'{0}' GetInsertedDVD", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetInsertedDVD", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public JobResult InsertDVD(string vmId, string isoPath)
{
try
{
Log.WriteStart("'{0}' InsertDVD", ProviderSettings.ProviderName);
JobResult result = VirtualizationProvider.InsertDVD(vmId, isoPath);
Log.WriteEnd("'{0}' InsertDVD", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' InsertDVD", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public JobResult EjectDVD(string vmId)
{
try
{
Log.WriteStart("'{0}' EjectDVD", ProviderSettings.ProviderName);
JobResult result = VirtualizationProvider.EjectDVD(vmId);
Log.WriteEnd("'{0}' EjectDVD", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' EjectDVD", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region Library
[WebMethod, SoapHeader("settings")]
public LibraryItem[] GetLibraryItems(string path)
{
try
{
Log.WriteStart("'{0}' GetLibraryItems", ProviderSettings.ProviderName);
LibraryItem[] result = VirtualizationProvider.GetLibraryItems(path);
Log.WriteEnd("'{0}' GetLibraryItems", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetLibraryItems", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region KVP items
[WebMethod, SoapHeader("settings")]
public List<KvpExchangeDataItem> GetKVPItems(string vmId)
{
try
{
Log.WriteStart("'{0}' GetKVPItems", ProviderSettings.ProviderName);
List<KvpExchangeDataItem> result = VirtualizationProvider.GetKVPItems(vmId);
Log.WriteEnd("'{0}' GetKVPItems", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetKVPItems", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public List<KvpExchangeDataItem> GetStandardKVPItems(string vmId)
{
try
{
Log.WriteStart("'{0}' GetStandardKVPItems", ProviderSettings.ProviderName);
List<KvpExchangeDataItem> result = VirtualizationProvider.GetStandardKVPItems(vmId);
Log.WriteEnd("'{0}' GetStandardKVPItems", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetStandardKVPItems", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public JobResult AddKVPItems(string vmId, KvpExchangeDataItem[] items)
{
try
{
Log.WriteStart("'{0}' AddKVPItems", ProviderSettings.ProviderName);
JobResult result = VirtualizationProvider.AddKVPItems(vmId, items);
Log.WriteEnd("'{0}' AddKVPItems", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' AddKVPItems", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public JobResult RemoveKVPItems(string vmId, string[] itemNames)
{
try
{
Log.WriteStart("'{0}' RemoveKVPItems", ProviderSettings.ProviderName);
JobResult result = VirtualizationProvider.RemoveKVPItems(vmId, itemNames);
Log.WriteEnd("'{0}' RemoveKVPItems", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' RemoveKVPItems", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public JobResult ModifyKVPItems(string vmId, KvpExchangeDataItem[] items)
{
try
{
Log.WriteStart("'{0}' ModifyKVPItems", ProviderSettings.ProviderName);
JobResult result = VirtualizationProvider.ModifyKVPItems(vmId, items);
Log.WriteEnd("'{0}' ModifyKVPItems", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ModifyKVPItems", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region Storage
[WebMethod, SoapHeader("settings")]
public VirtualHardDiskInfo GetVirtualHardDiskInfo(string vhdPath)
{
try
{
Log.WriteStart("'{0}' GetVirtualHardDiskInfo", ProviderSettings.ProviderName);
VirtualHardDiskInfo result = VirtualizationProvider.GetVirtualHardDiskInfo(vhdPath);
Log.WriteEnd("'{0}' GetVirtualHardDiskInfo", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetVirtualHardDiskInfo", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public MountedDiskInfo MountVirtualHardDisk(string vhdPath)
{
try
{
Log.WriteStart("'{0}' MountVirtualHardDisk", ProviderSettings.ProviderName);
MountedDiskInfo result = VirtualizationProvider.MountVirtualHardDisk(vhdPath);
Log.WriteEnd("'{0}' MountVirtualHardDisk", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' MountVirtualHardDisk", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public ReturnCode UnmountVirtualHardDisk(string vhdPath)
{
try
{
Log.WriteStart("'{0}' UnmountVirtualHardDisk", ProviderSettings.ProviderName);
ReturnCode result = VirtualizationProvider.UnmountVirtualHardDisk(vhdPath);
Log.WriteEnd("'{0}' UnmountVirtualHardDisk", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' UnmountVirtualHardDisk", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public JobResult ExpandVirtualHardDisk(string vhdPath, UInt64 sizeGB)
{
try
{
Log.WriteStart("'{0}' ExpandVirtualHardDisk", ProviderSettings.ProviderName);
JobResult result = VirtualizationProvider.ExpandVirtualHardDisk(vhdPath, sizeGB);
Log.WriteEnd("'{0}' ExpandVirtualHardDisk", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ExpandVirtualHardDisk", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public JobResult ConvertVirtualHardDisk(string sourcePath, string destinationPath, VirtualHardDiskType diskType)
{
try
{
Log.WriteStart("'{0}' ConvertVirtualHardDisk", ProviderSettings.ProviderName);
JobResult result = VirtualizationProvider.ConvertVirtualHardDisk(sourcePath, destinationPath, diskType);
Log.WriteEnd("'{0}' ConvertVirtualHardDisk", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ConvertVirtualHardDisk", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void DeleteRemoteFile(string path)
{
try
{
Log.WriteStart("'{0}' DeleteRemoteFile", ProviderSettings.ProviderName);
VirtualizationProvider.DeleteRemoteFile(path);
Log.WriteEnd("'{0}' DeleteRemoteFile", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' DeleteRemoteFile", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void ExpandDiskVolume(string diskAddress, string volumeName)
{
try
{
Log.WriteStart("'{0}' ExpandDiskVolume", ProviderSettings.ProviderName);
VirtualizationProvider.ExpandDiskVolume(diskAddress, volumeName);
Log.WriteEnd("'{0}' ExpandDiskVolume", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ExpandDiskVolume", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public string ReadRemoteFile(string path)
{
try
{
Log.WriteStart("'{0}' ReadRemoteFile", ProviderSettings.ProviderName);
string result = VirtualizationProvider.ReadRemoteFile(path);
Log.WriteEnd("'{0}' ReadRemoteFile", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ReadRemoteFile", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void WriteRemoteFile(string path, string content)
{
try
{
Log.WriteStart("'{0}' WriteRemoteFile", ProviderSettings.ProviderName);
VirtualizationProvider.WriteRemoteFile(path, content);
Log.WriteEnd("'{0}' WriteRemoteFile", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' WriteRemoteFile", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region Jobs
[WebMethod, SoapHeader("settings")]
public ConcreteJob GetJob(string jobId)
{
try
{
Log.WriteStart("'{0}' GetJob", ProviderSettings.ProviderName);
ConcreteJob result = VirtualizationProvider.GetJob(jobId);
Log.WriteEnd("'{0}' GetJob", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetJob", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public List<ConcreteJob> GetAllJobs()
{
try
{
Log.WriteStart("'{0}' GetAllJobs", ProviderSettings.ProviderName);
List<ConcreteJob> result = VirtualizationProvider.GetAllJobs();
Log.WriteEnd("'{0}' GetAllJobs", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetAllJobs", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public ChangeJobStateReturnCode ChangeJobState(string jobId, ConcreteJobRequestedState newState)
{
try
{
Log.WriteStart("'{0}' ChangeJobState", ProviderSettings.ProviderName);
ChangeJobStateReturnCode result = VirtualizationProvider.ChangeJobState(jobId, newState);
Log.WriteEnd("'{0}' ChangeJobState", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ChangeJobState", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region Configuration
[WebMethod, SoapHeader("settings")]
public int GetProcessorCoresNumber()
{
try
{
Log.WriteStart("'{0}' GetProcessorCoresNumber", ProviderSettings.ProviderName);
int result = VirtualizationProvider.GetProcessorCoresNumber();
Log.WriteEnd("'{0}' GetProcessorCoresNumber", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetProcessorCoresNumber", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
}
}

View file

@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="VirtualizationServerForPrivateCloud.asmx.cs" Class="WebsitePanel.Server.VirtualizationServerForPrivateCloud" %>

View file

@ -0,0 +1,123 @@
<?xml version="1.0"?>
<configuration>
<!-- Custom configuration sections -->
<configSections>
<section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3"/>
<section name="websitepanel.server" type="WebsitePanel.Server.ServerConfiguration, WebsitePanel.Server"/>
<section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings,Microsoft.Practices.EnterpriseLibrary.Caching"/>
</configSections>
<appSettings>
<add key="WebsitePanel.HyperV.UseDiskPartClearReadOnlyFlag" value="false"/>
<add key="SCVMMServerName" value=""/>
<add key="SCVMMServerPort" value=""/>
</appSettings>
<system.diagnostics>
<switches>
<add name="Log" value="2"/>
<!-- 0 - Off, 1 - Error, 2 - Warning, 3 - Info, 4 - Verbose -->
</switches>
<trace autoflush="true">
<listeners>
<add name="DefaultListener" type="WebsitePanel.Server.Utils.EventLogTraceListener, WebsitePanel.Server.Utils" initializeData="WebsitePanel"/>
<!-- Writes log to the file
<add name="DefaultListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="WebsitePanel.Server.log" />
-->
<remove name="Default"/>
</listeners>
</trace>
</system.diagnostics>
<!-- Caching Configuration -->
<cachingConfiguration defaultCacheManager="Default Cache Manager">
<backingStores>
<add name="inMemory" type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.NullBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching"/>
</backingStores>
<cacheManagers>
<add name="Default Cache Manager" expirationPollFrequencyInSeconds="43200" maximumElementsInCacheBeforeScavenging="1000" numberToRemoveWhenScavenging="10" backingStoreName="inMemory"/>
</cacheManagers>
</cachingConfiguration>
<!-- WebsitePanel Configuration -->
<websitepanel.server>
<!-- Security settings -->
<security>
<!-- Perform security check -->
<enabled value="true"/>
<!-- Server password -->
<password value="${installer.server.password}"/>
</security>
</websitepanel.server>
<system.web>
<!-- Disable any authentication -->
<authentication mode="None"/>
<!-- Correct HTTP runtime settings -->
<httpRuntime executionTimeout="3600" maxRequestLength="16384"/>
<!-- Set globalization settings -->
<globalization culture="en-US" uiCulture="en" requestEncoding="UTF-8" responseEncoding="UTF-8" fileEncoding="UTF-8"/>
<!-- Web Services settings -->
<webServices>
<protocols>
<remove name="HttpPost"/>
<remove name="HttpPostLocalhost"/>
<remove name="HttpGet"/>
</protocols>
<soapServerProtocolFactory type="Microsoft.Web.Services3.WseProtocolFactory, Microsoft.Web.Services3"/>
</webServices>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
<!-- WSE 3.0 settings -->
<microsoft.web.services3>
<diagnostics>
<trace enabled="false" input="InputTrace.webinfo" output="OutputTrace.webinfo"/>
</diagnostics>
<messaging>
<maxMessageLength value="-1"/>
<mtom serverMode="optional" clientMode="On"/>
</messaging>
<security>
<securityTokenManager>
<add type="WebsitePanel.Server.ServerUsernameTokenManager, WebsitePanel.Server" namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" localName="UsernameToken"/>
</securityTokenManager>
<timeToleranceInSeconds value="86400"/>
</security>
<policy fileName="WsePolicyCache.Config"/>
</microsoft.web.services3>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IVirtualMachineManagementService"
closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00"
sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false"
hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
maxReceivedMessageSize="10485760" messageEncoding="Text" textEncoding="utf-8"
useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
<binding name="WSHttpBinding_IMonitoringService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="10485760"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
</configuration>

View file

@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="WebServer.asmx.cs" Class="WebsitePanel.Server.WebServer" %>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,250 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{38C6047C-E447-4CC2-891F-ABE54D4659F3}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WebsitePanel.Server</RootNamespace>
<AssemblyName>WebsitePanel.Server</AssemblyName>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile />
<UseIISExpress>false</UseIISExpress>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE;DEBUG;PRODUCTION_NO</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<WarningsAsErrors>618</WarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE;PRODUCTION_NO</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<WarningsAsErrors>618</WarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Lib\Microsoft.Web.Services3.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Drawing" />
<Reference Include="System.Management" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Web" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Web.Mobile" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Content Include="AutoDiscovery.asmx" />
<Content Include="BlackBerry.asmx" />
<EmbeddedResource Include="Images\logo.png" />
<Content Include="ExchangeServerHostedEdition.asmx" />
<Content Include="OCSEdgeServer.asmx" />
<Content Include="OCSServer.asmx" />
<Content Include="CRM.asmx" />
<Content Include="DatabaseServer.asmx" />
<Content Include="Default.aspx" />
<Content Include="DNSServer.asmx" />
<Content Include="ExchangeServer.asmx" />
<Content Include="FTPServer.asmx" />
<Content Include="Global.asax" />
<Content Include="HostedSharePointServer.asmx" />
<Content Include="Organizations.asmx" />
<Content Include="MailServer.asmx" />
<Content Include="OperatingSystem.asmx" />
<Content Include="ServiceProvider.asmx" />
<Content Include="SharePointServer.asmx" />
<Content Include="StatisticsServer.asmx" />
<Content Include="VirtualizationServer.asmx" />
<Content Include="VirtualizationServerForPrivateCloud.asmx" />
<Content Include="Web.config">
<SubType>Designer</SubType>
</Content>
<Content Include="WebServer.asmx" />
<Content Include="WindowsServer.asmx" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\VersionInfo.cs">
<Link>VersionInfo.cs</Link>
</Compile>
<Compile Include="AutoDiscovery.asmx.cs">
<DependentUpon>AutoDiscovery.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="BlackBerry.asmx.cs">
<DependentUpon>BlackBerry.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="Code\AutoDiscoveryHelper.cs" />
<Compile Include="Code\ServerConfiguration.cs" />
<Compile Include="Code\ServerUsernameTokenManager.cs" />
<Compile Include="Code\UsernameAssertion.cs" />
<Compile Include="ExchangeServerHostedEdition.asmx.cs">
<DependentUpon>ExchangeServerHostedEdition.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="OCSEdgeServer.asmx.cs">
<DependentUpon>OCSEdgeServer.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="OCSServer.asmx.cs">
<DependentUpon>OCSServer.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="CRM.asmx.cs">
<DependentUpon>CRM.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="DatabaseServer.asmx.cs">
<DependentUpon>DatabaseServer.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="Default.aspx.cs">
<DependentUpon>Default.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Default.aspx.designer.cs">
<DependentUpon>Default.aspx</DependentUpon>
</Compile>
<Compile Include="DNSServer.asmx.cs">
<DependentUpon>DNSServer.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="ExchangeServer.asmx.cs">
<DependentUpon>ExchangeServer.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="FTPServer.asmx.cs">
<DependentUpon>FTPServer.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="HostedSharePointServer.asmx.cs">
<DependentUpon>HostedSharePointServer.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="Organizations.asmx.cs">
<DependentUpon>Organizations.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="MailServer.asmx.cs">
<DependentUpon>MailServer.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="OperatingSystem.asmx.cs">
<DependentUpon>OperatingSystem.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ServiceProvider.asmx.cs">
<DependentUpon>ServiceProvider.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="SharePointServer.asmx.cs">
<DependentUpon>SharePointServer.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="StatisticsServer.asmx.cs">
<DependentUpon>StatisticsServer.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="VirtualizationServer.asmx.cs">
<DependentUpon>VirtualizationServer.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="VirtualizationServerForPrivateCloud.asmx.cs">
<DependentUpon>VirtualizationServerForPrivateCloud.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="WebServer.asmx.cs">
<DependentUpon>WebServer.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="WindowsServer.asmx.cs">
<DependentUpon>WindowsServer.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WebsitePanel.Providers.Base\WebsitePanel.Providers.Base.csproj">
<Project>{684C932A-6C75-46AC-A327-F3689D89EB42}</Project>
<Name>WebsitePanel.Providers.Base</Name>
</ProjectReference>
<ProjectReference Include="..\WebsitePanel.Providers.Virtualization.HyperVForPC\WebsitePanel.Providers.VirtualizationForPC.HyperVForPC.csproj">
<Project>{64BEEB10-7F9F-4860-B2FF-84CDA02766B3}</Project>
<Name>WebsitePanel.Providers.VirtualizationForPC.HyperVForPC</Name>
</ProjectReference>
<ProjectReference Include="..\WebsitePanel.Providers.Web.IIs60\WebsitePanel.Providers.Web.IIs60.csproj">
<Project>{9BE0317D-E42E-4FF6-9A87-8C801F046EA1}</Project>
<Name>WebsitePanel.Providers.Web.IIs60</Name>
</ProjectReference>
<ProjectReference Include="..\WebsitePanel.Server.Utils\WebsitePanel.Server.Utils.csproj">
<Project>{E91E52F3-9555-4D00-B577-2B1DBDD87CA7}</Project>
<Name>WebsitePanel.Server.Utils</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="WsePolicyCache.Config" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>False</UseIIS>
<AutoAssignPort>False</AutoAssignPort>
<DevelopmentServerPort>9003</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>
</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
</Project>

View file

@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="WindowsServer.asmx.cs" Class="WebsitePanel.Server.WindowsServer" %>

View file

@ -0,0 +1,424 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.IO;
using System.Data;
using System.Web;
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Text.RegularExpressions;
using System.ServiceProcess;
using System.Management;
using Microsoft.Web.Services3;
using WebsitePanel.Providers.Utils;
using WebsitePanel.Server.Utils;
namespace WebsitePanel.Server
{
/// <summary>
/// Summary description for WindowsServer
/// </summary>
[WebService(Namespace = "http://smbsaas/websitepanel/server/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Policy("ServerPolicy")]
[ToolboxItem(false)]
public class WindowsServer : System.Web.Services.WebService
{
#region Terminal connections
[WebMethod]
public TerminalSession[] GetTerminalServicesSessions()
{
try
{
Log.WriteStart("GetTerminalServicesSessions");
List<TerminalSession> sessions = new List<TerminalSession>();
string ret = FileUtils.ExecuteSystemCommand("qwinsta", "");
// parse returned string
StringReader reader = new StringReader(ret);
string line = null;
int lineIndex = 0;
while ((line = reader.ReadLine()) != null)
{
/*if (line.IndexOf("USERNAME") != -1 )
continue;*/
//
if (lineIndex == 0)
{
lineIndex++;
continue;
}
Regex re = new Regex(@"(\S+)\s+", RegexOptions.Multiline | RegexOptions.IgnoreCase);
MatchCollection matches = re.Matches(line);
// add row to the table
string username = "";
if (matches.Count > 4)
username = matches[1].Value.Trim();
if (username != "")
{
TerminalSession session = new TerminalSession();
//
session.SessionId = Int32.Parse(matches[2].Value.Trim());
session.Username = username;
session.Status = matches[3].Value.Trim();
sessions.Add(session);
}
//
lineIndex++;
}
reader.Close();
Log.WriteEnd("GetTerminalServicesSessions");
return sessions.ToArray();
}
catch (Exception ex)
{
Log.WriteError("GetTerminalServicesSessions", ex);
throw;
}
}
[WebMethod]
public void CloseTerminalServicesSession(int sessionId)
{
try
{
Log.WriteStart("CloseTerminalServicesSession");
FileUtils.ExecuteSystemCommand("rwinsta", sessionId.ToString());
Log.WriteEnd("CloseTerminalServicesSession");
}
catch (Exception ex)
{
Log.WriteError("CloseTerminalServicesSession", ex);
throw;
}
}
#endregion
#region Windows Processes
[WebMethod]
public WindowsProcess[] GetWindowsProcesses()
{
try
{
Log.WriteStart("GetWindowsProcesses");
List<WindowsProcess> winProcesses = new List<WindowsProcess>();
WmiHelper wmi = new WmiHelper("root\\cimv2");
ManagementObjectCollection objProcesses = wmi.ExecuteQuery(
"SELECT * FROM Win32_Process");
foreach (ManagementObject objProcess in objProcesses)
{
int pid = Int32.Parse(objProcess["ProcessID"].ToString());
string name = objProcess["Name"].ToString();
// get user info
string[] methodParams = new String[2];
objProcess.InvokeMethod("GetOwner", (object[])methodParams);
string username = methodParams[0];
WindowsProcess winProcess = new WindowsProcess();
winProcess.Pid = pid;
winProcess.Name = name;
winProcess.Username = username;
winProcess.MemUsage = Int64.Parse(objProcess["WorkingSetSize"].ToString());
winProcesses.Add(winProcess);
}
Log.WriteEnd("GetWindowsProcesses");
return winProcesses.ToArray();
}
catch (Exception ex)
{
Log.WriteError("GetWindowsProcesses", ex);
throw;
}
}
[WebMethod]
public void TerminateWindowsProcess(int pid)
{
try
{
Log.WriteStart("TerminateWindowsProcess");
Process[] processes = Process.GetProcesses();
foreach (Process process in processes)
{
if (process.Id == pid)
process.Kill();
}
Log.WriteEnd("TerminateWindowsProcess");
}
catch (Exception ex)
{
Log.WriteError("TerminateWindowsProcess", ex);
throw;
}
}
#endregion
#region Windows Services
[WebMethod]
public WindowsService[] GetWindowsServices()
{
try
{
Log.WriteStart("GetWindowsServices");
List<WindowsService> winServices = new List<WindowsService>();
ServiceController[] services = ServiceController.GetServices();
foreach (ServiceController service in services)
{
WindowsService winService = new WindowsService();
winService.Id = service.ServiceName;
winService.Name = service.DisplayName;
winService.CanStop = service.CanStop;
winService.CanPauseAndContinue = service.CanPauseAndContinue;
WindowsServiceStatus status = WindowsServiceStatus.ContinuePending;
switch (service.Status)
{
case ServiceControllerStatus.ContinuePending: status = WindowsServiceStatus.ContinuePending; break;
case ServiceControllerStatus.Paused: status = WindowsServiceStatus.Paused; break;
case ServiceControllerStatus.PausePending: status = WindowsServiceStatus.PausePending; break;
case ServiceControllerStatus.Running: status = WindowsServiceStatus.Running; break;
case ServiceControllerStatus.StartPending: status = WindowsServiceStatus.StartPending; break;
case ServiceControllerStatus.Stopped: status = WindowsServiceStatus.Stopped; break;
case ServiceControllerStatus.StopPending: status = WindowsServiceStatus.StopPending; break;
}
winService.Status = status;
winServices.Add(winService);
}
Log.WriteEnd("GetWindowsServices");
return winServices.ToArray();
}
catch (Exception ex)
{
Log.WriteError("GetWindowsServices", ex);
throw;
}
}
[WebMethod]
public void ChangeWindowsServiceStatus(string id, WindowsServiceStatus status)
{
try
{
Log.WriteStart("ChangeWindowsServiceStatus");
// get all services
ServiceController[] services = ServiceController.GetServices();
// find required service
foreach (ServiceController service in services)
{
if (String.Compare(service.ServiceName, id, true) == 0)
{
if (status == WindowsServiceStatus.Paused
&& service.Status == ServiceControllerStatus.Running)
service.Pause();
else if (status == WindowsServiceStatus.Running
&& service.Status == ServiceControllerStatus.Stopped)
service.Start();
else if (status == WindowsServiceStatus.Stopped
&& ((service.Status == ServiceControllerStatus.Running) ||
(service.Status == ServiceControllerStatus.Paused)))
service.Stop();
else if (status == WindowsServiceStatus.ContinuePending
&& service.Status == ServiceControllerStatus.Paused)
service.Continue();
}
}
Log.WriteEnd("ChangeWindowsServiceStatus");
}
catch (Exception ex)
{
Log.WriteError("ChangeWindowsServiceStatus", ex);
throw;
}
}
#endregion
#region Event Viewer
[WebMethod]
public List<string> GetLogNames()
{
List<string> logs = new List<string>();
EventLog[] eventLogs = EventLog.GetEventLogs();
foreach (EventLog eventLog in eventLogs)
{
logs.Add(eventLog.LogDisplayName);
}
return logs;
}
[WebMethod]
public List<SystemLogEntry> GetLogEntries(string logName)
{
SystemLogEntriesPaged result = new SystemLogEntriesPaged();
List<SystemLogEntry> entries = new List<SystemLogEntry>();
if (String.IsNullOrEmpty(logName))
return entries;
EventLog log = new EventLog(logName);
EventLogEntryCollection logEntries = log.Entries;
int count = logEntries.Count;
// iterate in reverse order
for (int i = count - 1; i >= 0; i--)
entries.Add(CreateLogEntry(logEntries[i], false));
return entries;
}
[WebMethod]
public SystemLogEntriesPaged GetLogEntriesPaged(string logName, int startRow, int maximumRows)
{
SystemLogEntriesPaged result = new SystemLogEntriesPaged();
List<SystemLogEntry> entries = new List<SystemLogEntry>();
if (String.IsNullOrEmpty(logName))
{
result.Count = 0;
result.Entries = new SystemLogEntry[] { };
return result;
}
EventLog log = new EventLog(logName);
EventLogEntryCollection logEntries = log.Entries;
int count = logEntries.Count;
result.Count = count;
// iterate in reverse order
startRow = count - 1 - startRow;
int endRow = startRow - maximumRows + 1;
if (endRow < 0)
endRow = 0;
for (int i = startRow; i >= endRow; i--)
entries.Add(CreateLogEntry(logEntries[i], true));
result.Entries = entries.ToArray();
return result;
}
[WebMethod]
public void ClearLog(string logName)
{
EventLog log = new EventLog(logName);
log.Clear();
}
private SystemLogEntry CreateLogEntry(EventLogEntry logEntry, bool includeMessage)
{
SystemLogEntry entry = new SystemLogEntry();
switch (logEntry.EntryType)
{
case EventLogEntryType.Error: entry.EntryType = SystemLogEntryType.Error; break;
case EventLogEntryType.Warning: entry.EntryType = SystemLogEntryType.Warning; break;
case EventLogEntryType.Information: entry.EntryType = SystemLogEntryType.Information; break;
case EventLogEntryType.SuccessAudit: entry.EntryType = SystemLogEntryType.SuccessAudit; break;
case EventLogEntryType.FailureAudit: entry.EntryType = SystemLogEntryType.FailureAudit; break;
}
entry.Created = logEntry.TimeGenerated;
entry.Source = logEntry.Source;
entry.Category = logEntry.Category;
entry.EventID = logEntry.InstanceId;
entry.UserName = logEntry.UserName;
entry.MachineName = logEntry.MachineName;
if (includeMessage)
entry.Message = logEntry.Message;
return entry;
}
#endregion
#region Reboot
[WebMethod]
public void RebootSystem()
{
try
{
Log.WriteStart("RebootSystem");
WmiHelper wmi = new WmiHelper("root\\cimv2");
ManagementObjectCollection objOses = wmi.ExecuteQuery("SELECT * FROM Win32_OperatingSystem");
foreach (ManagementObject objOs in objOses)
{
objOs.Scope.Options.EnablePrivileges = true;
objOs.InvokeMethod("Reboot", null);
}
Log.WriteEnd("RebootSystem");
}
catch (Exception ex)
{
Log.WriteError("RebootSystem", ex);
throw;
}
}
#endregion
#region System Commands
[WebMethod]
public string ExecuteSystemCommand(string path, string args)
{
try
{
Log.WriteStart("ExecuteSystemCommand");
string result = FileUtils.ExecuteSystemCommand(path, args);
Log.WriteEnd("ExecuteSystemCommand");
return result;
}
catch (Exception ex)
{
Log.WriteError("ExecuteSystemCommand", ex);
throw;
}
}
#endregion
}
}

View file

@ -0,0 +1,8 @@
<policies xmlns="http://schemas.microsoft.com/wse/2005/06/policy">
<extensions>
<extension name="usernameAssertion" type="WebsitePanel.Server.UsernameAssertion, WebsitePanel.Server" />
</extensions>
<policy name="ServerPolicy">
<usernameAssertion/>
</policy>
</policies>