MERGE: buildtoolsv1 vs. main

This commit is contained in:
ptsurbeleu 2012-12-04 23:52:03 -08:00
commit 2b45a5d223
330 changed files with 10414 additions and 2877 deletions

View file

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.269
// Runtime Version:4.0.30319.17929
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.

View file

@ -9,7 +9,7 @@
<!-- Studio settings -->
<settings>
<add key="Log.FileName" value="WebsitePanel.Installer.log" />
<add key="Web.Service" value="http://www.websitepanel.net/Services/InstallerService-Beta.asmx" />
<add key="Web.Service" value="" />
<add key="Web.AutoCheck" value="False" />
<add key="Web.Proxy.UseProxy" value="false" />
<add key="Web.Proxy.Address" value="" />

View file

@ -9,7 +9,7 @@
<!-- Studio settings -->
<settings>
<add key="Log.FileName" value="WebsitePanel.Installer.log" />
<add key="Web.Service" value="http://www.websitepanel.net/Services/InstallerService-Beta.asmx" />
<add key="Web.Service" value="" />
<add key="Web.AutoCheck" value="False" />
<add key="Web.Proxy.UseProxy" value="false" />
<add key="Web.Proxy.Address" value="" />

View file

@ -9,7 +9,7 @@
<!-- Studio settings -->
<settings>
<add key="Log.FileName" value="WebsitePanel.Installer.log" />
<add key="Web.Service" value="http://www.websitepanel.net/Services/InstallerService-Beta.asmx" />
<add key="Web.Service" value="" />
<add key="Web.AutoCheck" value="False" />
<add key="Web.Proxy.UseProxy" value="false" />
<add key="Web.Proxy.Address" value="" />

View file

@ -1,3 +1,31 @@
// 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.
namespace WebsitePanel.Installer
{
partial class ApplicationForm
@ -209,7 +237,7 @@ namespace WebsitePanel.Installer
this.MinimumSize = new System.Drawing.Size(640, 480);
this.Name = "ApplicationForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "WebsitePanel Installer (Beta)";
this.Text = "WebsitePanel Installer";
this.Shown += new System.EventHandler(this.OnApplicationFormShown);
this.statusBar.ResumeLayout(false);
this.statusBar.PerformLayout();

View file

@ -31,7 +31,7 @@ namespace WebsitePanel.Setup
{
return UpdateBase(obj,
minimalInstallerVersion: "2.0.0",
versionToUpgrade: "1.2.1",
versionToUpgrade: "1.2.1,2.0.0",
updateSql: true);
}
}

View file

@ -31,7 +31,7 @@ namespace WebsitePanel.Setup
{
return UpdateBase(obj,
minimalInstallerVersion: "2.0.0",
versionsToUpgrade: "1.2.1",
versionsToUpgrade: "1.2.1,2.0.0",
updateSql: false,
versionSpecificAction: new InstallAction(ActionTypes.ConfigureSecureSessionModuleInWebConfig));
}

View file

@ -30,7 +30,7 @@ namespace WebsitePanel.Setup
{
return Server.UpdateBase(obj,
minimalInstallerVersion: "2.0.0",
versionToUpgrade: "1.2.1",
versionToUpgrade: "1.2.1,2.0.0",
updateSql: false);
}
}

View file

@ -605,6 +605,10 @@ namespace WebsitePanel.Setup
return false;
int value = (int)regkey.GetValue("ASPNET", 0);
if (value != 1)
value = (int)regkey.GetValue("ASPNET45", 0);
return value == 1;
}
}

View file

@ -325,13 +325,17 @@ namespace WebsitePanel.Setup
if (webServer != null)
{
var modules = doc.CreateElement(iis6 ? "httpModules" : "modules");
string modulesNodeName = iis6 ? "httpModules" : "modules";
if (webServer.SelectSingleNode(modulesNodeName + "/add[@name='SecureSession']") == null)
{
var modules = doc.CreateElement(modulesNodeName);
webServer.AppendChild(modules);
var sessionModule = doc.CreateElement("add");
sessionModule.SetAttribute("name", "SecureSession");
sessionModule.SetAttribute("type", "WebsitePanel.WebPortal.SecureSessionModule");
modules.AppendChild(sessionModule);
}
}
// update /system.web/httpRuntime element
var httpRuntime = doc.SelectSingleNode("configuration/system.web/httpRuntime") as XmlElement;
@ -343,10 +347,10 @@ namespace WebsitePanel.Setup
// <add key="SessionValidationKey" value="XXXXXX" />
//</appSettings>
var appSettings = doc.SelectSingleNode("configuration/appSettings");
if (appSettings != null)
if (appSettings != null && appSettings.SelectSingleNode("add[@key='SessionValidationKey']") == null)
{
var sessionKey = doc.CreateElement("add");
sessionKey.SetAttribute("name", "SessionValidationKey");
sessionKey.SetAttribute("key", "SessionValidationKey");
sessionKey.SetAttribute("value", StringUtils.GenerateRandomString(16));
appSettings.AppendChild(sessionKey);
}

View file

@ -6220,7 +6220,7 @@ GO
CREATE PROCEDURE [dbo].[GetItemIdByOrganizationId]
@OrganizationId nvarchar(10)
@OrganizationId nvarchar(128)
AS
BEGIN
SET NOCOUNT ON;
@ -6508,6 +6508,7 @@ CREATE TABLE [dbo].[ExchangeOrganizationDomains](
[ItemID] [int] NOT NULL,
[DomainID] [int] NULL,
[IsHost] [bit] NULL,
[DomainTypeID] [int] NOT NULL,
CONSTRAINT [PK_ExchangeOrganizationDomains] PRIMARY KEY CLUSTERED
(
[OrganizationDomainID] ASC
@ -6634,7 +6635,8 @@ AS
SELECT
ED.DomainID,
D.DomainName,
ED.IsHost
ED.IsHost,
ED.DomainTypeID
FROM
ExchangeOrganizationDomains AS ED
INNER JOIN Domains AS D ON ED.DomainID = D.DomainID
@ -23549,7 +23551,7 @@ INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName]
GO
INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (3, 3, N'MSFTP60', N'Microsoft FTP Server 6.0', N'WebsitePanel.Providers.FTP.MsFTP, WebsitePanel.Providers.FTP.IIs60', N'MSFTP60', NULL)
GO
INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (4, 4, N'MailEnable', N'MailEnable Server 1.x - 4.x', N'WebsitePanel.Providers.Mail.MailEnable, WebsitePanel.Providers.Mail.MailEnable', N'MailEnable', NULL)
INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (4, 4, N'MailEnable', N'MailEnable Server 1.x - 7.x', N'WebsitePanel.Providers.Mail.MailEnable, WebsitePanel.Providers.Mail.MailEnable', N'MailEnable', NULL)
GO
INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (5, 5, N'MSSQL', N'Microsoft SQL Server 2000', N'WebsitePanel.Providers.Database.MsSqlServer, WebsitePanel.Providers.Database.SqlServer', N'MSSQL', NULL)
GO
@ -23619,11 +23621,11 @@ INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName]
GO
INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (63, 4, N'hMailServer5', N'hMailServer 5.x', N'WebsitePanel.Providers.Mail.hMailServer5, WebsitePanel.Providers.Mail.hMailServer5', N'hMailServer5', NULL)
GO
INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (64, 4, N'SmarterMail', N'SmarterMail 7.x', N'WebsitePanel.Providers.Mail.SmarterMail7, WebsitePanel.Providers.Mail.SmarterMail7', N'SmarterMail60', NULL)
INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (64, 4, N'SmarterMail', N'SmarterMail 7.x - 8.x', N'WebsitePanel.Providers.Mail.SmarterMail7, WebsitePanel.Providers.Mail.SmarterMail7', N'SmarterMail60', NULL)
GO
INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (65, 4, N'SmarterMail', N'SmarterMail 9.x', N'WebsitePanel.Providers.Mail.SmarterMail9, WebsitePanel.Providers.Mail.SmarterMail9', N'SmarterMail60', NULL)
GO
INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (66, 4, N'SmarterMail', N'SmarterMail 10.x', N'WebsitePanel.Providers.Mail.SmarterMail10, WebsitePanel.Providers.Mail.SmarterMail10', N'SmarterMail60', NULL)
INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (66, 4, N'SmarterMail', N'SmarterMail 10.x +', N'WebsitePanel.Providers.Mail.SmarterMail10, WebsitePanel.Providers.Mail.SmarterMail10', N'SmarterMail60', NULL)
GO
INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (100, 1, N'Windows2008', N'Windows Server 2008', N'WebsitePanel.Providers.OS.Windows2008, WebsitePanel.Providers.OS.Windows2008', N'Windows2008', NULL)
GO
@ -45799,6 +45801,29 @@ GO
CREATE PROCEDURE [dbo].ChangeExchangeAcceptedDomainType
(
@ItemID int,
@DomainID int,
@DomainTypeID int
)
AS
UPDATE ExchangeOrganizationDomains
SET DomainTypeID=@DomainTypeID
WHERE ItemID=ItemID AND DomainID=@DomainID
RETURN
GO
@ -46064,6 +46089,8 @@ ALTER TABLE [dbo].[ExchangeOrganizationDomains] CHECK CONSTRAINT [FK_ExchangeOrg
GO
ALTER TABLE [dbo].[ExchangeOrganizationDomains] ADD CONSTRAINT [DF_ExchangeOrganizationDomains_IsHost] DEFAULT ((0)) FOR [IsHost]
GO
ALTER TABLE [dbo].[ExchangeOrganizationDomains] ADD CONSTRAINT [DF_ExchangeOrganizationDomains_DomainTypeID] DEFAULT ((0)) FOR [DomainTypeID]
GO
ALTER TABLE [dbo].[PrivateIPAddresses] WITH CHECK ADD CONSTRAINT [FK_PrivateIPAddresses_ServiceItems] FOREIGN KEY([ItemID])
REFERENCES [dbo].[ServiceItems] ([ItemID])
ON DELETE CASCADE

File diff suppressed because it is too large Load diff

View file

@ -1,178 +0,0 @@
<!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>
<title>WebsitePanel - Readme</title>
<style type="text/css">
.style1 {
text-decoration: underline;
}
</style>
</head>
<body>
<h1>
WebsitePanel - Readme</h1>
<p>
WebsitePanel is a hosting control panel for Windows servers.</p>
<h2>
License</h2>
<p>
WebsitePanel is released under BSD license. Please see LICENSE.txt file in the
root folder of this project.</p>
<h2>
Project Structure</h2>
<p>
The project has the following folders structure:</p>
<ul>
<li><strong>\Trunk</strong> - project version currently in development<ul>
<li><strong>\Sources</strong> - project source codes.</li>
<li><strong>\Lib</strong> - all referenced 3rd-party assemblies required to build
the solution are placed in this folder.</li>
<li><strong>\Database</strong> - the folder contains SQL scripts for creating
initial database structure and its update to the current version.<ul>
<li><strong>install_db.sql</strong> - SQL script to create full database structure
for the <em>previous</em> release.</li>
<li><strong>update_db.sql</strong> - SQL script to update database structure for the
revious release to the current one.</li>
</ul>
</li>
<li><strong>\Docs</strong> - project documentation<ul>
<li><strong>\Developer</strong> - technical documentation (specs, diagrams, POCs,
etc.) for developers working on the project</li>
<li><strong>\User</strong> - user-related documentation (user guides, how-tows,
etc.) for end-users using the product</li>
</ul>
</li>
<li><strong>\Build</strong> - folder containing solution assemblies that
are referenced from other projects</li>
</ul>
</li>
<li><strong>\Releases</strong> - contains all project releases</li>
<li><strong>\Branches</strong> - contains project branches for proof-of-concepts,
new development, bug fixing, etc.</li>
<li><strong>LICENSE.txt</strong> - project license</li>
<li><strong>Readme.htm</strong> - the file you are reading right now</li>
<li><strong>ReleaseNotes.htm</strong> - project release notes</li>
</ul>
<h2>
Build How-To</h2>
<h3>
Downloading 3rd-Party Libraries</h3>
<p class="style1">
SimpleDNS API</p>
<p>
SDNSAPI.dll is required to build &quot;WebsitePanel.Providers.DNS.SimpleDNS50&quot;
project.</p>
<p>
Download &quot;Simple DNS Plus API for .NET and COM&quot; library from &quot;Downloads&quot; section
on <a href="http://www.simpledns.com">www.simpledns.com</a> web site web site (at the
time of writing direct link to this library is
<a href="http://www.simpledns.com/outbox/sdnsapi-setup.exe">
http://www.simpledns.com/outbox/sdnsapi-setup.exe</a>). Install the library and
then copy SDNSAPI.dll (located in &quot;C:\Program Files (x86)\Simple DNS Plus API
for .NET and COM&quot; by default) from its installation folder to &quot;Lib&quot; folder of
WebsitePanel project.</p>
<p class="style1">
MySQL .NET Connector</p>
<p>
MySQL .NET Connector is required to build
&quot;WebsitePanel.Providers.Database.MySql&quot; project.</p>
<p>
Go to <a href="http://www.mysql.com">www.mysql.com</a> web site and download the
latest release of &quot;MySQL .NET Connector&quot; library from there (at the time of
writing it is located at <a href="http://dev.mysql.com/downloads/connector/net/">
http://dev.mysql.com/downloads/connector/net/</a>). Install MySQL connector and
then copy &quot;MySQL.Data.dll&quot; assembly from its installation folder to &quot;Lib&quot; folder
of WebsitePanel project.</p>
<p class="style1">
OrderBox (Directi API)</p>
<p>
Certain libraries are required to compile &quot;WebsitePanel.Plugins.Directi&quot; project
of Enterprise Server solution.</p>
<p>
Open <a href="http://40083.myorderbox.com/kb/servlet/KBServlet/faq589.html">
http://40083.myorderbox.com/kb/servlet/KBServlet/faq589.html</a> page and
download the following files:</p>
<ul>
<li>NET_CoreExamples_vX.zip</li>
<li>NET_DomainsExamples_vX.zip</li>
</ul>
<p>
Unpack both archives to some temporary location and then copy the following
files to &quot;Lib&quot; folder of WebsitePanel project:</p>
<ul>
<li>OrderBoxCoreLib.dll</li>
<li>OrderBoxDomainsLib.dll</li>
</ul>
<h3>Set the Reference Paths to 3rd-Party Libraries</h3>
<p>After placing the required 3rd-Party Libraries into &quot;Lib&quot; folder
of WebsitePanel project, open WebsitePanel.Server solution (WebsitePanel.Server.sln)
and set ReferencePath of &quot;WebsitePanel.Providers.Database.MySQL&quot; and &quot;WebsitePanel.Providers.DNS.SimpleDNS50&quot; projects
to the absolute path of the &quot;Lib&quot; folder. See &quot;Reference Path Is Incorrect&quot; paragraph of
<a href="http://msdn.microsoft.com/en-us/library/ayds71se%28v=VS.100%29.aspx" target="_blank">Troubleshooting Broken References</a>
article for help.<br />
Do the same for &quot;WebsitePanel.Plugins.Directi&quot; project of WebsitePanel.EnterpriseServer solution (WebsitePanel.EnterpriseServer.sln).</p>
<h3>
Building Solutions</h3>
<p>
Build WebsitePanel solutions in the following order:</p>
<ul>
<li>WebsitePanel.Server.sln</li>
<li>WebsitePanel.EnterpriseServer.sln</li>
<li>WebsitePanel.WebPortal.sln</li>
</ul>
<h3>
Creating Database</h3>
<p>
In order to run WebsitePanel Enterprise Server it&#39;s required to create SQL
Server database to hold its internal data.</p>
<ol>
<li>Using SQL Server Management Studio or any other database tool create a database
called &quot;WebsitePanel&quot;.</li>
<li>Execute &quot;install_db.sql&quot; script containing DDL and initial data from &quot;\Database&quot;
folder of WebsitePanel project against created database.</li>
<li>Create &quot;WebsitePanel&quot; SQL user account and grant it &quot;db_owner&quot; rights on
&quot;WebsitePanel&quot; database.</li>
<li>Open &quot;web.config&quot; file in the root of Enterprise Server application and update
CryptoKey (appSettings/add/WebsitePanel.CryptoKey element) value there. It might
be arbitrary non-empty string.</li>
<li>Run WebsitePanel.PasswordEncoder tool available in &quot;Tools&quot; folder and generate
hash for &quot;serveradmin&quot; account password using CryptoKey and &quot;Encrypt&quot; button.</li>
<li>Update &quot;Password&quot; column in &quot;Users&quot; database table with generated hash for the
record with UserID = 1 (&quot;serveradmin&quot; account).</li>
<li>In Enterprise Server&#39;s web.config update database connection string with proper
settings in order to connect to WebsitePanel database.</li>
</ol>
<h3>
Configuring Web Applications</h3>
<p>
It&#39;s assumed below that root of WebsitePanel project is pointing to &quot;C:\Projects\WebsitePanel&quot;
folder.</p>
<ul>
<li>Create &quot;WebsitePanel Server&quot; web site (with 127.0.0.1:9003 binding) using IIS Management Tool with the root
folder pointing to &quot;C:\Projects\WebsitePanel\Trunk\Sources\WebsitePanel.Server&quot;.</li>
<li>Create new user account called &quot;WebsitePanelServer&quot; and update process identity
with it for &quot;WebsitePanel Server&quot; application pool. This user account must have
required privileges to manage computer resources (by default be a member of
local &quot;Administrators&quot; group) and also must be a member of &quot;IIS_IUSRS&quot; (IIS 7).</li>
<li>Create &quot;WebsitePanel Enterprise Server&quot; web site (with 127.0.0.1:9002
binding) using IIS Management Tool with
the root folder pointing to &quot;C:\Projects\WebsitePanel\Trunk\Sources\WebsitePanel.EnterpriseServer&quot;.</li>
<li>Create &quot;WebsitePanel Web Portal&quot; web site (with &lt;all unassigned&gt;:9001
binding) using IIS Management Tool with the
root folder pointing to &quot;C:\Projects\WebsitePanel\Trunk\Sources\WebsitePanel.WebPortal&quot;.</li>
<li>Open &quot;App_Data\SiteSettings.config&quot; file in &quot;WebsitePanel.WebPortal&quot; folder and
update URL to Enterprise Server (http://127.0.0.1:9002 by default).</li>
<li>Open web.config in the root of WebsitePanel.Server application and update
&quot;server access password&quot; (&quot;websitepanel.server/security/password&quot; element). You
should be able to generate password SHA1 hash using WebsitePanel.PasswordEncoder
tool.</li>
</ul>
</body>
</html>

View file

@ -1,208 +0,0 @@
<!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>
<title>WebsitePanel - Release Notes</title>
</head>
<body>
<h1>
WebsitePanel - Release Notes</h1>
<p>
<strong>July 14, 2011 - v1.2.0</strong></p>
<ul>
<li>Added: Support for managing private Hyper-V cloud solution implemented with System
Center Virtual Machine Manager 2008 R2, System Center Operations Manager 2007 and
Dynamic Data Center Toolkit v3 (Beta) (contributed by Austen Knowledge Group)</li>
<li>Added: Support of Helicon Ape module for securing files & folders on web-site level
(contributed by <a href="http://www.helicontech.com/" target="_blank">HeliconTech</a>)</li>
<li>Added: Support for Razor files extensions (*.cshtml, *.vbhtml) in File Manager</li>
<li>Added: "Notify Overused Databases" scheduled task (contributed by <a href="http://social.msdn.microsoft.com/profile/yoda-ict"
target="_blank">yoda-ict</a>)</li>
<li>Added: Display size for MySQL databases on Edit Database page (contributed by <a
href="http://social.msdn.microsoft.com/profile/yoda-ict" target="_blank">yoda-ict</a>)</li>
<li>Added: SSL Management (contributed by <a href="http://social.msdn.microsoft.com/profile/onionman/?type=forum&amp;referrer=http://social.msdn.microsoft.com/Forums/en-US/wspdiscuss/threads"
target="_blank">OnionMan</a>)</li>
<li>Added: Domain aliases changed to allow using existing DNS domains to setup aliases
and pointers (contributed by <a href="http://social.msdn.microsoft.com/profile/yoda-ict/?type=forum&amp;referrer=http://social.msdn.microsoft.com/Forums/en-US/wspdiscuss/thread/0053f21c-f7ee-4e97-8fd5-0e84cb046cc2"
target="_blank">yoda-ict</a>)</li>
<li>Added: "Announcements" posting mode for Mail Lists in hMail Server Service Provider</li>
<li>Added: Personal Information and Signature sections added in hMail Mail Account settings</li>
<li>Added: SMTP authentication for Mail Lists in hMail Server Provider</li>
<li>Updated: Project code base migrated to .NET Framework 4</li>
<li>Fixed: Minor corrections in default landing page supplied by WebsitePanel for newly
created web sites (contributed by <a href="http://social.msdn.microsoft.com/profile/jegor"
target="_blank">jegor</a>)</li>
<li>Fixed: Customer's first and last names with localized characters are not properly
rendered on some pages</li>
<li>Fixed: Issue with unlimited mailbox quotas in SmarterMail 7 service provider</li>
<li>Fixed: Dynamics CRM 4 rollup updates are not applied for new organizations being
created through WebsitePanel</li>
<li>Fixed: Original deployment error messages with sensitive information are shown to
a user instead of a generic error message in MS Web App Gallery module</li>
<li>Fixed: Dedicated IP Addresses are incorrectly distributed via Virtual Servers</li>
<li>Fixed: SQL User is unable to login with "Browse Database" feature if its password
has '=' character (contributed by <a href="http://social.msdn.microsoft.com/profile/webio"
target="_blank">webio</a>)</li>
<li>Fixed: Wrong default button on "Create New Exchange 2010 Organization" page</li>
<li>Fixed: Missing required validation for Forwarding field on Edit Mailbox Account
properties page (contributed by <a href="http://social.msdn.microsoft.com/profile/webio"
target="_blank">webio</a>)</li>
<li>Fixed: Adjust "maxRequestLength" attribute in "httpRuntime" element in WSP Enterprise
Server & Server web.config files to support large files uploading</li>
<li>Fixed: Missing information whether Administrator password is set or not in hMail
Provider Settings</li>
<li>Fixed: Issue with setting up a correct type handler for WebsitePanel.IisModules.SecureFolders
HTTP authentication module in IIS 7 (contributed by <a href="http://social.msdn.microsoft.com/profile/yoda-ict/?type=forum&amp;referrer=http://social.msdn.microsoft.com/Forums/en-US/wspdiscuss/thread/0053f21c-f7ee-4e97-8fd5-0e84cb046cc2"
target="_blank">yoda-ict</a>)</li>
<li>Fixed: Issue with Mail List members removed after clicking “Save List” button in
hMail Server Service Provider</li>
<li>Fixed: Issue when a domain alias could not be enabled for hMail Server Service Provider</li>
<li>Fixed: Issue when forwarding address is incorrectly set for a mail account in hMail
Server Service Provider</li>
<li>Fixed: Issue when integrity check is not performed if to add a contact in Hosted
Exchange Service Provider</li>
<li>Fixed: Issue when a user is unable to remove subscribers from the list or group
In Merak Mail Service Provider</li>
</ul>
<h1>
WebsitePanel - Release Notes</h1>
<p>
<strong>March 15, 2011 - v1.2.0 (Beta)</strong></p>
<ul>
<li>Added: Support for managing private Hyper-V cloud solution implemented with System Center Virtual Machine Manager 2008 R2, System Center Operations Manager 2007 and Dynamic Data Center Toolkit v3 (Beta) (contributed by Austen Knowledge Group)</li>
<li>Added: Support of Helicon Ape module for securing files & folders on web-site level (contributed by <a href="http://www.helicontech.com/" target="_blank">HeliconTech</a>)</li>
<li>Added: Support for Razor files extensions (*.cshtml, *.vbhtml) in File Manager</li>
<li>Added: "Notify Overused Databases" scheduled task (contributed by <a href="http://social.msdn.microsoft.com/profile/yoda-ict" target="_blank">yoda-ict</a>)</li>
<li>Added: Display size for MySQL databases on Edit Database page (contributed by <a href="http://social.msdn.microsoft.com/profile/yoda-ict" target="_blank">yoda-ict</a>)</li>
<li>Updated: Project code base migrated to .NET Framework 4</li>
<li>Fixed: Minor corrections in default landing page supplied by WebsitePanel for newly created web sites (contributed by <a href="http://social.msdn.microsoft.com/profile/jegor" target="_blank">jegor</a>)</li>
<li>Fixed: Customer's first and last names with localized characters are not properly rendered on some pages</li>
<li>Fixed: Issue with unlimited mailbox quotas in SmarterMail 7 service provider</li>
<li>Fixed: Dynamics CRM 4 rollup updates are not applied for new organizations being created through WebsitePanel</li>
<li>Fixed: Original deployment error messages with sensitive information are shown to a user instead of a generic error message in MS Web App Gallery module</li>
<li>Fixed: Dedicated IP Addresses are incorrectly distributed via Virtual Servers</li>
<li>Fixed: SQL User is unable to login with "Browse Database" feature if its password has '=' character (contributed by <a href="http://social.msdn.microsoft.com/profile/webio" target="_blank">webio</a>)</li>
<li>Fixed: Wrong default button on "Create New Exchange 2010 Organization" page</li>
<li>Fixed: Missing required validation for Forwarding field on Edit Mailbox Account properties page (contributed by <a href="http://social.msdn.microsoft.com/profile/webio"
target="_blank">webio</a>)</li>
<li>Fixed: Adjust "maxRequestLength" attribute in "httpRuntime" element in WSP Enterprise Server & Server web.config files to support large files uploading</li>
</ul>
<p>
<strong>December 9, 2010 - v1.1.1 (Beta)</strong></p>
<ul>
<li>Added: SSL Management (contributed by <a href="http://social.msdn.microsoft.com/profile/onionman/?type=forum&amp;referrer=http://social.msdn.microsoft.com/Forums/en-US/wspdiscuss/threads"
target="_blank">OnionMan</a>)</li>
<li>Added: Domain aliases changed to allow using existing DNS
domains to setup aliases and pointers (contributed by <a href="http://social.msdn.microsoft.com/profile/yoda-ict/?type=forum&amp;referrer=http://social.msdn.microsoft.com/Forums/en-US/wspdiscuss/thread/0053f21c-f7ee-4e97-8fd5-0e84cb046cc2"
target="_blank">yoda-ict</a>)</li>
<li>Added: "Announcements" posting mode for Mail Lists in hMail Server Service Provider</li>
<li>Added: Personal Information and Signature sections added in hMail Mail Account settings</li>
<li>Added: SMTP authentication for Mail Lists in hMail Server Provider</li>
<li>Fixed: Missing information whether Administrator password is set or not in hMail
Provider Settings</li>
<li>Fixed: Issue with setting up a correct type handler for WebsitePanel.IisModules.SecureFolders
HTTP authentication module in IIS 7 (contributed by <a href="http://social.msdn.microsoft.com/profile/yoda-ict/?type=forum&amp;referrer=http://social.msdn.microsoft.com/Forums/en-US/wspdiscuss/thread/0053f21c-f7ee-4e97-8fd5-0e84cb046cc2"
target="_blank">yoda-ict</a>)</li>
<li>Fixed: Issue with Mail List members removed after clicking “Save List” button in
hMail Server Service Provider</li>
<li>Fixed: Issue when a domain alias could not be enabled for hMail Server Service Provider</li>
<li>Fixed: Issue when forwarding address is incorrectly set for a mail account in hMail
Server Service Provider</li>
<li>Fixed: Issue when integrity check is not performed if to add a contact in Hosted
Exchange Service Provider</li>
<li>Fixed: Issue when a user is unable to remove subscribers from the list or group
In Merak Mail Service Provider</li>
</ul>
<p>
<strong>November 17, 2010 - v1.1.0</strong></p>
<ul>
<li>Added Exchange 2010 SP1 Hosting Mode module</li>
<li>Added SharePoint 2010 module (contributed by <a href="http://social.msdn.microsoft.com/profile/webio/?type=forum&amp;referrer=http://social.msdn.microsoft.com/Forums/en-US/wspdiscuss/threads"
target="_blank">Webio</a>)</li>
<li>Added SmarterMail 7 module (contributed by <a href="http://social.msdn.microsoft.com/profile/yoda-ict/?type=forum&amp;referrer=http://social.msdn.microsoft.com/Forums/en-US/wspdiscuss/thread/0053f21c-f7ee-4e97-8fd5-0e84cb046cc2"
target="_blank">yoda-ict</a>)</li>
<li>Added SmarterStats 6 module (contributed by <a href="http://social.msdn.microsoft.com/profile/yoda-ict/?type=forum&amp;referrer=http://social.msdn.microsoft.com/Forums/en-US/wspdiscuss/thread/0053f21c-f7ee-4e97-8fd5-0e84cb046cc2"
target="_blank">yoda-ict</a>)</li>
<li>Added: Addition to get the correct domain name inside the TaskManager (contributed
by <a href="http://social.msdn.microsoft.com/profile/yoda-ict/?type=forum&amp;referrer=http://social.msdn.microsoft.com/Forums/en-US/wspdiscuss/thread/0053f21c-f7ee-4e97-8fd5-0e84cb046cc2"
target="_blank">yoda-ict</a>)</li>
<li>Added: Workaround for Global Address list to show up after Exchange 2010 SP1 installation
without /hosting switch. This workaround is not switched on by default; to switch
it on, please follow the instructions provided in this <a href="http://social.msdn.microsoft.com/Forums/en-US/wspsupport/thread/342db243-a74b-4374-a848-d9edfbc7f072"
target="_blank">post</a>.</li>
<li>Added: WebsitePanel.IISModules (<a href="http://iismodules.codeplex.com/" target="_blank">http://iismodules.codeplex.com</a>)</li>
<li>Added: meta:resourcekey to BillingCyclesEditCycle.ascx and BillingCyclesAddCycle.ascx</li>
<li>Updated WSP Portal web.config in 1.1 upgrade script to enable custom error</li>
<li>Fixed: MDaemon alias import fails: Directory hardcoded in the module (contributed
by <a href="https://sourceforge.net/tracker/?func=detail&amp;atid=1330292&amp;aid=3032904&amp;group_id=316247"
target="_blank">mcrook</a>)</li>
<li>Fixed: When updating Exchange account general settings an empty account password
is stored into WSP database (contributed by <a href="http://social.msdn.microsoft.com/profile/webio/?type=forum&amp;referrer=http://social.msdn.microsoft.com/Forums/en-US/wspdiscuss/threads"
target="_blank">Webio</a>)</li>
<li>Fixed: Bug with mail aliases (MDaemon) (contributed by <a href="https://sourceforge.net/tracker/?func=detail&amp;atid=1330292&amp;aid=3032904&amp;group_id=316247"
target="_blank">mcrook</a>)</li>
<li>Fixed: SmarterMail 7: Max mailbox size -1 (contributed by <a href="http://social.msdn.microsoft.com/profile/yoda-ict/?type=forum&amp;referrer=http://social.msdn.microsoft.com/Forums/en-US/wspdiscuss/thread/0053f21c-f7ee-4e97-8fd5-0e84cb046cc2"
target="_blank">yoda-ict</a>)</li>
<li>Fixed: Not showing emails (MDaemon ODBC database) (contributed by <a href="https://sourceforge.net/tracker/?func=detail&amp;atid=1330292&amp;aid=3032904&amp;group_id=316247"
target="_blank">mcrook</a>)</li>
<li>Fixed: Show apps for all languages in Microsoft Web App Gallery module</li>
<li>Fixed: Microsoft Web Application Gallery 1.0.1 module - images missing when apps
catalog or an individual app page is displayed</li>
<li>Fixed: Exchange 2010 SP1 Beta module unable to create organization when plan quotas
are set to unlimited</li>
<li>Fixed: Customer login account gets error while clicking on "Export report" button
under Disk Space Report</li>
<li>Fixed: Microsoft SQL 2008 user creation with some characters fails</li>
<li>Fixed: Unable to restore Microsoft SQL Server 2008 R2 databases</li>
<li>Fixed: Zip Files Error in File Manager and related modules: cannot zip 65535 files
or greater</li>
<li>Fixed: Localization Toolkit Import is not working</li>
<li>Fixed: Problems calculating disk space for Exchange-enabled spaces</li>
<li>Fixed: Negative value is allowed in &quot;Max Mailbox Size, MB&quot; field when
create or edit a mail box</li>
<li>Fixed: Service provider properties are not updated/Missing UpdateServiceProperties
stored procedure in the database when do a fresh install</li>
<li>Fixed: Exchange 2010 SP1 Hosted Edition provider renamed to Exchange 2010 SP1 Hosting
Mode</li>
</ul>
<p>
<strong>September 3, 2010 - v1.0.2</strong></p>
<ul>
<li>Added Exchange 2010 SP1 Module Beta</li>
<li>Added SharePoint 2010 Module Beta (contributed by <a href="http://social.msdn.microsoft.com/profile/webio/?type=forum&amp;referrer=http://social.msdn.microsoft.com/Forums/en-US/wspdiscuss/threads">
Webio</a>)</li>
<li>Added SmarterMail 7 Module Beta (contributed by <a href="http://social.msdn.microsoft.com/profile/yoda-ict/?type=forum&amp;referrer=http://social.msdn.microsoft.com/Forums/en-US/wspdiscuss/thread/0053f21c-f7ee-4e97-8fd5-0e84cb046cc2">
yoda-ict</a>)</li>
<li>Added Exchange Import Tool for WSP 1.0 - WSP 1.0.2</li>
<li>Added “Disable Mailbox Size Edit” quota for “Mail” group</li>
<li>Fixed: Zip Files Error: cannot zip 65535 files or greater</li>
<li>Fixed: Microsoft Web Application Gallery 1.0.1 images missing bug</li>
<li>Fixed: Bug in Mail Aliases for Mdaemon (patch provided by <a href="https://sourceforge.net/tracker/?func=detail&amp;atid=1330292&amp;aid=3032904&amp;group_id=316247">
mcrook</a>)</li>
</ul>
<p>
<strong>July 8, 2010 - v1.0.1</strong></p>
<ul>
<li>Added Windows 7 and Windows Vista support.</li>
<li>Added &quot;All unassigned&quot; support for web site bindings.</li>
<li>&quot;Instant Alias&quot; is allowed in DNS-less hosting spaces.</li>
<li>Improved &quot;Web App Gallery&quot; module:<ul>
<li>all application packs are shown, but only those ones with satisfying requirements
could be installed</li>
<li>application packs are filtered by language and sorted alphabetically</li>
<li>added caching for applications graphics</li>
<li>re-designed application installation page</li>
<li>improved handling of databases and database users</li>
<li>improved errors reporting</li>
<li>temporary web site URL is displayed on completion screen</li>
</ul>
</li>
<li>Added for &quot;IIS 7&quot; provider an ability to specify paths to ASP.NET and
ASP ISAPIs.</li>
</ul>
<p>
<strong>April 16, 2010 - v1.0</strong></p>
<ul>
<li>Initial release of WebsitePanel under BSD license.</li>
</ul>
</body>
</html>

View file

@ -1,11 +1,11 @@
Windows Registry Editor Version 5.00
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog\MEACPTransportAgent]
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog\WSPTransportAgent]
"MaxSize"=dword:00080000
"AutoBackupLogFiles"=dword:00000000
"Retention"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog\MEACPTransportAgent\MEACPTransportAgent]
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog\WSPTransportAgent\WSPTransportAgent]
"EventMessageFile"=hex(2):43,00,3a,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77,\
00,73,00,5c,00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,2e,00,\
4e,00,45,00,54,00,5c,00,46,00,72,00,61,00,6d,00,65,00,77,00,6f,00,72,00,6b,\

View file

@ -0,0 +1,13 @@
WSP Transport Agent Installation
================================
Perform the following steps:
A) Copy the files WSPTransportAgent.dll and WSPTransportAgent.dll.config to "C:\Program Files\Microsoft\Exchange Server\V14\Public"
B) Import the WSPTransportAgent.reg to create the event source
C) Use the registry editor and provide the "NETWORK SERVICE" Full Control on the following Key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog\WSPTransportAgent
D) Run the following powershell command in the exchange management shell:
Install-TransportAgent "WSPTransportAgent" -TransportAgentFactory WSPTransportAgent.WSPRoutingAgentFactory -AssemblyPath "C:\Program Files\Microsoft\Exchange Server\V14\Public\WSPTransportAgent.dll"
E) Enable-TransportAgent "WSPTransportAgent"
F) Restart-Service MSExchangeTransport

View file

@ -100,6 +100,7 @@ namespace WebsitePanel.Import.Enterprise
Global.TempDomain = serviceSettings["TempDomain"];
ServerInfo serverInfo = ServerController.GetServerById(serviceInfo.ServerId);
Global.ADRootDomain = serverInfo.ADRootDomain;
Global.NetBiosDomain = ActiveDirectoryUtils.GetNETBIOSDomainName(Global.ADRootDomain);
}
private void OnBrowseOU(object sender, EventArgs e)

View file

@ -58,6 +58,13 @@ namespace WebsitePanel.Import.Enterprise
set { aDRootDomain = value; }
}
private static string netBiosDomain;
public static string NetBiosDomain
{
get { return netBiosDomain; }
set { netBiosDomain = value; }
}
public static PackageInfo Space;
public static string TempDomain;

View file

@ -757,15 +757,19 @@ namespace WebsitePanel.Import.Enterprise
if (EmailAddressExists(email))
return BusinessErrorCodes.ERROR_EXCHANGE_EMAIL_EXISTS;
if (AccountExists(accountName))
throw new Exception(string.Format("Account {0} already exists", accountName));
string displayName = (string)entry.Properties["displayName"].Value;
string samName = (string)entry.Properties["sAMAccountName"].Value;
// this should really NEVER happen - an AD account without sAMAccountName?!
if (string.IsNullOrEmpty(samName))
throw new Exception("SAMAccountName is not specified");
// add Netbios-Domainname before samAccountName - format in the database
samName = Global.NetBiosDomain + "\\" + samName;
int userId = AddOrganizationUser(itemId, accountName, displayName, email, string.Empty);
int userId = AddOrganizationUser(itemId, accountName, displayName, email, samName, string.Empty);
AddAccountEmailAddress(userId, email);
//account type
@ -796,7 +800,7 @@ namespace WebsitePanel.Import.Enterprise
return userId;
}
UpdateExchangeAccount(userId, accountName, accountType, displayName, email, false, string.Empty, string.Empty, string.Empty);
UpdateExchangeAccount(userId, accountName, accountType, displayName, email, false, string.Empty, samName, string.Empty);
string defaultEmail = (string)entry.Properties["extensionAttribute3"].Value;
@ -847,7 +851,7 @@ namespace WebsitePanel.Import.Enterprise
if (email != null && email.ToLower().StartsWith("smtp:"))
email = email.Substring(5);
// no sAMAccountName for contacts - so String.Empty is OK
int accountId = AddAccount(itemId, ExchangeAccountType.Contact, accountName, displayName, email, false, 0, string.Empty, null);
Log.WriteEnd("Contact imported");
@ -886,7 +890,14 @@ namespace WebsitePanel.Import.Enterprise
if (EmailAddressExists(email))
return BusinessErrorCodes.ERROR_EXCHANGE_EMAIL_EXISTS;
int accountId = AddAccount(itemId, ExchangeAccountType.DistributionList, accountName, displayName, email, false, 0, string.Empty, null);
string samName = (string)entry.Properties["sAMAccountName"].Value;
// this should really NEVER happen - an AD group without sAMAccountName?!
if (string.IsNullOrEmpty(samName))
throw new Exception("SAMAccountName is not specified");
// add Netbios-Domainname before samAccountName - format in the database
samName = Global.NetBiosDomain + "\\" + samName;
int accountId = AddAccount(itemId, ExchangeAccountType.DistributionList, accountName, displayName, email, false, 0, samName, null);
AddAccountEmailAddress(accountId, email);
string defaultEmail = (string)entry.Properties["extensionAttribute3"].Value;
@ -938,10 +949,10 @@ namespace WebsitePanel.Import.Enterprise
mailboxManagerActions.ToString(), samAccountName, CryptoUtils.Encrypt(accountPassword),0, string.Empty);
}
private static int AddOrganizationUser(int itemId, string accountName, string displayName, string email, string accountPassword)
private static int AddOrganizationUser(int itemId, string accountName, string displayName, string email, string samAccountName, string accountPassword)
{
return DataProvider.AddExchangeAccount(itemId, (int)ExchangeAccountType.User, accountName, displayName, email, false, string.Empty,
string.Empty, CryptoUtils.Encrypt(accountPassword),0 , string.Empty);
samAccountName, CryptoUtils.Encrypt(accountPassword), 0 , string.Empty);
}

View file

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.269
// Runtime Version:4.0.30319.17929
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.

View file

@ -1,7 +1,7 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.269
' Runtime Version:4.0.30319.17929
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.

View file

@ -114,6 +114,8 @@ namespace WebsitePanel.EnterpriseServer
public const int ERROR_WEB_SITE_IP_ADDRESS_NOT_SPECIFIED = -607;
public const int ERROR_WEB_SITE_SHARED_IP_ADDRESS_NOT_SPECIFIED = -608;
public const int ERROR_WEB_SHARED_SSL_QUOTA_LIMIT = -609;
public const int ERROR_GLOBALDNS_FOR_DEDICATEDIP = -610;
public const int ERROR_PUBLICSHAREDIP_FOR_SHAREDIP = -611;
#endregion
#region Mail
@ -322,6 +324,7 @@ namespace WebsitePanel.EnterpriseServer
public const int ERROR_USERS_RESOURCE_QUOTA_LIMIT = -2707;
public const int CURRENT_USER_IS_CRM_USER = -2708;
public const int CURRENT_USER_IS_OCS_USER = -2709;
public const int CURRENT_USER_IS_LYNC_USER = -2710;
#endregion

View file

@ -36,6 +36,7 @@ namespace WebsitePanel.EnterpriseServer
{
string emailAddress;
bool isPrimary;
bool iSuserPrincipalName;
public string EmailAddress
{
@ -48,5 +49,12 @@ namespace WebsitePanel.EnterpriseServer
get { return this.isPrimary; }
set { this.isPrimary = value; }
}
public bool IsUserPrincipalName
{
get { return iSuserPrincipalName; }
set { iSuserPrincipalName = value; }
}
}
}

View file

@ -50,7 +50,7 @@ order by rg.groupOrder
public const string OS_MINIMUMTASKINTERVAL = "OS.MinimumTaskInterval"; // Minimum Tasks Interval, minutes
public const string OS_APPINSTALLER = "OS.AppInstaller"; // Applications Installer
public const string OS_EXTRAAPPLICATIONS = "OS.ExtraApplications"; // Extra Application Packs
public const string OS_ALLOWTENANTCREATEDOMAINS = "OS.AllowTenantCreateDomains"; // Allow tenant to create top level domains
public const string OS_NOTALLOWTENANTCREATEDOMAINS = "OS.AllowTenantCreateDomains"; // Do not Allow tenant to create top level domains
public const string WEB_SITES = "Web.Sites"; // Web Sites
public const string WEB_ASPNET11 = "Web.AspNet11"; // ASP.NET 1.1
public const string WEB_ASPNET20 = "Web.AspNet20"; // ASP.NET 2.0
@ -79,6 +79,8 @@ order by rg.groupOrder
public const string WEB_CFVIRTUALDIRS = "Web.CFVirtualDirectories"; //ColdFusion Virtual Directories
public const string WEB_REMOTEMANAGEMENT = "Web.RemoteManagement"; //IIS 7 Remote Management
public const string WEB_SSL = "Web.SSL"; //SSL
public const string WEB_ALLOWIPADDRESSMODESWITCH = "Web.AllowIPAddressModeSwitch"; //Allow to switch IP Address Mode
public const string WEB_ENABLEHOSTNAMESUPPORT = "Web.EnableHostNameSupport"; //Enable to specify hostnames upon site creation
public const string FTP_ACCOUNTS = "FTP.Accounts"; // FTP Accounts
public const string MAIL_ACCOUNTS = "Mail.Accounts"; // Mail Accounts
public const string MAIL_FORWARDINGS = "Mail.Forwardings"; // Mail Forwardings
@ -148,6 +150,7 @@ order by rg.groupOrder
public const string ORGANIZATIONS = "HostedSolution.Organizations";
public const string ORGANIZATION_USERS = "HostedSolution.Users";
public const string ORGANIZATION_DOMAINS = "HostedSolution.Domains";
public const string ORGANIZATION_ALLOWCHANGEUPN = "HostedSolution.AllowChangeUPN";
public const string CRM_USERS = "HostedCRM.Users";
public const string CRM_ORGANIZATION = "HostedCRM.Organization";

View file

@ -36,6 +36,7 @@ namespace WebsitePanel.EnterpriseServer
private int domainId;
private int packageId;
private int zoneItemId;
private int domainItemId;
private string domainName;
private bool hostingAllowed;
private int webSiteId;
@ -68,6 +69,13 @@ namespace WebsitePanel.EnterpriseServer
set { zoneItemId = value; }
}
public int DomainItemId
{
get { return domainItemId; }
set { domainItemId = value; }
}
public string DomainName
{
get { return domainName; }

View file

@ -29,7 +29,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.6387
// Runtime Version:2.0.50727.6400
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -53,7 +53,6 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
@ -85,6 +84,8 @@ namespace WebsitePanel.EnterpriseServer {
private System.Threading.SendOrPostCallback GetLyncUserGeneralSettingsOperationCompleted;
private System.Threading.SendOrPostCallback SetLyncUserGeneralSettingsOperationCompleted;
private System.Threading.SendOrPostCallback SetUserLyncPlanOperationCompleted;
private System.Threading.SendOrPostCallback GetFederationDomainsOperationCompleted;
@ -134,6 +135,9 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/>
public event GetLyncUserGeneralSettingsCompletedEventHandler GetLyncUserGeneralSettingsCompleted;
/// <remarks/>
public event SetLyncUserGeneralSettingsCompletedEventHandler SetLyncUserGeneralSettingsCompleted;
/// <remarks/>
public event SetUserLyncPlanCompletedEventHandler SetUserLyncPlanCompleted;
@ -680,6 +684,56 @@ namespace WebsitePanel.EnterpriseServer {
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/SetLyncUserGeneralSettings", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public LyncUserResult SetLyncUserGeneralSettings(int itemId, int accountId, string sipAddress, string lineUri) {
object[] results = this.Invoke("SetLyncUserGeneralSettings", new object[] {
itemId,
accountId,
sipAddress,
lineUri});
return ((LyncUserResult)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginSetLyncUserGeneralSettings(int itemId, int accountId, string sipAddress, string lineUri, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("SetLyncUserGeneralSettings", new object[] {
itemId,
accountId,
sipAddress,
lineUri}, callback, asyncState);
}
/// <remarks/>
public LyncUserResult EndSetLyncUserGeneralSettings(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((LyncUserResult)(results[0]));
}
/// <remarks/>
public void SetLyncUserGeneralSettingsAsync(int itemId, int accountId, string sipAddress, string lineUri) {
this.SetLyncUserGeneralSettingsAsync(itemId, accountId, sipAddress, lineUri, null);
}
/// <remarks/>
public void SetLyncUserGeneralSettingsAsync(int itemId, int accountId, string sipAddress, string lineUri, object userState) {
if ((this.SetLyncUserGeneralSettingsOperationCompleted == null)) {
this.SetLyncUserGeneralSettingsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetLyncUserGeneralSettingsOperationCompleted);
}
this.InvokeAsync("SetLyncUserGeneralSettings", new object[] {
itemId,
accountId,
sipAddress,
lineUri}, this.SetLyncUserGeneralSettingsOperationCompleted, userState);
}
private void OnSetLyncUserGeneralSettingsOperationCompleted(object arg) {
if ((this.SetLyncUserGeneralSettingsCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.SetLyncUserGeneralSettingsCompleted(this, new SetLyncUserGeneralSettingsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/SetUserLyncPlan", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public LyncUserResult SetUserLyncPlan(int itemId, int accountId, int lyncUserPlanId) {
@ -1177,6 +1231,32 @@ namespace WebsitePanel.EnterpriseServer {
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void SetLyncUserGeneralSettingsCompletedEventHandler(object sender, SetLyncUserGeneralSettingsCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class SetLyncUserGeneralSettingsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal SetLyncUserGeneralSettingsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public LyncUserResult Result {
get {
this.RaiseExceptionIfNecessary();
return ((LyncUserResult)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void SetUserLyncPlanCompletedEventHandler(object sender, SetUserLyncPlanCompletedEventArgs e);

View file

@ -29,7 +29,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.6387
// Runtime Version:2.0.50727.6400
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -85,6 +85,8 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
private System.Threading.SendOrPostCallback AddOrganizationDomainOperationCompleted;
private System.Threading.SendOrPostCallback ChangeOrganizationDomainTypeOperationCompleted;
private System.Threading.SendOrPostCallback GetOrganizationDomainsOperationCompleted;
private System.Threading.SendOrPostCallback DeleteOrganizationDomainOperationCompleted;
@ -101,6 +103,10 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
private System.Threading.SendOrPostCallback SetUserGeneralSettingsOperationCompleted;
private System.Threading.SendOrPostCallback SetUserPrincipalNameOperationCompleted;
private System.Threading.SendOrPostCallback SetUserPasswordOperationCompleted;
private System.Threading.SendOrPostCallback SearchAccountsOperationCompleted;
private System.Threading.SendOrPostCallback DeleteUserOperationCompleted;
@ -145,6 +151,9 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
/// <remarks/>
public event AddOrganizationDomainCompletedEventHandler AddOrganizationDomainCompleted;
/// <remarks/>
public event ChangeOrganizationDomainTypeCompletedEventHandler ChangeOrganizationDomainTypeCompleted;
/// <remarks/>
public event GetOrganizationDomainsCompletedEventHandler GetOrganizationDomainsCompleted;
@ -169,6 +178,12 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
/// <remarks/>
public event SetUserGeneralSettingsCompletedEventHandler SetUserGeneralSettingsCompleted;
/// <remarks/>
public event SetUserPrincipalNameCompletedEventHandler SetUserPrincipalNameCompleted;
/// <remarks/>
public event SetUserPasswordCompletedEventHandler SetUserPasswordCompleted;
/// <remarks/>
public event SearchAccountsCompletedEventHandler SearchAccountsCompleted;
@ -180,20 +195,22 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/CreateOrganization", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int CreateOrganization(int packageId, string organizationID, string organizationName) {
public int CreateOrganization(int packageId, string organizationID, string organizationName, string domainName) {
object[] results = this.Invoke("CreateOrganization", new object[] {
packageId,
organizationID,
organizationName});
organizationName,
domainName});
return ((int)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginCreateOrganization(int packageId, string organizationID, string organizationName, System.AsyncCallback callback, object asyncState) {
public System.IAsyncResult BeginCreateOrganization(int packageId, string organizationID, string organizationName, string domainName, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("CreateOrganization", new object[] {
packageId,
organizationID,
organizationName}, callback, asyncState);
organizationName,
domainName}, callback, asyncState);
}
/// <remarks/>
@ -203,19 +220,20 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
}
/// <remarks/>
public void CreateOrganizationAsync(int packageId, string organizationID, string organizationName) {
this.CreateOrganizationAsync(packageId, organizationID, organizationName, null);
public void CreateOrganizationAsync(int packageId, string organizationID, string organizationName, string domainName) {
this.CreateOrganizationAsync(packageId, organizationID, organizationName, domainName, null);
}
/// <remarks/>
public void CreateOrganizationAsync(int packageId, string organizationID, string organizationName, object userState) {
public void CreateOrganizationAsync(int packageId, string organizationID, string organizationName, string domainName, object userState) {
if ((this.CreateOrganizationOperationCompleted == null)) {
this.CreateOrganizationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateOrganizationOperationCompleted);
}
this.InvokeAsync("CreateOrganization", new object[] {
packageId,
organizationID,
organizationName}, this.CreateOrganizationOperationCompleted, userState);
organizationName,
domainName}, this.CreateOrganizationOperationCompleted, userState);
}
private void OnCreateOrganizationOperationCompleted(object arg) {
@ -686,6 +704,53 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/ChangeOrganizationDomainType", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int ChangeOrganizationDomainType(int itemId, int domainId, ExchangeAcceptedDomainType newDomainType) {
object[] results = this.Invoke("ChangeOrganizationDomainType", new object[] {
itemId,
domainId,
newDomainType});
return ((int)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginChangeOrganizationDomainType(int itemId, int domainId, ExchangeAcceptedDomainType newDomainType, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("ChangeOrganizationDomainType", new object[] {
itemId,
domainId,
newDomainType}, callback, asyncState);
}
/// <remarks/>
public int EndChangeOrganizationDomainType(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
/// <remarks/>
public void ChangeOrganizationDomainTypeAsync(int itemId, int domainId, ExchangeAcceptedDomainType newDomainType) {
this.ChangeOrganizationDomainTypeAsync(itemId, domainId, newDomainType, null);
}
/// <remarks/>
public void ChangeOrganizationDomainTypeAsync(int itemId, int domainId, ExchangeAcceptedDomainType newDomainType, object userState) {
if ((this.ChangeOrganizationDomainTypeOperationCompleted == null)) {
this.ChangeOrganizationDomainTypeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnChangeOrganizationDomainTypeOperationCompleted);
}
this.InvokeAsync("ChangeOrganizationDomainType", new object[] {
itemId,
domainId,
newDomainType}, this.ChangeOrganizationDomainTypeOperationCompleted, userState);
}
private void OnChangeOrganizationDomainTypeOperationCompleted(object arg) {
if ((this.ChangeOrganizationDomainTypeCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.ChangeOrganizationDomainTypeCompleted(this, new ChangeOrganizationDomainTypeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetOrganizationDomains", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public OrganizationDomainName[] GetOrganizationDomains(int itemId) {
@ -1280,6 +1345,103 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/SetUserPrincipalName", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int SetUserPrincipalName(int itemId, int accountId, string userPrincipalName, bool inherit) {
object[] results = this.Invoke("SetUserPrincipalName", new object[] {
itemId,
accountId,
userPrincipalName,
inherit});
return ((int)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginSetUserPrincipalName(int itemId, int accountId, string userPrincipalName, bool inherit, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("SetUserPrincipalName", new object[] {
itemId,
accountId,
userPrincipalName,
inherit}, callback, asyncState);
}
/// <remarks/>
public int EndSetUserPrincipalName(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
/// <remarks/>
public void SetUserPrincipalNameAsync(int itemId, int accountId, string userPrincipalName, bool inherit) {
this.SetUserPrincipalNameAsync(itemId, accountId, userPrincipalName, inherit, null);
}
/// <remarks/>
public void SetUserPrincipalNameAsync(int itemId, int accountId, string userPrincipalName, bool inherit, object userState) {
if ((this.SetUserPrincipalNameOperationCompleted == null)) {
this.SetUserPrincipalNameOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetUserPrincipalNameOperationCompleted);
}
this.InvokeAsync("SetUserPrincipalName", new object[] {
itemId,
accountId,
userPrincipalName,
inherit}, this.SetUserPrincipalNameOperationCompleted, userState);
}
private void OnSetUserPrincipalNameOperationCompleted(object arg) {
if ((this.SetUserPrincipalNameCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.SetUserPrincipalNameCompleted(this, new SetUserPrincipalNameCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/SetUserPassword", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int SetUserPassword(int itemId, int accountId, string password) {
object[] results = this.Invoke("SetUserPassword", new object[] {
itemId,
accountId,
password});
return ((int)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginSetUserPassword(int itemId, int accountId, string password, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("SetUserPassword", new object[] {
itemId,
accountId,
password}, callback, asyncState);
}
/// <remarks/>
public int EndSetUserPassword(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
/// <remarks/>
public void SetUserPasswordAsync(int itemId, int accountId, string password) {
this.SetUserPasswordAsync(itemId, accountId, password, null);
}
/// <remarks/>
public void SetUserPasswordAsync(int itemId, int accountId, string password, object userState) {
if ((this.SetUserPasswordOperationCompleted == null)) {
this.SetUserPasswordOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetUserPasswordOperationCompleted);
}
this.InvokeAsync("SetUserPassword", new object[] {
itemId,
accountId,
password}, this.SetUserPasswordOperationCompleted, userState);
}
private void OnSetUserPasswordOperationCompleted(object arg) {
if ((this.SetUserPasswordCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.SetUserPasswordCompleted(this, new SetUserPasswordCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/SearchAccounts", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public OrganizationUser[] SearchAccounts(int itemId, string filterColumn, string filterValue, string sortColumn, bool includeMailboxes) {
@ -1710,6 +1872,32 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void ChangeOrganizationDomainTypeCompletedEventHandler(object sender, ChangeOrganizationDomainTypeCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class ChangeOrganizationDomainTypeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal ChangeOrganizationDomainTypeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public int Result {
get {
this.RaiseExceptionIfNecessary();
return ((int)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetOrganizationDomainsCompletedEventHandler(object sender, GetOrganizationDomainsCompletedEventArgs e);
@ -1918,6 +2106,58 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void SetUserPrincipalNameCompletedEventHandler(object sender, SetUserPrincipalNameCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class SetUserPrincipalNameCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal SetUserPrincipalNameCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public int Result {
get {
this.RaiseExceptionIfNecessary();
return ((int)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void SetUserPasswordCompletedEventHandler(object sender, SetUserPasswordCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class SetUserPasswordCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal SetUserPasswordCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public int Result {
get {
this.RaiseExceptionIfNecessary();
return ((int)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void SearchAccountsCompletedEventHandler(object sender, SearchAccountsCompletedEventArgs e);

View file

@ -2,7 +2,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C57D3F9F-7BA0-4D38-A159-B6EDA5C19B13}"
ProjectSection(SolutionItems) = preProject
..\Database\install_db.sql = ..\Database\install_db.sql
..\..\LICENSE.txt = ..\..\LICENSE.txt
..\..\Readme.htm = ..\..\Readme.htm
..\..\ReleaseNotes.htm = ..\..\ReleaseNotes.htm

View file

@ -5,7 +5,7 @@ using System.Web;
namespace WebsitePanel.EnterpriseServer {
public struct IPAddress {
public struct IPAddress : IComparable {
public Int128 Address;
public bool V6 { get; private set; }
public bool V4 { get { return !V6 || Null; } }
@ -68,10 +68,19 @@ namespace WebsitePanel.EnterpriseServer {
if (Null)
return "";
var s = new System.Text.StringBuilder();
if (!V6) {
var ipl = (long)Address;
if (!V6)
{
var ipl = Address;
if (IsMask)
{
int digits = 32 - Cidr;
ipl = (Int128.MaxValue << 1) | 0x1; // remove left sign bit
ipl = ipl << digits;
}
s.Append(String.Format("{0}.{1}.{2}.{3}", (ipl >> 24) & 0xFFL, (ipl >> 16) & 0xFFL, (ipl >> 8) & 0xFFL, (ipl & 0xFFL)));
} else if (!IsMask) {
}
else if (!IsMask)
{
var vals = new List<int>();
int i;
@ -127,6 +136,30 @@ namespace WebsitePanel.EnterpriseServer {
public static bool operator >(IPAddress a, IPAddress b) { return a.Address > b.Address; }
public static bool operator <=(IPAddress a, IPAddress b) { return a.Address <= b.Address; }
public static bool operator >=(IPAddress a, IPAddress b) { return a.Address >= b.Address; }
public override bool Equals(object obj)
{
if (obj is IPAddress)
{
var b = (IPAddress)obj;
return this.Address == b.Address && this.Null == b.Null && (this.Null || !(this.IsSubnet && b.IsSubnet || this.IsMask && b.IsMask) || this.Cidr == b.Cidr);
}
else if (obj is long)
{
var b = (long)obj;
return this.Address == b;
}
else
{
return false;
}
}
public override int GetHashCode()
{
return this.Address.GetHashCode();
}
/*
public static IPAddress operator +(IPAddress a, IPAddress b) {
if (a.IsSubnet || b.IsSubnet || a.V6 != b.V6) throw new ArgumentException("Arithmetic with subnets or mixed v4 & v6 addresses not supported.");
@ -149,7 +182,7 @@ namespace WebsitePanel.EnterpriseServer {
}
public static IPAddress operator &(IPAddress a, IPAddress b) {
if (a.V6 != b.V6) throw new ArgumentException("Arithmetic with mixed v4 & v6 addresses not supported.");
return new IPAddress { Address = a.Address | b.Address, Cidr = a.V4 ? 32 : 128, Null = false, V6 = a.V6, IsSubnet = false };
return new IPAddress { Address = a.Address & b.Address, Cidr = a.V4 ? 32 : 128, Null = false, V6 = a.V6, IsSubnet = false };
}
public static IPAddress operator ~(IPAddress a) {
if (a.Null) return new IPAddress { Address = 0, Null = true, Cidr = a.V4 ? 32 : 128, V6 = true, IsSubnet = false };
@ -157,6 +190,19 @@ namespace WebsitePanel.EnterpriseServer {
}
public static implicit operator IPAddress(NullIPAddress a) { return new IPAddress { Null = true, Address = 0, Cidr = -1 }; }
public int CompareTo(object obj)
{
var a = this.Address;
var b = ((IPAddress)obj).Address;
if (a < b)
return 1;
else if (a > b)
return -1;
else
return 0;
}
}
public class NullIPAddress { }

View file

@ -785,14 +785,35 @@ namespace WebsitePanel.EnterpriseServer
new SqlParameter("@domainId", domainId));
}
public static IDataReader GetDomainByName(int actorId, string domainName)
public static IDataReader GetDomainByName(int actorId, string domainName, bool searchOnDomainPointer, bool isDomainPointer)
{
return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
ObjectQualifier + "GetDomainByName",
new SqlParameter("@ActorId", actorId),
new SqlParameter("@domainName", domainName));
new SqlParameter("@domainName", domainName),
new SqlParameter("@SearchOnDomainPointer", searchOnDomainPointer),
new SqlParameter("@IsDomainPointer", isDomainPointer));
}
public static DataSet GetDomainsByZoneId(int actorId, int zoneId)
{
return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
ObjectQualifier + "GetDomainsByZoneID",
new SqlParameter("@ActorId", actorId),
new SqlParameter("@ZoneID", zoneId));
}
public static DataSet GetDomainsByDomainItemId(int actorId, int domainId)
{
return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
ObjectQualifier + "GetDomainsByDomainItemId",
new SqlParameter("@ActorId", actorId),
new SqlParameter("@DomainID", domainId));
}
public static int CheckDomain(int packageId, string domainName, bool isDomainPointer)
{
SqlParameter prmId = new SqlParameter("@Result", SqlDbType.Int);
@ -808,6 +829,22 @@ namespace WebsitePanel.EnterpriseServer
return Convert.ToInt32(prmId.Value);
}
public static int CheckDomainUsedByHostedOrganization(string domainName)
{
SqlParameter prmId = new SqlParameter("@Result", SqlDbType.Int);
prmId.Direction = ParameterDirection.Output;
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
ObjectQualifier + "CheckDomainUsedByHostedOrganization",
prmId,
new SqlParameter("@domainName", domainName));
return Convert.ToInt32(prmId.Value);
}
public static int AddDomain(int actorId, int packageId, int zoneItemId, string domainName,
bool hostingAllowed, int webSiteId, int mailDomainId, bool isSubDomain, bool isInstantAlias, bool isDomainPointer)
{
@ -832,7 +869,7 @@ namespace WebsitePanel.EnterpriseServer
}
public static void UpdateDomain(int actorId, int domainId, int zoneItemId,
bool hostingAllowed, int webSiteId, int mailDomainId)
bool hostingAllowed, int webSiteId, int mailDomainId, int domainItemId)
{
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,
ObjectQualifier + "UpdateDomain",
@ -841,7 +878,8 @@ namespace WebsitePanel.EnterpriseServer
new SqlParameter("@ZoneItemId", zoneItemId),
new SqlParameter("@HostingAllowed", hostingAllowed),
new SqlParameter("@WebSiteId", webSiteId),
new SqlParameter("@MailDomainId", mailDomainId));
new SqlParameter("@MailDomainId", mailDomainId),
new SqlParameter("@DomainItemId", domainItemId));
}
public static void DeleteDomain(int actorId, int domainId)
@ -2153,6 +2191,18 @@ namespace WebsitePanel.EnterpriseServer
);
}
public static void ChangeExchangeAcceptedDomainType(int itemId, int domainId, int domainTypeId)
{
SqlHelper.ExecuteNonQuery(
ConnectionString,
CommandType.StoredProcedure,
"ChangeExchangeAcceptedDomainType",
new SqlParameter("@ItemID", itemId),
new SqlParameter("@DomainID", domainId),
new SqlParameter("@DomainTypeID", domainTypeId)
);
}
public static IDataReader GetExchangeOrganizationStatistics(int itemId)
{
return SqlHelper.ExecuteReader(
@ -2304,6 +2354,16 @@ namespace WebsitePanel.EnterpriseServer
);
}
public static void UpdateExchangeAccountUserPrincipalName(int accountId, string userPrincipalName)
{
SqlHelper.ExecuteNonQuery(
ConnectionString,
CommandType.StoredProcedure,
"UpdateExchangeAccountUserPrincipalName",
new SqlParameter("@AccountID", accountId),
new SqlParameter("@UserPrincipalName", userPrincipalName));
}
public static IDataReader GetExchangeAccount(int itemId, int accountId)
{
return SqlHelper.ExecuteReader(
@ -2549,6 +2609,18 @@ namespace WebsitePanel.EnterpriseServer
);
}
public static IDataReader GetExchangeOrganization(int itemId)
{
return SqlHelper.ExecuteReader(
ConnectionString,
CommandType.StoredProcedure,
"GetExchangeOrganization",
new SqlParameter("@ItemID", itemId)
);
}
public static void SetOrganizationDefaultExchangeMailboxPlan(int itemId, int mailboxPlanId)
{
SqlHelper.ExecuteNonQuery(
@ -3211,7 +3283,7 @@ namespace WebsitePanel.EnterpriseServer
#region Lync
public static void AddLyncUser(int accountId, int lyncUserPlanId)
public static void AddLyncUser(int accountId, int lyncUserPlanId, string sipAddress)
{
SqlHelper.ExecuteNonQuery(ConnectionString,
CommandType.StoredProcedure,
@ -3219,10 +3291,24 @@ namespace WebsitePanel.EnterpriseServer
new[]
{
new SqlParameter("@AccountID", accountId),
new SqlParameter("@LyncUserPlanID", lyncUserPlanId)
new SqlParameter("@LyncUserPlanID", lyncUserPlanId),
new SqlParameter("@SipAddress", sipAddress)
});
}
public static void UpdateLyncUser(int accountId, string sipAddress)
{
SqlHelper.ExecuteNonQuery(ConnectionString,
CommandType.StoredProcedure,
"UpdateLyncUser",
new[]
{
new SqlParameter("@AccountID", accountId),
new SqlParameter("@SipAddress", sipAddress)
});
}
public static bool CheckLyncUserExists(int accountId)
{
int res = (int)SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, "CheckLyncUserExists",
@ -3230,6 +3316,25 @@ namespace WebsitePanel.EnterpriseServer
return res > 0;
}
public static bool LyncUserExists(int accountId, string sipAddress)
{
SqlParameter outParam = new SqlParameter("@Exists", SqlDbType.Bit);
outParam.Direction = ParameterDirection.Output;
SqlHelper.ExecuteNonQuery(
ConnectionString,
CommandType.StoredProcedure,
"LyncUserExists",
new SqlParameter("@AccountID", accountId),
new SqlParameter("@SipAddress", sipAddress),
outParam
);
return Convert.ToBoolean(outParam.Value);
}
public static IDataReader GetLyncUsers(int itemId, string sortColumn, string sortDirection, int startRow, int count)
{
SqlParameter[] sqlParams = new SqlParameter[]
@ -3402,7 +3507,6 @@ namespace WebsitePanel.EnterpriseServer
public static int GetPackageIdByName(string Name)
{
// get Helicon Zoo provider
int packageId = -1;
List<ProviderInfo> providers = ServerController.GetProviders();
foreach (ProviderInfo providerInfo in providers)
@ -3414,10 +3518,10 @@ namespace WebsitePanel.EnterpriseServer
}
}
if (-1 == packageId)
{
throw new Exception("Provider not found");
}
//if (-1 == packageId)
//{
// throw new Exception("Provider not found");
//}
return packageId;
}

View file

@ -47,10 +47,10 @@ namespace WebsitePanel.EnterpriseServer
public static int AddZone(int packageId, int serviceId, string zoneName)
{
return AddZone(packageId, serviceId, zoneName, true);
return AddZone(packageId, serviceId, zoneName, true, false);
}
public static int AddZone(int packageId, int serviceId, string zoneName, bool addPackageItem)
public static int AddZone(int packageId, int serviceId, string zoneName, bool addPackageItem, bool ignoreGlobalDNSRecords)
{
// get DNS provider
DNSServer dns = GetDNSServer(serviceId);
@ -148,13 +148,17 @@ namespace WebsitePanel.EnterpriseServer
zoneRecords.Add(ns);
}
if (!ignoreGlobalDNSRecords)
{
// add all other records
zoneRecords.AddRange(BuildDnsResourceRecords(records, "", zoneName, ""));
}
// add zone records
dns.AddZoneRecords(zoneName, zoneRecords.ToArray());
// add secondary zones
foreach (int secondaryId in secondaryServiceIds)
{
@ -202,6 +206,7 @@ namespace WebsitePanel.EnterpriseServer
return zoneItemId;
}
public static int DeleteZone(int zoneItemId)
{
// delete DNS zone if applicable
@ -283,8 +288,13 @@ namespace WebsitePanel.EnterpriseServer
if (record.RecordType == "A" || record.RecordType == "AAAA")
{
// If the service IP address and the DNS records external address are empty / null SimpleDNS will fail to properly create the zone record
if (String.IsNullOrEmpty(serviceIP) && String.IsNullOrEmpty(record.ExternalIP) && String.IsNullOrEmpty(record.RecordData))
continue;
rr.RecordData = String.IsNullOrEmpty(record.RecordData) ? record.ExternalIP : record.RecordData;
rr.RecordData = Utils.ReplaceStringVariable(rr.RecordData, "ip", record.ExternalIP);
rr.RecordData = Utils.ReplaceStringVariable(rr.RecordData, "ip", string.IsNullOrEmpty(serviceIP) ? record.ExternalIP : serviceIP);
rr.RecordData = Utils.ReplaceStringVariable(rr.RecordData, "domain_name", string.IsNullOrEmpty(domainName) ? string.Empty : domainName);
if (String.IsNullOrEmpty(rr.RecordData) && !String.IsNullOrEmpty(serviceIP))
rr.RecordData = serviceIP;
@ -315,7 +325,6 @@ namespace WebsitePanel.EnterpriseServer
zoneRecords.Add(rr);
}
}
return zoneRecords;
}
@ -443,7 +452,7 @@ namespace WebsitePanel.EnterpriseServer
if (!dns.ZoneExists(itemName))
{
// create primary and secondary zones
AddZone(packageId, serviceId, itemName, false);
AddZone(packageId, serviceId, itemName, false, false);
// restore records
XmlSerializer serializer = new XmlSerializer(typeof(DnsRecord));

View file

@ -446,11 +446,31 @@ namespace WebsitePanel.EnterpriseServer
{
hubTransportRole.AddAuthoritativeDomain(domain.DomainName);
}
if (domain.DomainType != ExchangeAcceptedDomainType.Authoritative)
{
hubTransportRole.ChangeAcceptedDomainType(domain.DomainName, domain.DomainType);
}
}
authDomainCreated = true;
break;
}
foreach (OrganizationDomainName d in domains)
{
DomainInfo domain = ServerController.GetDomain(d.DomainId);
//Add the service records
if (domain != null)
{
if (domain.ZoneItemId != 0)
{
ServerController.AddServiceDNSRecords(org.PackageId, ResourceGroups.Exchange, domain, "");
ServerController.AddServiceDNSRecords(org.PackageId, ResourceGroups.BlackBerry, domain, "");
ServerController.AddServiceDNSRecords(org.PackageId, ResourceGroups.OCS, domain, "");
}
}
}
// 4) Add the address book policy (Exchange 2010 SP2
//
@ -747,7 +767,7 @@ namespace WebsitePanel.EnterpriseServer
// load account
ExchangeAccount account = GetAccount(itemId, accountId);
return exchange.GetMailboxStatistics(account.AccountName);
return exchange.GetMailboxStatistics(account.UserPrincipalName);
}
catch (Exception ex)
{
@ -1221,6 +1241,9 @@ namespace WebsitePanel.EnterpriseServer
string CounterStr = "00000";
int counter = 0;
bool bFound = false;
if (!AccountExists(accountName)) return accountName;
do
{
accountName = genSamLogin(name, CounterStr);
@ -1293,8 +1316,13 @@ namespace WebsitePanel.EnterpriseServer
if (String.Compare(account.PrimaryEmailAddress, email.EmailAddress, true) == 0)
{
email.IsPrimary = true;
break;
}
if (String.Compare(account.UserPrincipalName, email.EmailAddress, true) == 0)
{
email.IsUserPrincipalName = true;
}
}
return emails.ToArray();
@ -1412,6 +1440,15 @@ namespace WebsitePanel.EnterpriseServer
break;
}
//Add the service records
if (domain != null)
{
if (domain.ZoneItemId != 0)
{
ServerController.AddServiceDNSRecords(org.PackageId, ResourceGroups.Exchange, domain, "");
}
}
return 0;
}
catch (Exception ex)
@ -1424,7 +1461,63 @@ namespace WebsitePanel.EnterpriseServer
}
}
public static int ChangeAcceptedDomainType(int itemId, int domainId, ExchangeAcceptedDomainType domainType)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
if (accountCheck < 0) return accountCheck;
// place log record
TaskManager.StartTask("EXCHANGE", "CHANGE_DOMAIN_TYPE");
TaskManager.TaskParameters["Domain ID"] = domainId;
TaskManager.TaskParameters["Domain Type"] = domainType.ToString();
TaskManager.ItemId = itemId;
try
{
// load organization
Organization org = (Organization)PackageController.GetPackageItem(itemId);
if (org == null)
return -1;
// load domain
DomainInfo domain = ServerController.GetDomain(domainId);
if (domain == null)
return -1;
int[] hubTransportServiceIds;
int[] clientAccessServiceIds;
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
GetExchangeServices(exchangeServiceId, out hubTransportServiceIds, out clientAccessServiceIds);
foreach (int id in hubTransportServiceIds)
{
ExchangeServer hubTransportRole = null;
try
{
hubTransportRole = GetExchangeServer(id, org.ServiceId);
}
catch (Exception ex)
{
TaskManager.WriteError(ex);
continue;
}
hubTransportRole.ChangeAcceptedDomainType(domain.DomainName, domainType);
break;
}
return 0;
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
}
public static int DeleteAuthoritativeDomain(int itemId, int domainId)
{
@ -1449,6 +1542,10 @@ namespace WebsitePanel.EnterpriseServer
if(domain == null)
return -1;
if (DataProvider.CheckDomainUsedByHostedOrganization(domain.DomainName) == 1)
{
return -1;
}
// delete domain on Exchange
int[] hubTransportServiceIds;
@ -1474,6 +1571,17 @@ namespace WebsitePanel.EnterpriseServer
}
//Add the service records
if (domain != null)
{
if (domain.ZoneItemId != 0)
{
ServerController.RemoveServiceDNSRecords(org.PackageId, ResourceGroups.Exchange, domain, "", false);
}
}
return 0;
}
catch (Exception ex)
@ -1594,6 +1702,9 @@ namespace WebsitePanel.EnterpriseServer
ExchangeMailboxPlan plan = GetExchangeMailboxPlan(itemId, mailboxPlanId);
if (maxDiskSpace != -1)
{
if (plan.MailboxSizeMB == -1)
return BusinessErrorCodes.ERROR_EXCHANGE_STORAGE_QUOTAS_EXCEED_HOST_VALUES;
if ((quotaUsed + plan.MailboxSizeMB) > (maxDiskSpace))
return BusinessErrorCodes.ERROR_EXCHANGE_STORAGE_QUOTAS_EXCEED_HOST_VALUES;
}
@ -1711,10 +1822,11 @@ namespace WebsitePanel.EnterpriseServer
// delete mailbox
int serviceExchangeId = GetExchangeServiceID(org.PackageId);
ExchangeServer exchange = GetExchangeServer(serviceExchangeId, org.ServiceId);
exchange.DisableMailbox(account.AccountName);
exchange.DisableMailbox(account.UserPrincipalName);
account.AccountType = ExchangeAccountType.User;
account.MailEnabledPublicFolder = false;
account.AccountPassword = null;
UpdateAccount(account);
DataProvider.DeleteUserEmailAddresses(account.AccountId, account.PrimaryEmailAddress);
@ -1760,7 +1872,7 @@ namespace WebsitePanel.EnterpriseServer
// delete mailbox
int serviceExchangeId = GetExchangeServiceID(org.PackageId);
ExchangeServer exchange = GetExchangeServer(serviceExchangeId, org.ServiceId);
exchange.DeleteMailbox(account.AccountName);
exchange.DeleteMailbox(account.UserPrincipalName);
@ -1835,7 +1947,7 @@ namespace WebsitePanel.EnterpriseServer
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
return exchange.GetMailboxGeneralSettings(account.AccountName);
return exchange.GetMailboxGeneralSettings(account.UserPrincipalName);
}
catch (Exception ex)
{
@ -1882,7 +1994,7 @@ namespace WebsitePanel.EnterpriseServer
hideAddressBook = true;
exchange.SetMailboxGeneralSettings(
account.AccountName,
account.UserPrincipalName,
hideAddressBook,
disabled);
@ -1954,7 +2066,7 @@ namespace WebsitePanel.EnterpriseServer
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
exchange.SetMailboxEmailAddresses(
account.AccountName,
account.UserPrincipalName,
GetAccountSimpleEmailAddresses(itemId, accountId));
return 0;
@ -2010,7 +2122,7 @@ namespace WebsitePanel.EnterpriseServer
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
exchange.SetMailboxPrimaryEmailAddress(
account.AccountName,
account.UserPrincipalName,
emailAddress);
if (DataProvider.CheckOCSUserExists(account.AccountId))
@ -2020,7 +2132,13 @@ namespace WebsitePanel.EnterpriseServer
ocs.SetUserPrimaryUri(instanceId, emailAddress);
}
if (DataProvider.CheckLyncUserExists(account.AccountId))
{
LyncController.SetLyncUserGeneralSettings(itemId, accountId, emailAddress, null);
}
// save account
account.AccountPassword = null;
UpdateAccount(account);
return 0;
@ -2054,7 +2172,8 @@ namespace WebsitePanel.EnterpriseServer
List<string> toDelete = new List<string>();
foreach (string emailAddress in emailAddresses)
{
if (String.Compare(account.PrimaryEmailAddress, emailAddress, true) != 0)
if ((String.Compare(account.PrimaryEmailAddress, emailAddress, true) != 0) &
(String.Compare(account.UserPrincipalName, emailAddress, true) != 0))
toDelete.Add(emailAddress);
}
@ -2071,7 +2190,7 @@ namespace WebsitePanel.EnterpriseServer
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
exchange.SetMailboxEmailAddresses(
account.AccountName,
account.UserPrincipalName,
GetAccountSimpleEmailAddresses(itemId, accountId));
return 0;
@ -2112,7 +2231,7 @@ namespace WebsitePanel.EnterpriseServer
// get mailbox settings
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
ExchangeMailbox mailbox = exchange.GetMailboxMailFlowSettings(account.AccountName);
ExchangeMailbox mailbox = exchange.GetMailboxMailFlowSettings(account.UserPrincipalName);
mailbox.DisplayName = account.DisplayName;
return mailbox;
}
@ -2157,7 +2276,7 @@ namespace WebsitePanel.EnterpriseServer
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
exchange.SetMailboxMailFlowSettings(account.AccountName,
exchange.SetMailboxMailFlowSettings(account.UserPrincipalName,
enableForwarding,
forwardingAccountName,
forwardToBoth,
@ -2205,7 +2324,7 @@ namespace WebsitePanel.EnterpriseServer
// get mailbox settings
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
ExchangeMailbox mailbox = exchange.GetMailboxAdvancedSettings(account.AccountName);
ExchangeMailbox mailbox = exchange.GetMailboxAdvancedSettings(account.UserPrincipalName);
mailbox.DisplayName = account.DisplayName;
return mailbox;
}
@ -2248,6 +2367,7 @@ namespace WebsitePanel.EnterpriseServer
else account.MailboxManagerActions &= ~action;
// update account
account.AccountPassword = null;
UpdateAccount(account);
return 0;
@ -2412,7 +2532,7 @@ namespace WebsitePanel.EnterpriseServer
// get mailbox settings
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
ExchangeMailbox mailbox = exchange.GetMailboxPermissions(org.OrganizationId, account.AccountName);
ExchangeMailbox mailbox = exchange.GetMailboxPermissions(org.OrganizationId, account.UserPrincipalName);
mailbox.DisplayName = account.DisplayName;
return mailbox;
}
@ -2454,7 +2574,7 @@ namespace WebsitePanel.EnterpriseServer
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
exchange.SetMailboxPermissions(org.OrganizationId, account.AccountName, sendAsaccounts, fullAccessAcounts);
exchange.SetMailboxPermissions(org.OrganizationId, account.UserPrincipalName, sendAsaccounts, fullAccessAcounts);
return 0;
@ -2512,11 +2632,26 @@ namespace WebsitePanel.EnterpriseServer
}
ExchangeMailboxPlan plan = GetExchangeMailboxPlan(itemId, mailboxPlanId);
if (maxDiskSpace != -1)
{
if (plan.MailboxSizeMB == -1)
return BusinessErrorCodes.ERROR_EXCHANGE_STORAGE_QUOTAS_EXCEED_HOST_VALUES;
ExchangeAccount exchangeAccount = GetAccount(itemId, accountId);
if (exchangeAccount.MailboxPlanId > 0)
{
ExchangeMailboxPlan oldPlan = GetExchangeMailboxPlan(itemId, exchangeAccount.MailboxPlanId);
if (((quotaUsed - oldPlan.MailboxSizeMB) + plan.MailboxSizeMB) > (maxDiskSpace))
return BusinessErrorCodes.ERROR_EXCHANGE_STORAGE_QUOTAS_EXCEED_HOST_VALUES;
}
else
{
if ((quotaUsed + plan.MailboxSizeMB) > (maxDiskSpace))
return BusinessErrorCodes.ERROR_EXCHANGE_STORAGE_QUOTAS_EXCEED_HOST_VALUES;
}
}
// get mailbox settings
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
@ -2524,7 +2659,7 @@ namespace WebsitePanel.EnterpriseServer
exchange.SetMailboxAdvancedSettings(
org.OrganizationId,
account.AccountName,
account.UserPrincipalName,
plan.EnablePOP,
plan.EnableIMAP,
plan.EnableOWA,
@ -2569,6 +2704,17 @@ namespace WebsitePanel.EnterpriseServer
else
ExchangeServerController.GetExchangeMailboxPlansByUser(0, user, ref mailboxPlans);
ExchangeOrganization ExchangeOrg = ObjectUtils.FillObjectFromDataReader<ExchangeOrganization>(DataProvider.GetExchangeOrganization(itemId));
if (ExchangeOrg != null)
{
foreach (ExchangeMailboxPlan p in mailboxPlans)
{
p.IsDefault = (p.MailboxPlanId == ExchangeOrg.ExchangeMailboxPlanID);
}
}
return mailboxPlans;
}
catch (Exception ex)
@ -3058,6 +3204,7 @@ namespace WebsitePanel.EnterpriseServer
// update account
account.DisplayName = displayName;
account.PrimaryEmailAddress = emailAddress;
account.AccountPassword = null;
UpdateAccount(account);
return 0;
@ -3386,6 +3533,7 @@ namespace WebsitePanel.EnterpriseServer
// update account
account.DisplayName = displayName;
account.AccountPassword = null;
UpdateAccount(account);
return 0;
@ -3606,6 +3754,7 @@ namespace WebsitePanel.EnterpriseServer
addressLists.ToArray());
// save account
account.AccountPassword = null;
UpdateAccount(account);
return 0;
@ -4008,6 +4157,7 @@ namespace WebsitePanel.EnterpriseServer
account.AccountName = accountName;
account.MailEnabledPublicFolder = true;
account.PrimaryEmailAddress = email;
account.AccountPassword = null;
UpdateAccount(account);
// register e-mail
@ -4060,6 +4210,7 @@ namespace WebsitePanel.EnterpriseServer
// update and save account
account.MailEnabledPublicFolder = false;
account.PrimaryEmailAddress = "";
account.AccountPassword = null;
UpdateAccount(account);
@ -4179,6 +4330,7 @@ namespace WebsitePanel.EnterpriseServer
{
// rename original folder
account.DisplayName = newFullName;
account.AccountPassword = null;
UpdateAccount(account);
// rename nested folders
@ -4396,6 +4548,7 @@ namespace WebsitePanel.EnterpriseServer
emailAddress);
// save account
account.AccountPassword = null;
UpdateAccount(account);
return 0;
@ -4613,7 +4766,7 @@ namespace WebsitePanel.EnterpriseServer
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
return exchange.GetMobileDevices(account.AccountName);
return exchange.GetMobileDevices(account.UserPrincipalName);
}
catch (Exception ex)
{

View file

@ -249,7 +249,7 @@ namespace WebsitePanel.EnterpriseServer
OrganizationResult serverRes =
crm.CreateOrganization(orgId, org.OrganizationId, org.Name, baseCurrencyCode, baseCurrencyName,
baseCurrencySymbol, user.AccountName, user.FirstName, user.LastName, user.PrimaryEmailAddress,
baseCurrencySymbol, user.SamAccountName, user.FirstName, user.LastName, user.PrimaryEmailAddress,
collation);
if (!serverRes.IsSuccess)

View file

@ -198,8 +198,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_CONFERENCING].QuotaAllocatedValue),
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_ALLOWVIDEO].QuotaAllocatedValue),
Convert.ToInt32(cntx.Quotas[Quotas.LYNC_MAXPARTICIPANTS].QuotaAllocatedValue),
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_CONFERENCING].QuotaAllocatedValue),
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_CONFERENCING].QuotaAllocatedValue));
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_FEDERATION].QuotaAllocatedValue),
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_ENTERPRISEVOICE].QuotaAllocatedValue));
if (string.IsNullOrEmpty(org.LyncTenantId))
{
@ -208,6 +208,18 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
}
else
{
DomainInfo domain = ServerController.GetDomain(org.DefaultDomain);
//Add the service records
if (domain != null)
{
if (domain.ZoneItemId != 0)
{
ServerController.AddServiceDNSRecords(org.PackageId, ResourceGroups.Lync, domain, "");
}
}
PackageController.UpdatePackageItem(org);
bReloadConfiguration = true;
@ -216,7 +228,7 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
LyncUserPlan plan = GetLyncUserPlan(itemId, lyncUserPlanId);
if (!lync.CreateUser(org.OrganizationId, user.PrimaryEmailAddress, plan))
if (!lync.CreateUser(org.OrganizationId, user.UserPrincipalName, plan))
{
TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_ADD_LYNC_USER);
return res;
@ -238,7 +250,7 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
try
{
DataProvider.AddLyncUser(accountId, lyncUserPlanId);
DataProvider.AddLyncUser(accountId, lyncUserPlanId, user.UserPrincipalName);
}
catch (Exception ex)
{
@ -306,7 +318,7 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
usr = OrganizationController.GetAccount(itemId, accountId);
if (usr != null)
user = lync.GetLyncUserGeneralSettings(org.OrganizationId, usr.PrimaryEmailAddress);
user = lync.GetLyncUserGeneralSettings(org.OrganizationId, usr.UserPrincipalName);
if (user != null)
{
@ -329,6 +341,77 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
}
public static LyncUserResult SetLyncUserGeneralSettings(int itemId, int accountId, string sipAddress, string lineUri)
{
LyncUserResult res = TaskManager.StartResultTask<LyncUserResult>("LYNC", "SET_LYNC_USER_GENERAL_SETTINGS");
LyncUser user = null;
try
{
Organization org = (Organization)PackageController.GetPackageItem(itemId);
if (org == null)
{
throw new ApplicationException(
string.Format("Organization is null. ItemId={0}", itemId));
}
int lyncServiceId = GetLyncServiceID(org.PackageId);
LyncServer lync = GetLyncServer(lyncServiceId, org.ServiceId);
OrganizationUser usr;
usr = OrganizationController.GetAccount(itemId, accountId);
if (usr != null)
user = lync.GetLyncUserGeneralSettings(org.OrganizationId, usr.UserPrincipalName);
if (user != null)
{
LyncUserPlan plan = ObjectUtils.FillObjectFromDataReader<LyncUserPlan>(DataProvider.GetLyncUserPlanByAccountId(accountId));
if (plan != null)
{
user.LyncUserPlanId = plan.LyncUserPlanId;
user.LyncUserPlanName = plan.LyncUserPlanName;
}
if (!string.IsNullOrEmpty(sipAddress))
{
if (sipAddress != usr.UserPrincipalName)
{
if (DataProvider.LyncUserExists(accountId, sipAddress))
{
TaskManager.CompleteResultTask(res, LyncErrorCodes.ADDRESS_ALREADY_USED);
return res;
}
}
user.SipAddress = sipAddress;
}
if (!string.IsNullOrEmpty(lineUri)) user.LineUri = lineUri;
lync.SetLyncUserGeneralSettings(org.OrganizationId, usr.UserPrincipalName, user);
DataProvider.UpdateLyncUser(accountId, sipAddress);
}
}
catch (Exception ex)
{
TaskManager.CompleteResultTask(res, LyncErrorCodes.FAILED_SET_SETTINGS, ex);
return res;
}
res.IsSuccess = true;
TaskManager.CompleteResultTask();
return res;
}
public static int DeleteOrganization(int itemId)
{
// check account
@ -391,7 +474,7 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
OrganizationUser user;
user = OrganizationController.GetAccount(itemId, accountId);
if (!lync.SetLyncUserPlan(org.OrganizationId, user.PrimaryEmailAddress, plan))
if (!lync.SetLyncUserPlan(org.OrganizationId, user.UserPrincipalName, plan))
{
TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_ADD_LYNC_USER);
return res;
@ -419,7 +502,12 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
}
public static LyncUsersPagedResult GetLyncUsers(int itemId, string sortColumn, string sortDirection, int startRow, int count)
public static LyncUsersPagedResult GetLyncUsers(int itemId)
{
return GetLyncUsersPaged(itemId, string.Empty, string.Empty, 0, int.MaxValue);
}
public static LyncUsersPagedResult GetLyncUsersPaged(int itemId, string sortColumn, string sortDirection, int startRow, int count)
{
LyncUsersPagedResult res = TaskManager.StartResultTask<LyncUsersPagedResult>("LYNC", "GET_LYNC_USERS");
@ -501,7 +589,7 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
user = OrganizationController.GetAccount(itemId, accountId);
if (user != null)
lync.DeleteUser(user.PrimaryEmailAddress);
lync.DeleteUser(user.UserPrincipalName);
}
catch (Exception ex)
{
@ -548,6 +636,18 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
else
LyncController.GetLyncUserPlansByUser(0, user, ref plans);
ExchangeOrganization ExchangeOrg = ObjectUtils.FillObjectFromDataReader<ExchangeOrganization>(DataProvider.GetExchangeOrganization(itemId));
if (ExchangeOrg != null)
{
foreach (LyncUserPlan p in plans)
{
p.IsDefault = (p.LyncUserPlanId == ExchangeOrg.LyncUserPlanID);
}
}
return plans;
}
catch (Exception ex)
@ -572,12 +672,12 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
if ((Packages != null) & (Packages.Count > 0))
{
orgs = ExchangeServerController.GetExchangeOrganizations(Packages[0].PackageId, false);
orgs = ExchangeServerController.GetExchangeOrganizationsInternal(Packages[0].PackageId, false);
}
}
else
{
orgs = ExchangeServerController.GetExchangeOrganizations(1, false);
orgs = ExchangeServerController.GetExchangeOrganizationsInternal(1, false);
}
int OrgId = -1;
@ -825,8 +925,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_CONFERENCING].QuotaAllocatedValue),
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_ALLOWVIDEO].QuotaAllocatedValue),
Convert.ToInt32(cntx.Quotas[Quotas.LYNC_MAXPARTICIPANTS].QuotaAllocatedValue),
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_CONFERENCING].QuotaAllocatedValue),
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_CONFERENCING].QuotaAllocatedValue));
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_FEDERATION].QuotaAllocatedValue),
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_ENTERPRISEVOICE].QuotaAllocatedValue));
if (string.IsNullOrEmpty(org.LyncTenantId))
{
@ -839,7 +939,20 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
lync = GetLyncServer(lyncServiceId, org.ServiceId);
lync.AddFederationDomain(org.OrganizationId, domainName, proxyFqdn);
bool bDomainExists = false;
LyncFederationDomain[] domains = GetFederationDomains(itemId);
foreach (LyncFederationDomain d in domains)
{
if (d.DomainName.ToLower() == domainName.ToLower())
{
bDomainExists = true;
break;
}
}
if (!bDomainExists)
lync.AddFederationDomain(org.OrganizationId, domainName.ToLower(), proxyFqdn);
}
catch (Exception ex)
{

View file

@ -84,6 +84,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
private static OCSEdgeServer[] GetEdgeServers(string edgeServices)
{
List<OCSEdgeServer> list = new List<OCSEdgeServer>();
if (!string.IsNullOrEmpty(edgeServices))
{
string[] services = edgeServices.Split(';');
foreach (string current in services)
{
@ -95,11 +97,12 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
ServiceProviderProxy.Init(ocs, serviceId);
list.Add(ocs);
}
catch(Exception ex)
catch (Exception ex)
{
TaskManager.WriteError(ex);
}
}
}
return list.ToArray();
}

View file

@ -40,6 +40,8 @@ using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.ResultObjects;
using WebsitePanel.Providers.SharePoint;
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.DNS;
using WebsitePanel.Providers.OCS;
using System.IO;
using System.Xml;
@ -281,7 +283,7 @@ namespace WebsitePanel.EnterpriseServer
TaskManager.WriteError(ex);
}
}
public static int CreateOrganization(int packageId, string organizationId, string organizationName)
public static int CreateOrganization(int packageId, string organizationId, string organizationName, string domainName)
{
int itemId;
int errorCode;
@ -291,6 +293,7 @@ namespace WebsitePanel.EnterpriseServer
// place log record
TaskManager.StartTask("ORGANIZATION", "CREATE_ORG", organizationName);
TaskManager.TaskParameters["Organization ID"] = organizationId;
TaskManager.TaskParameters["DomainName"] = domainName;
try
{
@ -311,7 +314,12 @@ namespace WebsitePanel.EnterpriseServer
return BusinessErrorCodes.ERROR_ORG_ID_EXISTS;
//create temporary domain name;
string domainName = CreateTemporyDomainName(serviceId, organizationId);
if (string.IsNullOrEmpty(domainName))
{
string tmpDomainName = CreateTemporyDomainName(serviceId, organizationId);
if (!string.IsNullOrEmpty(tmpDomainName)) domainName = tmpDomainName;
}
if (string.IsNullOrEmpty(domainName))
{
@ -330,6 +338,17 @@ namespace WebsitePanel.EnterpriseServer
return domainId;
}
DomainInfo domain = ServerController.GetDomain(domainId);
if (domain != null)
{
if (domain.ZoneItemId != 0)
{
ServerController.AddServiceDNSRecords(org.PackageId, ResourceGroups.HostedOrganizations, domain, "");
ServerController.AddServiceDNSRecords(org.PackageId, ResourceGroups.HostedCRM, domain, "");
}
}
PackageContext cntx = PackageController.GetPackageContext(packageId);
if (cntx.Quotas[Quotas.HOSTED_SHAREPOINT_STORAGE_SIZE] != null)
@ -361,60 +380,6 @@ namespace WebsitePanel.EnterpriseServer
PackageController.AddPackageItem(orgDomain);
if (cntx.Quotas[Quotas.EXCHANGE2007_MAILBOXES] != null)
{
// 5) Create default mailbox plans
// load user info
UserInfo user = PackageController.GetPackageOwner(org.PackageId);
// get settings
UserSettings userSettings = UserController.GetUserSettings(user.UserId, "ExchangeMailboxPlansPolicy");
if (!string.IsNullOrEmpty(userSettings[UserSettings.DEFAULT_MAILBOXPLANS]))
{
List<ExchangeMailboxPlan> list = new List<ExchangeMailboxPlan>();
XmlSerializer serializer = new XmlSerializer(list.GetType());
StringReader reader = new StringReader(userSettings[UserSettings.DEFAULT_MAILBOXPLANS]);
list = (List<ExchangeMailboxPlan>)serializer.Deserialize(reader);
foreach (ExchangeMailboxPlan p in list)
{
ExchangeServerController.AddExchangeMailboxPlan(itemId, p);
}
}
}
if (cntx.Quotas[Quotas.LYNC_USERS] != null)
{
// 5) Create default mailbox plans
// load user info
UserInfo user = PackageController.GetPackageOwner(org.PackageId);
// get settings
UserSettings userSettings = UserController.GetUserSettings(user.UserId, "LyncUserPlansPolicy");
if (!string.IsNullOrEmpty(userSettings[UserSettings.DEFAULT_LYNCUSERPLANS]))
{
List<LyncUserPlan> list = new List<LyncUserPlan>();
XmlSerializer serializer = new XmlSerializer(list.GetType());
StringReader reader = new StringReader(userSettings[UserSettings.DEFAULT_LYNCUSERPLANS]);
list = (List<LyncUserPlan>)serializer.Deserialize(reader);
foreach (LyncUserPlan p in list)
{
LyncController.AddLyncUserPlan(itemId, p);
}
}
}
}
catch (Exception ex)
@ -462,6 +427,14 @@ namespace WebsitePanel.EnterpriseServer
if (domain == null)
return -1;
if (!string.IsNullOrEmpty(org.GlobalAddressList))
{
if (DataProvider.CheckDomainUsedByHostedOrganization(domain.DomainName) == 1)
{
return -1;
}
}
// unregister domain
DataProvider.DeleteExchangeOrganizationDomain(itemId, domainId);
@ -553,7 +526,7 @@ namespace WebsitePanel.EnterpriseServer
try
{
LyncUsersPagedResult res = LyncController.GetLyncUsers(itemId, string.Empty, string.Empty, 0, int.MaxValue);
LyncUsersPagedResult res = LyncController.GetLyncUsers(itemId);
if (res.IsSuccess)
{
@ -1042,6 +1015,37 @@ namespace WebsitePanel.EnterpriseServer
}
}
public static int ChangeOrganizationDomainType(int itemId, int domainId, ExchangeAcceptedDomainType newDomainType)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
if (accountCheck < 0) return accountCheck;
// place log record
TaskManager.StartTask("ORGANIZATION", "CHANGE_DOMAIN_TYPE", domainId);
TaskManager.ItemId = itemId;
try
{
// change accepted domain type on Exchange
int checkResult = ExchangeServerController.ChangeAcceptedDomainType(itemId, domainId, newDomainType);
// change accepted domain type in DB
int domainTypeId= (int) newDomainType;
DataProvider.ChangeExchangeAcceptedDomainType(itemId, domainId, domainTypeId);
return checkResult;
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
}
public static int AddOrganizationDomain(int itemId, string domainName)
{
@ -1130,6 +1134,14 @@ namespace WebsitePanel.EnterpriseServer
ExchangeServerController.AddAuthoritativeDomain(itemId, domain.DomainId);
}
OrganizationStatistics orgStatsExchange = ExchangeServerController.GetOrganizationStatistics(itemId);
if (orgStatsExchange.AllocatedMailboxes == 0)
{
ExchangeAcceptedDomainType newDomainType = ExchangeAcceptedDomainType.InternalRelay;
ChangeOrganizationDomainType(org.ServiceId, domain.DomainId, newDomainType);
}
if (org.IsOCSOrganization)
{
OCSController.AddDomain(domain.DomainName, itemId);
@ -1324,11 +1336,11 @@ namespace WebsitePanel.EnterpriseServer
if (orgProxy.CreateUser(org.OrganizationId, sAMAccountName, displayName, upn, password, enabled) == 0)
{
OrganizationUser retUser = orgProxy.GetUserGeneralSettings(upn, org.OrganizationId);
accountName = sAMAccountName;
OrganizationUser retUser = orgProxy.GetUserGeneralSettings(sAMAccountName, org.OrganizationId);
TaskManager.Write("sAMAccountName :" + retUser.DomainUserName);
userId = AddOrganizationUser(itemId, upn, displayName, email, retUser.DomainUserName, password, subscriberNumber);
accountName = upn;
userId = AddOrganizationUser(itemId, sAMAccountName, displayName, email, retUser.DomainUserName, password, subscriberNumber);
// register email address
AddAccountEmailAddress(userId, email);
@ -1420,7 +1432,7 @@ namespace WebsitePanel.EnterpriseServer
TaskManager.Write("sAMAccountName :" + retUser.DomainUserName);
userId = AddOrganizationUser(itemId, accountName, displayName, email, retUser.DomainUserName, password, subscriberNumber);
userId = AddOrganizationUser(itemId, retUser.SamAccountName, displayName, email, retUser.DomainUserName, password, subscriberNumber);
AddAccountEmailAddress(userId, email);
@ -1449,6 +1461,9 @@ namespace WebsitePanel.EnterpriseServer
string CounterStr = "00000";
int counter = 0;
bool bFound = false;
if (!AccountExists(accountName)) return accountName;
do
{
accountName = genSamLogin(name, CounterStr);
@ -1505,8 +1520,15 @@ namespace WebsitePanel.EnterpriseServer
if (DataProvider.CheckOCSUserExists(accountId))
{
return BusinessErrorCodes.CURRENT_USER_IS_OCS_USER; ;
return BusinessErrorCodes.CURRENT_USER_IS_OCS_USER;
}
if (DataProvider.CheckLyncUserExists(accountId))
{
return BusinessErrorCodes.CURRENT_USER_IS_LYNC_USER;
}
// load organization
Organization org = GetOrganization(itemId);
if (org == null)
@ -1652,7 +1674,7 @@ namespace WebsitePanel.EnterpriseServer
if (accountCheck < 0) return accountCheck;
// place log record
TaskManager.StartTask("EXCHANGE", "UPDATE_MAILBOX_GENERAL");
TaskManager.StartTask("ORGANIZATION", "UPDATE_USER_GENERAL");
TaskManager.ItemId = itemId;
try
@ -1717,7 +1739,7 @@ namespace WebsitePanel.EnterpriseServer
if (!String.IsNullOrEmpty(password))
account.AccountPassword = CryptoUtils.Encrypt(password);
else
account.AccountPassword = string.Empty;
account.AccountPassword = null;
UpdateAccount(account);
@ -1734,6 +1756,162 @@ namespace WebsitePanel.EnterpriseServer
}
}
public static int SetUserPrincipalName(int itemId, int accountId, string userPrincipalName, bool inherit)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
if (accountCheck < 0) return accountCheck;
// place log record
TaskManager.StartTask("ORGANIZATION", "SET_USER_USERPRINCIPALNAME");
TaskManager.ItemId = itemId;
try
{
// load organization
Organization org = GetOrganization(itemId);
if (org == null)
return -1;
// check package
int packageCheck = SecurityContext.CheckPackage(org.PackageId, DemandPackage.IsActive);
if (packageCheck < 0) return packageCheck;
// load account
OrganizationUser user = GetUserGeneralSettings(itemId, accountId);
if (user.UserPrincipalName != userPrincipalName)
{
bool userPrincipalNameOwned = false;
ExchangeEmailAddress[] emails = ExchangeServerController.GetMailboxEmailAddresses(itemId, accountId);
foreach (ExchangeEmailAddress mail in emails)
{
if (mail.EmailAddress == userPrincipalName)
{
userPrincipalNameOwned = true;
break;
}
}
if (!userPrincipalNameOwned)
{
if (EmailAddressExists(userPrincipalName))
return BusinessErrorCodes.ERROR_EXCHANGE_EMAIL_EXISTS;
}
}
Organizations orgProxy = GetOrganizationProxy(org.ServiceId);
orgProxy.SetUserPrincipalName(org.OrganizationId,
user.AccountName,
userPrincipalName.ToLower());
DataProvider.UpdateExchangeAccountUserPrincipalName(accountId, userPrincipalName.ToLower());
if (inherit)
{
if (user.AccountType == ExchangeAccountType.Mailbox)
{
ExchangeServerController.AddMailboxEmailAddress(itemId, accountId, userPrincipalName.ToLower());
ExchangeServerController.SetMailboxPrimaryEmailAddress(itemId, accountId, userPrincipalName.ToLower());
}
else
{
if (user.IsLyncUser)
{
if (!DataProvider.LyncUserExists(accountId, userPrincipalName.ToLower()))
{
LyncController.SetLyncUserGeneralSettings(itemId, accountId, userPrincipalName.ToLower(), null);
}
}
else
{
if (user.IsOCSUser)
{
OCSServer ocs = GetOCSProxy(itemId);
string instanceId = DataProvider.GetOCSUserInstanceID(user.AccountId);
ocs.SetUserPrimaryUri(instanceId, userPrincipalName.ToLower());
}
}
}
}
return 0;
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
}
public static int SetUserPassword(int itemId, int accountId, string password)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
if (accountCheck < 0) return accountCheck;
// place log record
TaskManager.StartTask("ORGANIZATION", "SET_USER_PASSWORD");
TaskManager.ItemId = itemId;
try
{
// load organization
Organization org = GetOrganization(itemId);
if (org == null)
return -1;
// check package
int packageCheck = SecurityContext.CheckPackage(org.PackageId, DemandPackage.IsActive);
if (packageCheck < 0) return packageCheck;
// load account
ExchangeAccount account = ExchangeServerController.GetAccount(itemId, accountId);
string accountName = GetAccountName(account.AccountName);
Organizations orgProxy = GetOrganizationProxy(org.ServiceId);
orgProxy.SetUserPassword( org.OrganizationId,
accountName,
password);
//account.
if (!String.IsNullOrEmpty(password))
account.AccountPassword = CryptoUtils.Encrypt(password);
else
account.AccountPassword = null;
UpdateAccount(account);
return 0;
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
}
private static void UpdateAccount(ExchangeAccount account)
{
DataProvider.UpdateExchangeAccount(account.AccountId, account.AccountName, account.AccountType, account.DisplayName,
@ -1951,6 +2129,19 @@ namespace WebsitePanel.EnterpriseServer
}
return res;
}
private static OCSServer GetOCSProxy(int itemId)
{
Organization org = OrganizationController.GetOrganization(itemId);
int serviceId = PackageController.GetPackageServiceId(org.PackageId, ResourceGroups.OCS);
OCSServer ocs = new OCSServer();
ServiceProviderProxy.Init(ocs, serviceId);
return ocs;
}
}
}

View file

@ -125,6 +125,23 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
item.TotalCRMUsers = crmOrganizationStatistics.Count;
}
item.TotalLyncUsers = 0;
item.TotalLyncEVUsers = 0;
if (report.LyncReport != null)
{
List<LyncUserStatistics> lyncOrganizationStatistics =
report.LyncReport.Items.FindAll(
delegate(LyncUserStatistics stats) { return stats.OrganizationID == org.OrganizationId; });
foreach (LyncUserStatistics current in lyncOrganizationStatistics)
{
if (current.EnterpriseVoice) item.TotalLyncEVUsers++;
}
item.TotalLyncUsers = lyncOrganizationStatistics.Count;
}
report.OrganizationReport.Items.Add(item);
}
@ -298,6 +315,18 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
}
}
if (report.LyncReport != null)
{
try
{
PopulateLyncReportItems(org, report, topReseller);
}
catch (Exception ex)
{
TaskManager.WriteError(ex);
}
}
if (report.OrganizationReport != null)
{
try
@ -309,6 +338,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
TaskManager.WriteError(ex);
}
}
}
private static int GetExchangeServiceID(int packageId)
@ -316,6 +347,10 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
return PackageController.GetPackageServiceId(packageId, ResourceGroups.Exchange);
}
private static int GetLyncServiceID(int packageId)
{
return PackageController.GetPackageServiceId(packageId, ResourceGroups.Lync);
}
private static void PopulateSharePointItem(Organization org, EnterpriseSolutionStatisticsReport report, string topReseller)
@ -409,12 +444,12 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
try
{
stats = exchange.GetMailboxStatistics(mailbox.AccountName);
stats = exchange.GetMailboxStatistics(mailbox.UserPrincipalName);
}
catch (Exception ex)
{
TaskManager.WriteError(ex, "Could not get mailbox statistics. AccountName: {0}",
mailbox.AccountName);
mailbox.UserPrincipalName);
}
@ -422,6 +457,12 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
{
PopulateBaseItem(stats, org, topReseller);
stats.MailboxType = mailbox.AccountType;
if (mailbox.AccountType == ExchangeAccountType.Mailbox)
{
ExchangeAccount a = ExchangeServerController.GetAccount(mailbox.ItemId, mailbox.AccountId);
stats.MailboxPlan = a.MailboxPlan;
}
stats.BlackberryEnabled = BlackBerryController.CheckBlackBerryUserExists(mailbox.AccountId);
report.ExchangeReport.Items.Add(stats);
@ -436,6 +477,74 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
}
private static void PopulateLyncReportItems(Organization org, EnterpriseSolutionStatisticsReport report, string topReseller)
{
//Check if lync organization
if (string.IsNullOrEmpty(org.LyncTenantId))
return;
LyncUser[] lyncUsers = null;
try
{
LyncUsersPagedResult res = LyncController.GetLyncUsers(org.Id);
if (res.IsSuccess) lyncUsers = res.Value.PageUsers;
}
catch (Exception ex)
{
throw new ApplicationException(
string.Format("Could not get lync users for current organization {0}", org.Id), ex);
}
if (lyncUsers == null)
return;
foreach (LyncUser lyncUser in lyncUsers)
{
try
{
LyncUserStatistics stats = new LyncUserStatistics();
try
{
stats.SipAddress = lyncUser.SipAddress;
if (string.IsNullOrEmpty(lyncUser.LineUri)) stats.PhoneNumber = string.Empty; else stats.PhoneNumber = lyncUser.LineUri;
LyncUserPlan plan = LyncController.GetLyncUserPlan(org.Id, lyncUser.LyncUserPlanId);
stats.Conferencing = plan.Conferencing;
stats.EnterpriseVoice = plan.EnterpriseVoice;
stats.Federation = plan.Federation;
stats.InstantMessaing = plan.IM;
stats.MobileAccess = plan.Mobility;
stats.LyncUserPlan = plan.LyncUserPlanName;
stats.DisplayName = lyncUser.DisplayName;
}
catch (Exception ex)
{
TaskManager.WriteError(ex, "Could not get lync statistics. AccountName: {0}",
lyncUser.DisplayName);
}
if (stats != null)
{
PopulateBaseItem(stats, org, topReseller);
report.LyncReport.Items.Add(stats);
}
}
catch (Exception ex)
{
TaskManager.WriteError(ex);
}
}
}
private static void PopulateSpaceData(int packageId, EnterpriseSolutionStatisticsReport report, string topReseller)
{
List<Organization> organizations;
@ -490,7 +599,7 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
}
private static void GetUsersData(EnterpriseSolutionStatisticsReport report, int userId, bool generateExchangeReport, bool generateSharePointReport, bool generateCRMReport, bool generateOrganizationReport, string topReseller)
private static void GetUsersData(EnterpriseSolutionStatisticsReport report, int userId, bool generateExchangeReport, bool generateSharePointReport, bool generateCRMReport, bool generateOrganizationReport, bool generateLyncReport, string topReseller)
{
List<UserInfo> users;
try
@ -514,6 +623,7 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
GetUsersData(report, user.UserId, generateExchangeReport, generateSharePointReport,
generateCRMReport,
generateOrganizationReport,
generateLyncReport,
string.IsNullOrEmpty(topReseller) ? user.Username : topReseller);
}
}
@ -524,7 +634,7 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
}
}
public static EnterpriseSolutionStatisticsReport GetEnterpriseSolutionStatisticsReport(int userId, bool generateExchangeReport, bool generateSharePointReport, bool generateCRMReport, bool generateOrganizationReport)
public static EnterpriseSolutionStatisticsReport GetEnterpriseSolutionStatisticsReport(int userId, bool generateExchangeReport, bool generateSharePointReport, bool generateCRMReport, bool generateOrganizationReport, bool generateLyncReport)
{
EnterpriseSolutionStatisticsReport report = new EnterpriseSolutionStatisticsReport();
@ -534,17 +644,20 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
if (generateSharePointReport || generateOrganizationReport)
report.SharePointReport = new SharePointStatisticsReport();
if (generateLyncReport || generateOrganizationReport)
report.LyncReport = new LyncStatisticsReport();
if (generateCRMReport || generateOrganizationReport)
report.CRMReport = new CRMStatisticsReport();
if (generateOrganizationReport)
report.OrganizationReport = new OrganizationStatisticsReport();
try
{
GetUsersData(report, userId, generateExchangeReport, generateSharePointReport, generateCRMReport,
generateOrganizationReport, null);
generateOrganizationReport, generateLyncReport, null);
}
catch(Exception ex)
{

View file

@ -1051,18 +1051,21 @@ namespace WebsitePanel.EnterpriseServer
int itemId = PackageController.AddPackageItem(item);
// update related domain with a new pointer
DomainInfo domain = ServerController.GetDomain(item.Name);
DomainInfo domain = ServerController.GetDomain(item.Name, true, false);
if (domain != null)
{
domain.MailDomainId = itemId;
ServerController.UpdateDomain(domain);
domain = ServerController.GetDomain(domain.DomainId);
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.Mail, domain, "");
}
// check if instant alias must be added
if (!String.IsNullOrEmpty(domain.InstantAliasName))
{
// load instant alias
DomainInfo instantAlias = ServerController.GetDomainItem(domain.InstantAliasName);
DomainInfo instantAlias = ServerController.GetDomain(domain.InstantAliasId);
if (instantAlias != null)
{
AddMailDomainPointer(itemId, instantAlias.DomainId);
@ -1161,7 +1164,7 @@ namespace WebsitePanel.EnterpriseServer
PackageController.DeletePackageItem(origItem.Id);
// update related domain with a new pointer
DomainInfo domain = ServerController.GetDomain(origItem.Name);
DomainInfo domain = ServerController.GetDomain(origItem.Name, true, false);
if (domain != null)
{
domain.MailDomainId = 0;
@ -1202,7 +1205,7 @@ namespace WebsitePanel.EnterpriseServer
return pointers;
}
public static int AddMailDomainPointer(int itemId, int domainId)
public static int AddMailDomainPointer( int itemId, int domainId)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo);
@ -1231,6 +1234,16 @@ namespace WebsitePanel.EnterpriseServer
ServiceProviderProxy.Init(mail, mailDomain.ServiceId);
mail.AddDomainAlias(mailDomain.Name, domain.DomainName);
if (domain != null)
{
if (domain.ZoneItemId != 0)
{
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.Mail, domain, "");
}
}
// update domain
domain.MailDomainId = itemId;
ServerController.UpdateDomain(domain);
@ -1474,7 +1487,7 @@ namespace WebsitePanel.EnterpriseServer
// add/update domains/pointers
foreach (string domainName in domains)
{
DomainInfo domain = ServerController.GetDomain(domainName);
DomainInfo domain = ServerController.GetDomain(domainName, true, false);
if (domain == null)
{
domain = new DomainInfo();

View file

@ -412,18 +412,55 @@ namespace WebsitePanel.EnterpriseServer
public static bool CheckLoadUserProfile(int serverId)
{
int packageId = DataProvider.GetPackageIdByName("IIS70");
int serviceId = DataProvider.GetServiceIdByProviderForServer(packageId, serverId);
int serviceId = getWebServiceId(serverId);
if (serviceId != -1)
{
return WebServerController.GetWebServer(serviceId).CheckLoadUserProfile();
}
return false;
}
private static int getWebServiceId(int serverId)
{
DataSet dsServices = ServerController.GetRawServicesByServerId(serverId);
int webGroup = -1;
if (dsServices.Tables.Count < 1) return -1;
foreach (DataRow r in dsServices.Tables[0].Rows)
{
if (r["GroupName"].ToString() == "Web")
{
webGroup = (int)r["GroupID"];
break;
}
}
if (webGroup == -1) return -1;
foreach (DataRow r in dsServices.Tables[1].Rows)
{
if ((int)r["GroupID"] == webGroup)
{
return (int)r["ServiceID"];
}
}
return -1;
}
public static void EnableLoadUserProfile(int serverId)
{
int packageId = DataProvider.GetPackageIdByName("IIS70");
int serviceId = DataProvider.GetServiceIdByProviderForServer(packageId, serverId);
int serviceId = getWebServiceId(serverId);
if (serviceId != -1)
{
WebServerController.GetWebServer(serviceId).EnableLoadUserProfile();
}
}

View file

@ -460,13 +460,37 @@ namespace WebsitePanel.EnterpriseServer
domain.PackageId = packageId;
domain.DomainName = domainName;
domain.HostingAllowed = false;
domainId = ServerController.AddDomain(domain, createInstantAlias, true);
domainId = ServerController.AddDomain(domain, false, true);
if (domainId < 0)
{
result.Result = domainId;
DeletePackage(packageId);
return result;
}
domain = ServerController.GetDomain(domainId);
if (domain != null)
{
if (domain.ZoneItemId != 0)
{
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.Os, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.Dns, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.Ftp, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.MsSql2000, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.MsSql2005, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.MsSql2008, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.MsSql2012, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.MySql4, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.MySql5, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.Statistics, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.VPS, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.VPSForPC, domain, "");
}
}
if (createInstantAlias)
ServerController.CreateDomainInstantAlias("", domainId);
}
catch (Exception ex)
{
@ -481,7 +505,7 @@ namespace WebsitePanel.EnterpriseServer
// create web site
try
{
int webSiteId = WebServerController.AddWebSite(packageId, hostName, domainId, 0, true, false);
int webSiteId = WebServerController.AddWebSite(packageId, hostName, domainId, 0, createInstantAlias, false);
if (webSiteId < 0)
{
result.Result = webSiteId;

View file

@ -29,8 +29,9 @@
using System;
using System.Data;
using System.Collections.Generic;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers;
using WebsitePanel.Providers.Web;
namespace WebsitePanel.EnterpriseServer
{
@ -68,6 +69,8 @@ namespace WebsitePanel.EnterpriseServer
if (accountCheck < 0) return items;
// load item type
if (itemTypeId > 0)
{
ServiceProviderItemType itemType = PackageController.GetServiceItemType(itemTypeId);
// load group
@ -131,6 +134,9 @@ namespace WebsitePanel.EnterpriseServer
}
catch { /* do nothing */ }
}
else
return GetImportableCustomItems(packageId, itemTypeId);
return items;
}
@ -172,11 +178,15 @@ namespace WebsitePanel.EnterpriseServer
TaskManager.IndicatorCurrent = 0;
Dictionary<int, List<string>> groupedItems = new Dictionary<int, List<string>>();
List<string> customItems = new List<string>();
// sort by groups
foreach (string item in items)
{
string[] itemParts = item.Split('|');
if (!item.StartsWith("+"))
{
int itemTypeId = Utils.ParseInt(itemParts[0], 0);
string itemName = itemParts[1];
@ -186,6 +196,18 @@ namespace WebsitePanel.EnterpriseServer
groupedItems[itemTypeId].Add(itemName);
}
else
{
switch (itemParts[0])
{
case ("+100"):
if (itemParts.Length > 2)
customItems.Add(item);
break;
}
}
}
// import each group
foreach (int itemTypeId in groupedItems.Keys)
@ -226,9 +248,64 @@ namespace WebsitePanel.EnterpriseServer
catch { /* do nothing */ }
}
foreach (string s in customItems)
{
try
{
string[] sParts = s.Split('|');
switch (sParts[0])
{
case "+100":
TaskManager.Write(String.Format("Import {0}", sParts[4]));
int result = WebServerController.ImporHostHeader(int.Parse(sParts[2],0), int.Parse(sParts[3],0), int.Parse(sParts[5],0));
if (result < 0)
TaskManager.WriteError(String.Format("Failed to Import {0} ,error: {1}: ", sParts[4], result.ToString()));
break;
}
}
catch { /* do nothing */ }
TaskManager.IndicatorCurrent++;
}
TaskManager.IndicatorCurrent = items.Length;
TaskManager.CompleteTask();
return 0;
}
private static List<string> GetImportableCustomItems(int packageId, int itemTypeId)
{
List<string> items = new List<string>();
PackageInfo packageInfo = PackageController.GetPackage(packageId);
if (packageInfo == null) return items;
switch (itemTypeId)
{
case -100:
List<UserInfo> users = UserController.GetUsers(packageInfo.UserId, true);
foreach (UserInfo user in users)
{
List<PackageInfo> packages = PackageController.GetPackages(user.UserId);
foreach (PackageInfo package in packages)
{
List<WebSite> webSites = WebServerController.GetWebSites(package.PackageId, false);
foreach (WebSite webSite in webSites)
{
items.Add(user.Username+"|"+user.UserId.ToString()+"|"+package.PackageId.ToString()+"|"+webSite.SiteId+"|"+webSite.Id);
}
}
}
break;
}
return items;
}
}
}

View file

@ -42,6 +42,7 @@ namespace WebsitePanel.EnterpriseServer
private static readonly string EXCHANGE_REPORT = "EXCHANGE_REPORT";
private static readonly string ORGANIZATION_REPORT = "ORGANIZATION_REPORT";
private static readonly string SHAREPOINT_REPORT = "SHAREPOINT_REPORT";
private static readonly string LYNC_REPORT = "LYNC_REPORT";
private static readonly string CRM_REPORT = "CRM_REPORT";
private static readonly string EMAIL = "EMAIL";
@ -52,6 +53,7 @@ namespace WebsitePanel.EnterpriseServer
{
bool isExchange = Utils.ParseBool(TaskManager.TaskParameters[EXCHANGE_REPORT], false);
bool isSharePoint = Utils.ParseBool(TaskManager.TaskParameters[SHAREPOINT_REPORT], false);
bool isLync = Utils.ParseBool(TaskManager.TaskParameters[LYNC_REPORT], false);
bool isCRM = Utils.ParseBool(TaskManager.TaskParameters[CRM_REPORT], false);
bool isOrganization = Utils.ParseBool(TaskManager.TaskParameters[ORGANIZATION_REPORT], false);
@ -61,13 +63,14 @@ namespace WebsitePanel.EnterpriseServer
UserInfo user = PackageController.GetPackageOwner(TaskManager.PackageId);
EnterpriseSolutionStatisticsReport report =
ReportController.GetEnterpriseSolutionStatisticsReport(user.UserId, isExchange, isSharePoint, isCRM,
isOrganization);
isOrganization, isLync);
SendMessage(user, email, isExchange && report.ExchangeReport != null ? report.ExchangeReport.ToCSV() : string.Empty,
isSharePoint && report.SharePointReport != null ? report.SharePointReport.ToCSV() : string.Empty,
isCRM && report.CRMReport != null ? report.CRMReport.ToCSV() : string.Empty,
isOrganization && report.OrganizationReport != null ? report.OrganizationReport.ToCSV() : string.Empty);
isOrganization && report.OrganizationReport != null ? report.OrganizationReport.ToCSV() : string.Empty,
isLync && report.LyncReport != null ? report.LyncReport.ToCSV() : string.Empty);
}
catch(Exception ex)
{
@ -90,11 +93,12 @@ namespace WebsitePanel.EnterpriseServer
}
}
private void SendMessage(UserInfo user,string email, string exchange_csv, string sharepoint_csv, string crm_csv, string organization_csv)
private void SendMessage(UserInfo user,string email, string exchange_csv, string sharepoint_csv, string crm_csv, string organization_csv, string lync_csv)
{
List<Attachment> attacments = new List<Attachment>();
PrepareAttament("exchange.csv", exchange_csv, attacments);
PrepareAttament("sharepoint.csv", sharepoint_csv, attacments);
PrepareAttament("lync.csv", lync_csv, attacments);
PrepareAttament("crm.csv", crm_csv, attacments);
PrepareAttament("organization.csv", organization_csv, attacments);

View file

@ -37,6 +37,8 @@ using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.DNS;
using WebsitePanel.Server;
using WebsitePanel.Providers.ResultObjects;
using WebsitePanel.Providers.Web;
using WebsitePanel.Providers.HostedSolution;
namespace WebsitePanel.EnterpriseServer
{
@ -988,7 +990,7 @@ namespace WebsitePanel.EnterpriseServer
if (startExternalIP.V6 != startInternalIP.V6 && (startExternalIP.V6 != endExternalIP.V6 && endExternalIP != null)) throw new NotSupportedException("All IP addresses must be either V4 or V6.");
int i = 0;
long step = (endExternalIP < startExternalIP) ? -1 : 1;
long step = ((endExternalIP - startExternalIP) > 0) ? 1 : -1;
while (true)
{
@ -1602,6 +1604,20 @@ namespace WebsitePanel.EnterpriseServer
DataProvider.GetDomains(SecurityContext.User.UserId, packageId, true));
}
public static List<DomainInfo> GetDomainsByZoneId(int zoneId)
{
return ObjectUtils.CreateListFromDataSet<DomainInfo>(
DataProvider.GetDomainsByZoneId(SecurityContext.User.UserId, zoneId));
}
public static List<DomainInfo> GetDomainsByDomainItemId(int zoneId)
{
return ObjectUtils.CreateListFromDataSet<DomainInfo>(
DataProvider.GetDomainsByDomainItemId(SecurityContext.User.UserId, zoneId));
}
public static List<DomainInfo> GetMyDomains(int packageId)
{
return ObjectUtils.CreateListFromDataSet<DomainInfo>(
@ -1635,13 +1651,16 @@ namespace WebsitePanel.EnterpriseServer
public static DomainInfo GetDomain(string domainName)
{
// get domain by name
DomainInfo domain = GetDomainItem(domainName);
// return
return GetDomain(domain);
return ObjectUtils.FillObjectFromDataReader<DomainInfo>(
DataProvider.GetDomainByName(SecurityContext.User.UserId, domainName,false, false));
}
public static DomainInfo GetDomain(string domainName, bool searchOnDomainPointer, bool isDomainPointer)
{
return GetDomainItem(domainName, searchOnDomainPointer, isDomainPointer);
}
private static DomainInfo GetDomain(DomainInfo domain)
{
// check domain
@ -1650,7 +1669,7 @@ namespace WebsitePanel.EnterpriseServer
// get instant alias
domain.InstantAliasName = GetDomainAlias(domain.PackageId, domain.DomainName);
DomainInfo instantAlias = GetDomainItem(domain.InstantAliasName);
DomainInfo instantAlias = GetDomainItem(domain.InstantAliasName, true, false);
if (instantAlias != null)
domain.InstantAliasId = instantAlias.DomainId;
@ -1664,9 +1683,15 @@ namespace WebsitePanel.EnterpriseServer
}
public static DomainInfo GetDomainItem(string domainName)
{
return GetDomainItem(domainName, false, false);
}
public static DomainInfo GetDomainItem(string domainName, bool searchOnDomainPointer, bool isDomainPointer)
{
return ObjectUtils.FillObjectFromDataReader<DomainInfo>(
DataProvider.GetDomainByName(SecurityContext.User.UserId, domainName));
DataProvider.GetDomainByName(SecurityContext.User.UserId, domainName, searchOnDomainPointer, isDomainPointer));
}
public static string GetDomainAlias(int packageId, string domainName)
@ -1710,6 +1735,26 @@ namespace WebsitePanel.EnterpriseServer
if (domainId < 0)
return domainId;
DomainInfo domain = ServerController.GetDomain(domainId);
if (domain != null)
{
if (domain.ZoneItemId != 0)
{
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.Os, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.Dns, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.Ftp, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.MsSql2000, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.MsSql2005, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.MsSql2008, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.MsSql2012, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.MySql4, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.MySql5, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.Statistics, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.VPS, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.VPSForPC, domain, "");
}
}
// add instant alias
createInstantAlias &= (domainType != DomainType.DomainPointer);
if (createInstantAlias)
@ -1741,7 +1786,7 @@ namespace WebsitePanel.EnterpriseServer
// add web site pointer
if (webEnabled && pointWebSiteId > 0)
{
WebServerController.AddWebSitePointer(pointWebSiteId, hostName, domainId);
WebServerController.AddWebSitePointer(pointWebSiteId, hostName, domainId, true, false, false);
}
// add mail domain pointer
@ -1770,8 +1815,9 @@ namespace WebsitePanel.EnterpriseServer
// add main domain
int domainId = AddDomainInternal(domain.PackageId, domain.DomainName, createZone,
domain.IsSubDomain, false, domain.IsDomainPointer, false);
domain.IsSubDomain, createInstantAlias, domain.IsDomainPointer, false);
/*
if (domainId < 0)
return domainId;
@ -1781,6 +1827,7 @@ namespace WebsitePanel.EnterpriseServer
{
AddDomainInternal(domain.PackageId, domainAlias, true, false, true, false, false);
}
*/
return domainId;
}
@ -1800,10 +1847,8 @@ namespace WebsitePanel.EnterpriseServer
else if (isDomainPointer)
{
// domain pointer
/*
if (PackageController.GetPackageQuota(packageId, Quotas.OS_DOMAINPOINTERS).QuotaExhausted)
return BusinessErrorCodes.ERROR_DOMAIN_QUOTA_LIMIT;
*/
//if (PackageController.GetPackageQuota(packageId, Quotas.OS_DOMAINPOINTERS).QuotaExhausted)
//return BusinessErrorCodes.ERROR_DOMAIN_QUOTA_LIMIT;
}
else
{
@ -1847,7 +1892,7 @@ namespace WebsitePanel.EnterpriseServer
int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.Dns);
if (serviceId > 0)
{
zoneItemId = DnsServerController.AddZone(packageId, serviceId, domainName);
zoneItemId = DnsServerController.AddZone(packageId, serviceId, domainName, true, isInstantAlias);
}
if (zoneItemId < 0)
@ -1878,6 +1923,116 @@ namespace WebsitePanel.EnterpriseServer
domain.WebSiteId, domain.MailDomainId, domain.IsSubDomain, domain.IsInstantAlias, domain.IsDomainPointer);
}
public static void AddServiceDNSRecords(int packageId, string groupName, DomainInfo domain, string serviceIP)
{
AddServiceDNSRecords(packageId, groupName, domain, serviceIP, false);
}
public static void AddServiceDNSRecords(int packageId, string groupName, DomainInfo domain, string serviceIP, bool wildcardOnly)
{
int serviceId = PackageController.GetPackageServiceId(packageId, groupName);
if (serviceId > 0)
{
List<DnsRecord> tmpZoneRecords = new List<DnsRecord>();
List<GlobalDnsRecord> dnsRecords = ServerController.GetDnsRecordsByService(serviceId);
if (wildcardOnly)
{
List<GlobalDnsRecord> temp = new List<GlobalDnsRecord>();
foreach (GlobalDnsRecord d in dnsRecords)
{
if ((d.RecordName == "*") ||
(d.RecordName == "@"))
temp.Add(d);
}
dnsRecords = temp;
}
DnsZone zone = (DnsZone)PackageController.GetPackageItem(domain.ZoneItemId);
tmpZoneRecords.AddRange(DnsServerController.BuildDnsResourceRecords(dnsRecords, "", domain.ZoneName, serviceIP));
try
{
DNSServer dns = new DNSServer();
ServiceProviderProxy.Init(dns, zone.ServiceId);
DnsRecord[] domainRecords = dns.GetZoneRecords(domain.DomainName);
List<DnsRecord> zoneRecords = new List<DnsRecord>();
foreach (DnsRecord t in tmpZoneRecords)
{
if (!RecordDoesExist(t, domainRecords))
zoneRecords.Add(t);
}
// add new resource records
dns.AddZoneRecords(zone.Name, zoneRecords.ToArray());
}
catch (Exception ex1)
{
TaskManager.WriteError(ex1, "Error updating DNS records");
}
}
}
public static void RemoveServiceDNSRecords(int packageId, string groupName, DomainInfo domain, string serviceIP, bool wildcardOnly)
{
int serviceId = PackageController.GetPackageServiceId(packageId, groupName);
if (serviceId > 0)
{
List<DnsRecord> zoneRecords = new List<DnsRecord>();
List<GlobalDnsRecord> dnsRecords = ServerController.GetDnsRecordsByService(serviceId);
if (wildcardOnly)
{
List<GlobalDnsRecord> temp = new List<GlobalDnsRecord>();
foreach (GlobalDnsRecord d in dnsRecords)
{
if ((d.RecordName == "*") ||
(d.RecordName == "@"))
temp.Add(d);
}
dnsRecords = temp;
}
DnsZone zone = (DnsZone)PackageController.GetPackageItem(domain.ZoneItemId);
zoneRecords.AddRange(DnsServerController.BuildDnsResourceRecords(dnsRecords, "", domain.ZoneName, serviceIP));
try
{
DNSServer dns = new DNSServer();
ServiceProviderProxy.Init(dns, zone.ServiceId);
// add new resource records
dns.DeleteZoneRecords(zone.Name, zoneRecords.ToArray());
}
catch (Exception ex1)
{
TaskManager.WriteError(ex1, "Error updating DNS records");
}
}
}
private static bool RecordDoesExist(DnsRecord record, DnsRecord[] domainRecords)
{
foreach (DnsRecord d in domainRecords)
{
if ((record.RecordName.ToLower() == d.RecordName.ToLower()) &
(record.RecordType == d.RecordType))
{
return true;
}
}
return false;
}
public static int UpdateDomain(DomainInfo domain)
{
// check account
@ -1893,7 +2048,7 @@ namespace WebsitePanel.EnterpriseServer
{
DataProvider.UpdateDomain(SecurityContext.User.UserId,
domain.DomainId, domain.ZoneItemId, domain.HostingAllowed, domain.WebSiteId,
domain.MailDomainId);
domain.MailDomainId, domain.DomainItemId);
return 0;
}
@ -1915,6 +2070,8 @@ namespace WebsitePanel.EnterpriseServer
// load domain
DomainInfo domain = GetDomain(domainId);
if (domain == null)
return 0;
// place log record
TaskManager.StartTask("DOMAIN", "DETACH", domain.DomainName);
@ -1941,6 +2098,18 @@ namespace WebsitePanel.EnterpriseServer
return BusinessErrorCodes.ERROR_ORGANIZATION_DOMAIN_IS_IN_USE;
}
List<DomainInfo> domains = GetDomainsByDomainItemId(domain.DomainId);
foreach (DomainInfo d in domains)
{
if (d.WebSiteId > 0)
{
TaskManager.WriteError("Domain points to the existing web site");
return BusinessErrorCodes.ERROR_DOMAIN_POINTS_TO_WEB_SITE;
}
}
// remove DNS zone meta-item if required
if (domain.ZoneItemId > 0)
{
@ -1970,6 +2139,8 @@ namespace WebsitePanel.EnterpriseServer
// load domain
DomainInfo domain = GetDomain(domainId);
if (domain == null)
return 0;
// place log record
TaskManager.StartTask("DOMAIN", "DELETE", domain.DomainName);
@ -1996,6 +2167,21 @@ namespace WebsitePanel.EnterpriseServer
return BusinessErrorCodes.ERROR_ORGANIZATION_DOMAIN_IS_IN_USE;
}
if (!domain.IsDomainPointer)
{
List<DomainInfo> domains = GetDomainsByDomainItemId(domain.DomainId);
foreach (DomainInfo d in domains)
{
if (d.WebSiteId > 0)
{
TaskManager.WriteError("Domain points to the existing web site");
return BusinessErrorCodes.ERROR_DOMAIN_POINTS_TO_WEB_SITE;
}
}
}
// delete instant alias
if (domain.InstantAliasId > 0)
{
@ -2106,6 +2292,143 @@ namespace WebsitePanel.EnterpriseServer
// update domain
domain.ZoneItemId = zoneItemId;
UpdateDomain(domain);
domain = GetDomain(domainId);
PackageContext cntx = PackageController.GetPackageContext(domain.PackageId);
if (cntx != null)
{
// fill dictionaries
foreach (HostingPlanGroupInfo group in cntx.GroupsArray)
{
try
{
bool bFound = false;
switch (group.GroupName)
{
case ResourceGroups.Dns:
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.Ftp, domain, "");
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.MsSql2000, domain, "");
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.MsSql2005, domain, "");
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.MsSql2008, domain, "");
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.MsSql2012, domain, "");
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.MySql4, domain, "");
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.MySql5, domain, "");
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.Statistics, domain, "");
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.VPS, domain, "");
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.VPSForPC, domain, "");
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.Dns, domain, "");
break;
case ResourceGroups.Os:
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.Os, domain, "");
break;
case ResourceGroups.HostedOrganizations:
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.HostedOrganizations, domain, "");
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.HostedCRM, domain, "");
break;
case ResourceGroups.Mail:
List<DomainInfo> myDomains = ServerController.GetMyDomains(domain.PackageId);
foreach (DomainInfo mailDomain in myDomains)
{
if ((mailDomain.MailDomainId != 0) && (domain.DomainName.ToLower() == mailDomain.DomainName.ToLower()))
{
bFound = true;
break;
}
}
if (bFound) ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.Mail, domain, "");
break;
case ResourceGroups.Exchange:
List<Organization> orgs = OrganizationController.GetOrganizations(domain.PackageId, false);
foreach (Organization o in orgs)
{
List<OrganizationDomainName> names = OrganizationController.GetOrganizationDomains(o.Id);
foreach (OrganizationDomainName name in names)
{
if (domain.DomainName.ToLower() == name.DomainName.ToLower())
{
bFound = true;
break;
}
}
if (bFound) break;
}
if (bFound)
{
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.Exchange, domain, "");
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.BlackBerry, domain, "");
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.OCS, domain, "");
}
break;
case ResourceGroups.Lync:
List<Organization> orgsLync = OrganizationController.GetOrganizations(domain.PackageId, false);
foreach (Organization o in orgsLync)
{
if ((o.DefaultDomain.ToLower() == domain.DomainName.ToLower()) &
(o.LyncTenantId != null))
{
bFound = true;
break;
}
}
if (bFound)
{
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.Lync, domain, "");
}
break;
case ResourceGroups.Web:
List<WebSite> sites = WebServerController.GetWebSites(domain.PackageId, false);
foreach (WebSite w in sites)
{
if ((w.SiteId.ToLower().Replace("." + domain.DomainName.ToLower(), "").IndexOf('.') == -1) ||
(w.SiteId.ToLower() == domain.DomainName.ToLower()))
{
WebServerController.AddWebSitePointer( w.Id,
(w.SiteId.ToLower() == domain.DomainName.ToLower()) ? "" : w.SiteId.ToLower().Replace("." + domain.DomainName.ToLower(), ""),
domain.DomainId, false, true, true);
}
List<DomainInfo> pointers = WebServerController.GetWebSitePointers(w.Id);
foreach (DomainInfo pointer in pointers)
{
if ((pointer.DomainName.ToLower().Replace("." + domain.DomainName.ToLower(), "").IndexOf('.') == -1)||
(pointer.DomainName.ToLower() == domain.DomainName.ToLower()))
{
WebServerController.AddWebSitePointer( w.Id,
(pointer.DomainName.ToLower() == domain.DomainName.ToLower()) ? "" : pointer.DomainName.ToLower().Replace("." + domain.DomainName.ToLower(), ""),
domain.DomainId, false, true, true);
}
}
}
if (sites.Count == 1)
{
// load site item
IPAddressInfo ip = ServerController.GetIPAddress(sites[0].SiteIPAddressId);
string serviceIp = (ip != null) ? ip.ExternalIP : null;
if (string.IsNullOrEmpty(serviceIp))
{
StringDictionary settings = ServerController.GetServiceSettings(sites[0].ServiceId);
if (settings["PublicSharedIP"] != null)
serviceIp = settings["PublicSharedIP"].ToString();
}
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.Web, domain, serviceIp, true);
}
break;
}
}
catch (Exception ex)
{
TaskManager.WriteError(ex);
}
}
}
}
// add web site DNS records
@ -2172,14 +2495,39 @@ namespace WebsitePanel.EnterpriseServer
instantAlias = GetDomainItem(instantAliasId);
}
// add web site pointer if required
if (domain.WebSiteId > 0 && instantAlias.WebSiteId == 0)
string parentZone = domain.ZoneName;
if (string.IsNullOrEmpty(parentZone))
{
int webRes = WebServerController.AddWebSitePointer(domain.WebSiteId, hostName, domainId);
if (webRes < 0)
return webRes;
DomainInfo parentDomain = GetDomain(domain.DomainId);
parentZone = parentDomain.DomainName;
}
/*
if (domain.WebSiteId > 0)
{
WebServerController.AddWebSitePointer(domain.WebSiteId,
((domain.DomainName.Replace("." + parentZone, "") == parentZone) |
(domain.DomainName == parentZone))
? "" : domain.DomainName.Replace("." + parentZone, ""),
instantAlias.DomainId);
}
// add web site pointer if required
List<DomainInfo> domains = GetDomainsByDomainItemId(domain.DomainId);
foreach (DomainInfo d in domains)
{
if (d.WebSiteId > 0)
{
WebServerController.AddWebSitePointer(d.WebSiteId,
((d.DomainName.Replace("." + parentZone, "") == parentZone) |
(d.DomainName == parentZone))
? "" : d.DomainName.Replace("." + parentZone, ""),
instantAlias.DomainId);
}
}
// add mail domain pointer
if (domain.MailDomainId > 0 && instantAlias.MailDomainId == 0)
{
@ -2187,7 +2535,6 @@ namespace WebsitePanel.EnterpriseServer
if (mailRes < 0)
return mailRes;
}
*/
return 0;
}
@ -2209,6 +2556,8 @@ namespace WebsitePanel.EnterpriseServer
// load domain
DomainInfo domain = GetDomain(domainId);
if (domain == null)
return 0;
// place log record
TaskManager.StartTask("DOMAIN", "DELETE_INSTANT_ALIAS", domain.DomainName);
@ -2217,7 +2566,7 @@ namespace WebsitePanel.EnterpriseServer
try
{
// load instant alias domain
DomainInfo instantAlias = GetDomainItem(domain.InstantAliasName);
DomainInfo instantAlias = GetDomainItem(domain.InstantAliasName, true, false);
if (instantAlias == null)
return 0;
@ -2228,7 +2577,17 @@ namespace WebsitePanel.EnterpriseServer
if (webRes < 0)
return webRes;
}
/*
List<DomainInfo> domains = GetDomainsByDomainItemId(instantAlias.DomainId);
foreach (DomainInfo d in domains)
{
if (d.WebSiteId > 0)
{
WebServerController.DeleteWebSitePointer(d.WebSiteId, d.DomainId);
}
}
// remove from mail domain pointers
if (instantAlias.MailDomainId > 0)
{
@ -2236,7 +2595,6 @@ namespace WebsitePanel.EnterpriseServer
if (mailRes < 0)
return mailRes;
}
*/
// delete instant alias
int res = DeleteDomain(instantAlias.DomainId);

View file

@ -331,27 +331,13 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint
string hostName = tmpStr[0];
string domainName = siteName.Substring(hostName.Length + 1, siteName.Length - (hostName.Length + 1));
DomainInfo domain = ServerController.GetDomain(domainName);
if (domain != null)
{
string website = siteName;
List<GlobalDnsRecord> dnsRecords = ServerController.GetDnsRecordsByService(serviceId);
List<DnsRecord> resourceRecords = DnsServerController.BuildDnsResourceRecords(dnsRecords, hostName, domainName, "");
DNSServer dns = new DNSServer();
DnsRecord[] records = ServerController.GetDnsZoneRecords(domain.DomainId);
foreach (DnsRecord record in records)
{
var type = record.RecordType;
if ((type == DnsRecordType.A || type == DnsRecordType.AAAA) && String.IsNullOrEmpty(record.RecordName))
{
ServerController.DeleteDnsZoneRecord(domain.DomainId, String.Empty, type, record.RecordData);
break;
}
}
ServerController.AddDnsZoneRecord(domain.DomainId, hostName, DnsRecordType.A, hostedSharePointSettings["RootWebApplicationIpAddress"], 0, 0, 0, 0);
var ip = hostedSharePointSettings["RootWebApplicationIpAddress"];
var type2 = ip.Contains(":") ? DnsRecordType.AAAA : DnsRecordType.A;
ServerController.AddDnsZoneRecord(domain.DomainId, String.Empty, type2, ip, 0, 0, 0, 0);
}
ServiceProviderProxy.Init(dns, dnsServiceId);
// add new resource records
dns.AddZoneRecords(domainName, resourceRecords.ToArray());
}
TaskManager.ItemId = itemId;
@ -412,27 +398,13 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint
string hostName = tmpStr[0];
string domainName = siteName.Substring(hostName.Length + 1, siteName.Length - (hostName.Length + 1));
DomainInfo domain = ServerController.GetDomain(domainName);
if (domain != null)
{
var ip = hostedSharePointSettings["RootWebApplicationIpAddress"];
var type = ip.Contains(":") ? DnsRecordType.AAAA : DnsRecordType.A;
ServerController.DeleteDnsZoneRecord(domain.DomainId, String.Empty, type, ip);
ServerController.DeleteDnsZoneRecord(domain.DomainId, "www", type, ip);
if (!String.IsNullOrEmpty(domain.WebSiteName))
{
DnsRecord[] records = ServerController.GetDnsZoneRecords(domain.DomainId);
foreach (DnsRecord record in records)
{
type = record.RecordType;
if ((type == DnsRecordType.A || type == DnsRecordType.AAAA) && record.RecordName.Equals("www", StringComparison.CurrentCultureIgnoreCase))
{
ServerController.AddDnsZoneRecord(domain.DomainId, String.Empty, DnsRecordType.A, record.RecordData, 0, 0, 0, 0);
break;
}
}
}
}
List<GlobalDnsRecord> dnsRecords = ServerController.GetDnsRecordsByService(origItem.ServiceId);
List<DnsRecord> resourceRecords = DnsServerController.BuildDnsResourceRecords(dnsRecords, hostName, domainName, "");
DNSServer dns = new DNSServer();
ServiceProviderProxy.Init(dns, dnsServiceId);
// add new resource records
dns.DeleteZoneRecords(domainName, resourceRecords.ToArray());
}
return 0;

View file

@ -228,7 +228,7 @@ namespace WebsitePanel.EnterpriseServer
"sp_dropsrvrolemember '{0}', 'dbcreator'\nGO", dbUser.Name));
// restore original web site bindings
web.UpdateSiteBindings(site.SiteId, bindings);
web.UpdateSiteBindings(site.SiteId, bindings, false);
// save statistics item
item.ServiceId = serviceId;

View file

@ -398,6 +398,8 @@ namespace WebsitePanel.EnterpriseServer
public static Dictionary<int, BackgroundTask> GetScheduledTasks()
{
Dictionary<int, BackgroundTask> scheduledTasks = new Dictionary<int, BackgroundTask>();
try
{
foreach (BackgroundTask task in tasks.Values)
{
if (task.ScheduleId > 0
@ -405,6 +407,10 @@ namespace WebsitePanel.EnterpriseServer
&& !scheduledTasks.ContainsKey(task.ScheduleId))
scheduledTasks.Add(task.ScheduleId, task);
}
}
catch (Exception)
{
}
return scheduledTasks;
}

View file

@ -39,6 +39,7 @@ using WebsitePanel.Providers;
using System.Text;
using System.Collections;
using System.Net.Mail;
using System.Diagnostics;
namespace WebsitePanel.EnterpriseServer
{
@ -2991,6 +2992,18 @@ namespace WebsitePanel.EnterpriseServer
public static ResultObject AddVirtualMachinePrivateIPAddresses(int itemId, bool selectRandom, int addressesNumber, string[] addresses, bool provisionKvp)
{
// trace info
Trace.TraceInformation("Entering AddVirtualMachinePrivateIPAddresses()");
Trace.TraceInformation("Item ID: {0}", itemId);
Trace.TraceInformation("SelectRandom: {0}", selectRandom);
Trace.TraceInformation("AddressesNumber: {0}", addressesNumber);
if (addresses != null)
{
foreach(var address in addresses)
Trace.TraceInformation("addresses[n]: {0}", address);
}
ResultObject res = new ResultObject();
// load service item
@ -3026,6 +3039,9 @@ namespace WebsitePanel.EnterpriseServer
bool wasEmptyList = (nic.IPAddresses.Length == 0);
if(wasEmptyList)
Trace.TraceInformation("NIC IP addresses list is empty");
// check IP addresses if they are specified
List<string> checkResults = CheckPrivateIPAddresses(vm.PackageId, addresses);
if (checkResults.Count > 0)
@ -3213,51 +3229,69 @@ namespace WebsitePanel.EnterpriseServer
private static string GenerateNextAvailablePrivateIP(SortedList<IPAddress, string> ips, string subnetMask, string startIPAddress)
{
// start IP address
var startIp = IPAddress.Parse(startIPAddress);
var mask = IPAddress.Parse(subnetMask);
Trace.TraceInformation("Entering GenerateNextAvailablePrivateIP()");
Trace.TraceInformation("Param - number of sorted IPs in the list: {0}", ips.Count);
Trace.TraceInformation("Param - startIPAddress: {0}", startIPAddress);
Trace.TraceInformation("Param - subnetMask: {0}", subnetMask);
var lastAddress = (startIp & ~mask) - 1;
// start IP address
var ip = IPAddress.Parse(startIPAddress) - 1;
Trace.TraceInformation("Start looking for next available IP");
foreach (var addr in ips.Keys)
{
if ((addr - lastAddress) > 1)
if ((addr - ip) > 1)
{
// it is a gap
break;
}
else
{
lastAddress = addr;
ip = addr;
}
}
var genAddr = lastAddress + 1;
// final IP found
ip = ip + 1;
// convert to IP address
var ip = startIp & mask | genAddr;
string genIP = ip.ToString();
Trace.TraceInformation("Generated IP: {0}", genIP);
// store in cache
ips.Add(genAddr, genIP);
Trace.TraceInformation("Adding to sorted list");
ips.Add(ip, genIP);
Trace.TraceInformation("Leaving GenerateNextAvailablePrivateIP()");
return genIP;
}
private static SortedList<IPAddress, string> GetSortedNormalizedIPAddresses(List<PrivateIPAddress> ips, string subnetMask)
{
Trace.TraceInformation("Entering GetSortedNormalizedIPAddresses()");
Trace.TraceInformation("Param - subnetMask: {0}", subnetMask);
var mask = IPAddress.Parse(subnetMask);
SortedList<IPAddress, string> sortedIps = new SortedList<IPAddress, string>();
foreach (PrivateIPAddress ip in ips)
{
var addr = ~mask & IPAddress.Parse(ip.IPAddress);
var addr = IPAddress.Parse(ip.IPAddress);
sortedIps.Add(addr, ip.IPAddress);
Trace.TraceInformation("Added {0} to sorted IPs list with key: {1} ", ip.IPAddress, addr.ToString());
}
Trace.TraceInformation("Leaving GetSortedNormalizedIPAddresses()");
return sortedIps;
}
private static string GetPrivateNetworkSubnetMask(string cidr, bool v6) {
if (v6) return "/" + cidr;
else return IPAddress.Parse("/" + cidr).ToV4MaskString();
if (v6)
{
return "/" + cidr;
}
else
{
return IPAddress.Parse("/" + cidr).ToV4MaskString();
}
}
private static string GetSubnetMaskCidr(string subnetMask) {
@ -3266,7 +3300,7 @@ namespace WebsitePanel.EnterpriseServer
var ip = IPAddress.Parse(subnetMask);
if (ip.V4) {
int cidr = 32;
long mask = (long)ip.Address;
var mask = ip.Address;
while ((mask & 1) == 0 && cidr > 0) {
mask >>= 1;
cidr -= 1;
@ -3282,7 +3316,8 @@ namespace WebsitePanel.EnterpriseServer
var mask = IPAddress.Parse(subnetMask);
var ip = IPAddress.Parse(ipAddress);
return ((mask & ip) == mask);
//return ((mask & ip) == mask);
return true;
}
#endregion

View file

@ -3778,7 +3778,7 @@ namespace WebsitePanel.EnterpriseServer
ret = vs.GetDeviceEvents(serviceInfo.ServerName, serviceProviderItem.Name);
}
catch(Exception ex)
catch(Exception )
{
ret = null;
}
@ -3804,7 +3804,7 @@ namespace WebsitePanel.EnterpriseServer
ret = vs.GetMonitoringAlerts(serviceInfo.ServerName, serviceProviderItem.Name);
}
catch (Exception ex)
catch (Exception )
{
ret = null;
}
@ -3832,7 +3832,7 @@ namespace WebsitePanel.EnterpriseServer
ret = vs.GetPerfomanceValue(serviceProviderItem.Name, perf, startPeriod, endPeriod);
}
catch (Exception ex)
catch (Exception )
{
ret = null;
}

View file

@ -156,7 +156,10 @@ namespace WebsitePanel.EnterpriseServer
WebServer webServer = GetAssociatedWebServer(packageId);
if (!webServer.IsMsDeployInstalled())
{
TaskManager.WriteError("MsDeploy is not installed");
return Error<GalleryCategoriesResult>(GalleryErrors.MsDeployIsNotInstalled);
}
// get categories
result = webServer.GetGalleryCategories(SecurityContext.User.UserId);
@ -270,6 +273,7 @@ namespace WebsitePanel.EnterpriseServer
// x => MatchGalleryAppDependencies(x.Dependency, appsFilter.ToArray())
// || MatchMenaltoGalleryApp(x, appsFilter.ToArray())));
{
FilterResultApplications(packageId, result);
@ -293,15 +297,34 @@ namespace WebsitePanel.EnterpriseServer
int userId = SecurityContext.User.UserId;
//
SecurityContext.SetThreadSupervisorPrincipal();
//get filter mode
int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.Web);
StringDictionary serviceSettings = ServerController.GetServiceSettings(serviceId);
bool bExclude = (Utils.ParseInt(serviceSettings["GalleryAppsFilterMode"], 0) != 1); //0 - Exclude apps, 1- Include apps
//
string[] filteredApps = GetServiceAppsCatalogFilter(packageId);
//
if (filteredApps != null)
{
if (bExclude)
{
result.Value = new List<GalleryApplication>(Array.FindAll(result.Value.ToArray(),
x => !Array.Exists(filteredApps,
z => z.Equals(x.Id, StringComparison.InvariantCultureIgnoreCase))));
}
else
{
result.Value = new List<GalleryApplication>(Array.FindAll(result.Value.ToArray(),
x => Array.Exists(filteredApps,
z => z.Equals(x.Id, StringComparison.InvariantCultureIgnoreCase))));
}
}
//
SecurityContext.SetThreadPrincipal(userId);
}
@ -487,6 +510,19 @@ namespace WebsitePanel.EnterpriseServer
|| context.Groups.ContainsKey(ResourceGroups.MySql5)))
result.ErrorCodes.Add(GalleryErrors.MySQLRequired);
//show Dependency warning optionaly
int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.Web);
StringDictionary serviceSettings = ServerController.GetServiceSettings(serviceId);
bool galleryAppsAlwaysIgnoreDependencies = Utils.ParseBool(serviceSettings["GalleryAppsAlwaysIgnoreDependencies"], false);
if (galleryAppsAlwaysIgnoreDependencies)
{
result.ErrorCodes.Clear();
}
if (result.ErrorCodes.Count > 0)
{
GalleryApplicationResult warning = Warning<GalleryApplicationResult>(result, GalleryErrors.PackageDoesNotMeetRequirements);

View file

@ -29,6 +29,7 @@
using System;
using System.IO;
using System.Data;
using System.Linq;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.Text;
@ -133,6 +134,18 @@ namespace WebsitePanel.EnterpriseServer
if(ip != null)
site.SiteIPAddress = ip.ExternalIP;
// check if site has dedicated IP assigned
var siteIpAddresses = ServerController.GetItemIPAddresses(siteItemId, IPAddressPool.None);
foreach (var siteIp in siteIpAddresses)
{
var packageIpAddress = ServerController.GetPackageIPAddress(siteIp.AddressID);
if (packageIpAddress != null && packageIpAddress.ExternalIP == site.SiteIPAddress)
{
site.IsDedicatedIP = true;
break;
}
}
// truncate home folder
site.ContentPath = FilesController.GetVirtualPackagePath(siteItem.PackageId, site.ContentPath);
@ -143,14 +156,13 @@ namespace WebsitePanel.EnterpriseServer
site.FrontPageAccount = siteItem.FrontPageAccount;
if (String.IsNullOrEmpty(site.FrontPageAccount))
site.FrontPageAccount = GetFrontPageUsername(site.Name);
#region Restore Web Deploy publishing persistent properties
// Set Web Deploy publishing account
site.WebDeployPublishingAccount = siteItem.WebDeployPublishingAccount;
// Set Web Deploy site publishing enabled
site.WebDeploySitePublishingEnabled = siteItem.WebDeploySitePublishingEnabled;
// Set Web Deploy site publishing profile
site.WebDeploySitePublishingProfile = siteItem.WebDeploySitePublishingProfile;
#endregion
return site;
}
@ -160,6 +172,21 @@ namespace WebsitePanel.EnterpriseServer
return AddWebSite(packageId, hostName, domainId, ipAddressId, false, true);
}
private static bool IsValidIPAdddress(string addr)
{
System.Net.IPAddress ip;
if (System.Net.IPAddress.TryParse(addr, out ip))
{
return ((ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetworkV6) |
(ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork));
}
else
{
return false;
}
}
public static int AddWebSite(int packageId, string hostName, int domainId, int packageAddressId,
bool addInstantAlias, bool ignoreGlobalDNSRecords)
{
@ -201,7 +228,7 @@ namespace WebsitePanel.EnterpriseServer
if (serviceId == 0)
return BusinessErrorCodes.ERROR_WEB_SITE_SERVICE_UNAVAILABLE;
#region Fix for bug #587
// Initialize IIS provider webservice proxy
WebServer web = new WebServer();
ServiceProviderProxy.Init(web, serviceId);
@ -219,7 +246,6 @@ namespace WebsitePanel.EnterpriseServer
// Return generic operation failed error
return BusinessErrorCodes.FAILED_EXECUTE_SERVICE_OPERATION;
}
#endregion
// load web settings
StringDictionary webSettings = ServerController.GetServiceSettings(serviceId);
@ -247,11 +273,29 @@ namespace WebsitePanel.EnterpriseServer
// load web DNS records
List<GlobalDnsRecord> dnsRecords = ServerController.GetDnsRecordsByService(serviceId);
if (dedicatedIp)
{
foreach (GlobalDnsRecord d in dnsRecords)
{
if (!string.IsNullOrEmpty(d.ExternalIP))
{
if (!IsValidIPAdddress(d.ExternalIP)) return BusinessErrorCodes.ERROR_GLOBALDNS_FOR_DEDICATEDIP;
}
}
}
else
{
if (domain.ZoneItemId > 0)
{
StringDictionary settings = ServerController.GetServiceSettings(serviceId);
if (string.IsNullOrEmpty(settings["PublicSharedIP"]))
return BusinessErrorCodes.ERROR_PUBLICSHAREDIP_FOR_SHAREDIP;
}
}
// prepare site bindings
List<ServerBinding> bindings = new List<ServerBinding>();
if (!dedicatedIp)
{
// SHARED IP
// fill main domain bindings
FillWebServerBindings(bindings, dnsRecords, ipAddr, hostName, domain.DomainName, ignoreGlobalDNSRecords);
@ -263,8 +307,7 @@ namespace WebsitePanel.EnterpriseServer
return BusinessErrorCodes.ERROR_WEB_SITE_ALREADY_EXISTS;
}
}
else
if (dedicatedIp)
{
// DEDICATED IP
bindings.Add(new ServerBinding(ipAddr, "80", ""));
@ -321,13 +364,11 @@ namespace WebsitePanel.EnterpriseServer
site.EnableParentPaths = Utils.ParseBool(webPolicy["EnableParentPaths"], false);
site.DedicatedApplicationPool = Utils.ParseBool(webPolicy["EnableDedicatedPool"], false);
#region Fix for bug: #1556
// Ensure the website meets hosting plan quotas
QuotaValueInfo quotaInfo = PackageController.GetPackageQuota(packageId, Quotas.WEB_APPPOOLS);
site.DedicatedApplicationPool = site.DedicatedApplicationPool && (quotaInfo.QuotaAllocatedValue > 0);
#endregion
site.EnableAnonymousAccess = Utils.ParseBool(webPolicy["EnableAnonymousAccess"], false);
site.EnableWindowsAuthentication = Utils.ParseBool(webPolicy["EnableWindowsAuthentication"], false);
site.EnableBasicAuthentication = Utils.ParseBool(webPolicy["EnableBasicAuthentication"], false);
@ -386,7 +427,7 @@ namespace WebsitePanel.EnterpriseServer
// update domain
// add main pointer
AddWebSitePointer(siteItemId, hostName, domain.DomainId, false, ignoreGlobalDNSRecords);
AddWebSitePointer(siteItemId, hostName, domain.DomainId, false, ignoreGlobalDNSRecords, false);
// add parking page
@ -560,27 +601,56 @@ namespace WebsitePanel.EnterpriseServer
// delete web site
try
{
//cleanup certificates
//cleanup certificates
List<SSLCertificate> certificates = GetCertificatesForSite(siteItemId);
foreach (SSLCertificate c in certificates)
{
DeleteCertificate(siteItemId, c);
}
// remove all web site pointers
List<DomainInfo> pointers = GetWebSitePointers(siteItemId);
foreach (DomainInfo pointer in pointers)
DeleteWebSitePointer(siteItemId, pointer.DomainId, false, true);
DeleteWebSitePointer(siteItemId, pointer.DomainId, false, true, true);
// remove web site main pointer
DomainInfo domain = ServerController.GetDomain(siteItem.Name);
if(domain != null)
DeleteWebSitePointer(siteItemId, domain.DomainId, false, true);
DeleteWebSitePointer(siteItemId, domain.DomainId, false, true, true);
List<WebSite> sites = WebServerController.GetWebSites(domain.PackageId, false);
bool oneSiteOnly = (sites.Count == 1);
if (oneSiteOnly)
{
// load site item
IPAddressInfo ip = ServerController.GetIPAddress(sites[0].SiteIPAddressId);
string serviceIp = (ip != null) ? ip.ExternalIP : null;
if (string.IsNullOrEmpty(serviceIp))
{
StringDictionary settings = ServerController.GetServiceSettings(sites[0].ServiceId);
if (settings["PublicSharedIP"] != null)
serviceIp = settings["PublicSharedIP"].ToString();
}
ServerController.RemoveServiceDNSRecords(domain.PackageId, ResourceGroups.Web, domain, serviceIp, true);
}
// delete web site
WebServer web = new WebServer();
ServiceProviderProxy.Init(web, siteItem.ServiceId);
#region Fix for bug #710
//
if (web.IsFrontPageSystemInstalled() && web.IsFrontPageInstalled(siteItem.SiteId))
{
web.UninstallFrontPage(siteItem.SiteId, siteItem.FrontPageAccount);
}
#endregion
//
web.DeleteSite(siteItem.SiteId);
@ -611,12 +681,23 @@ namespace WebsitePanel.EnterpriseServer
if (siteItem == null)
return BusinessErrorCodes.ERROR_WEB_SITE_PACKAGE_ITEM_NOT_FOUND;
// load assigned IP address
IPAddressInfo ip = ServerController.GetIPAddress(ipAddressId);
if (ip == null)
return BusinessErrorCodes.ERROR_WEB_SITE_IP_ADDRESS_NOT_SPECIFIED;
string ipAddr = !String.IsNullOrEmpty(ip.InternalIP) ? ip.InternalIP : ip.ExternalIP;
int addressId = 0;
PackageIPAddress packageIp = ServerController.GetPackageIPAddress(ipAddressId);
if (packageIp != null)
{
addressId = packageIp.AddressID;
}
List<GlobalDnsRecord> dnsRecords = ServerController.GetDnsRecordsByService(siteItem.ServiceId);
foreach (GlobalDnsRecord d in dnsRecords)
{
if (!string.IsNullOrEmpty(d.ExternalIP))
{
if (!IsValidIPAdddress(d.ExternalIP)) return BusinessErrorCodes.ERROR_GLOBALDNS_FOR_DEDICATEDIP;
}
}
// place log record
TaskManager.StartTask("WEB_SITE", "SWITCH_TO_DEDICATED_IP", siteItem.Name);
@ -624,32 +705,150 @@ namespace WebsitePanel.EnterpriseServer
try
{
// get web site pointers
var sitePointers = GetWebSitePointers(siteItemId);
IPAddressInfo ip;
// get existing web site bindings
// remove all web site pointers
DomainInfo domain = ServerController.GetDomain(siteItem.Name);
DomainInfo ZoneInfo = ServerController.GetDomain(domain.DomainItemId);
if (ZoneInfo == null)
throw new Exception("Parent zone not found");
//cleanup certificates
List<SSLCertificate> certificates = GetCertificatesForSite(siteItemId);
foreach (SSLCertificate c in certificates)
{
DeleteCertificate(siteItemId, c);
}
certificates = GetPendingCertificates(siteItemId);
foreach (SSLCertificate c in certificates)
{
DeleteCertificateRequest(siteItemId, c.id);
}
List<DomainInfo> pointers = GetWebSitePointers(siteItemId);
foreach (DomainInfo pointer in pointers)
DeleteWebSitePointer(siteItemId, pointer.DomainId, true, true, false);
// remove web site main pointer
if (domain != null)
DeleteWebSitePointer(siteItemId, domain.DomainId, true, true, false);
// clear binding left overs
List<ServerBinding> newBindings = new List<ServerBinding>();
WebServer web = new WebServer();
ServiceProviderProxy.Init(web, siteItem.ServiceId);
var bindings = web.GetSiteBindings(siteItem.SiteId);
try
{
web.UpdateSiteBindings(siteItem.SiteId, newBindings.ToArray(), true);
}
catch (Exception)
{
}
List<WebSite> sites = WebServerController.GetWebSites(domain.PackageId, false);
bool oneSiteOnly = (sites.Count == 1);
if (oneSiteOnly)
{
// load site item
ip = ServerController.GetIPAddress(sites[0].SiteIPAddressId);
string serviceIp = (ip != null) ? ip.ExternalIP : null;
if (string.IsNullOrEmpty(serviceIp))
{
StringDictionary settings = ServerController.GetServiceSettings(sites[0].ServiceId);
if (settings["PublicSharedIP"] != null)
serviceIp = settings["PublicSharedIP"].ToString();
}
ServerController.RemoveServiceDNSRecords(domain.PackageId, ResourceGroups.Web, domain, serviceIp, true);
}
// update site bindings
web.UpdateSiteBindings(siteItem.SiteId, new ServerBinding[] { new ServerBinding(ipAddr, "80", "") });
// update site item
siteItem.SiteIPAddressId = ipAddressId;
siteItem.SiteIPAddressId = addressId;
PackageController.UpdatePackageItem(siteItem);
// associate IP with web site
if (ipAddressId != 0)
ServerController.AddItemIPAddress(siteItemId, ipAddressId);
// TODO - what would be correct logic here?
// re-create pointers
foreach (var pointer in sitePointers)
DeleteWebSitePointer(siteItemId, pointer.DomainId, false, true);
foreach (var pointer in sitePointers)
AddWebSitePointer(siteItemId, null, pointer.DomainId, false);
string parentZone = domain.ZoneName;
if (string.IsNullOrEmpty(parentZone))
{
DomainInfo parentDomain = ServerController.GetDomain(domain.DomainItemId);
parentZone = parentDomain.DomainName;
}
AddWebSitePointer(siteItemId,
((domain.DomainName.Replace("." + parentZone, "") == parentZone) |
(domain.DomainName == parentZone))
? "" : domain.DomainName.Replace("." + parentZone, "")
, ZoneInfo.DomainId, true, true, true);
foreach (DomainInfo pointer in pointers)
{
string pointerParentZone = pointer.ZoneName;
if (string.IsNullOrEmpty(pointerParentZone))
{
DomainInfo parentDomain = ServerController.GetDomain(pointer.DomainItemId);
pointerParentZone = parentDomain.DomainName;
}
ZoneInfo = ServerController.GetDomain(pointerParentZone);
AddWebSitePointer(siteItemId,
((pointer.DomainName.Replace("." + pointerParentZone, "") == pointerParentZone) |
(pointer.DomainName == pointerParentZone))
? "" : pointer.DomainName.Replace("." + pointerParentZone, "")
, ZoneInfo.DomainId, true, true, true);
}
// load web site IP address
ip = ServerController.GetIPAddress(siteItem.SiteIPAddressId);
string ipAddr = "*";
if (ip != null)
ipAddr = !String.IsNullOrEmpty(ip.InternalIP) ? ip.InternalIP : ip.ExternalIP;
newBindings = new List<ServerBinding>();
ServerBinding srvBinding = new ServerBinding(ipAddr, "80", "");
newBindings.Add(srvBinding);
foreach (ServerBinding b in web.GetSiteBindings(siteItem.SiteId))
{
if (!((b.Host == srvBinding.Host) &
(b.IP == srvBinding.IP) &
(b.Port == srvBinding.Port)))
newBindings.Add(b);
}
web.UpdateSiteBindings(siteItem.SiteId, newBindings.ToArray(), false);
if (oneSiteOnly)
{
sites = WebServerController.GetWebSites(domain.PackageId, false);
// load site item
ip = ServerController.GetIPAddress(sites[0].SiteIPAddressId);
string serviceIp = (ip != null) ? ip.ExternalIP : null;
if (string.IsNullOrEmpty(serviceIp))
{
StringDictionary settings = ServerController.GetServiceSettings(sites[0].ServiceId);
if (settings["PublicSharedIP"] != null)
serviceIp = settings["PublicSharedIP"].ToString();
}
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.Web, domain, serviceIp, true);
}
return 0;
}
@ -674,21 +873,160 @@ namespace WebsitePanel.EnterpriseServer
if (siteItem == null)
return BusinessErrorCodes.ERROR_WEB_SITE_PACKAGE_ITEM_NOT_FOUND;
// place log record
TaskManager.StartTask("WEB_SITE", "SWITCH_TO_SHARED_IP", siteItem.Name);
TaskManager.ItemId = siteItemId;
try
{
// get web site pointers
var sitePointers = GetWebSitePointers(siteItemId);
IPAddressInfo ip;
// get existing web site bindings
DomainInfo domain = ServerController.GetDomain(siteItem.Name);
DomainInfo ZoneInfo = ServerController.GetDomain(domain.DomainItemId);
if (ZoneInfo == null)
throw new Exception("Parent zone not found");
if (ZoneInfo.ZoneItemId > 0)
{
StringDictionary settings = ServerController.GetServiceSettings(siteItem.ServiceId);
if (string.IsNullOrEmpty(settings["PublicSharedIP"]))
return BusinessErrorCodes.ERROR_PUBLICSHAREDIP_FOR_SHAREDIP;
}
//cleanup certificates
List<SSLCertificate> certificates = GetCertificatesForSite(siteItemId);
foreach (SSLCertificate c in certificates)
{
DeleteCertificate(siteItemId, c);
}
certificates = GetPendingCertificates(siteItemId);
foreach (SSLCertificate c in certificates)
{
DeleteCertificateRequest(siteItemId, c.id);
}
// remove all web site pointers
List<DomainInfo> pointers = GetWebSitePointers(siteItemId);
foreach (DomainInfo pointer in pointers)
DeleteWebSitePointer(siteItemId, pointer.DomainId, true, true, false);
// remove web site main pointer
if (domain != null)
DeleteWebSitePointer(siteItemId, domain.DomainId, true, true, false);
// clear binding left overs
WebServer web = new WebServer();
ServiceProviderProxy.Init(web, siteItem.ServiceId);
var bindings = web.GetSiteBindings(siteItem.SiteId);
List<ServerBinding> newBindings = new List<ServerBinding>();
try
{
web.UpdateSiteBindings(siteItem.SiteId, newBindings.ToArray(), true);
}
catch (Exception)
{
}
List<WebSite> sites = WebServerController.GetWebSites(domain.PackageId, false);
bool oneSiteOnly = (sites.Count == 1);
if (oneSiteOnly)
{
// load site item
ip = ServerController.GetIPAddress(sites[0].SiteIPAddressId);
string serviceIp = (ip != null) ? ip.ExternalIP : null;
if (string.IsNullOrEmpty(serviceIp))
{
StringDictionary settings = ServerController.GetServiceSettings(sites[0].ServiceId);
if (settings["PublicSharedIP"] != null)
serviceIp = settings["PublicSharedIP"].ToString();
}
ServerController.RemoveServiceDNSRecords(domain.PackageId, ResourceGroups.Web, domain, serviceIp, true);
}
//figure out the PackageAddressId
PackageIPAddress packageIpAddress = null;
var siteIpAddresses = ServerController.GetItemIPAddresses(siteItemId, IPAddressPool.None);
foreach (var siteIp in siteIpAddresses)
{
packageIpAddress = ServerController.GetPackageIPAddress(siteIp.AddressID);
if (packageIpAddress != null && packageIpAddress.AddressID == siteItem.SiteIPAddressId)
{
break;
}
}
//Deallocate IP Address
if (packageIpAddress != null)
ServerController.DeleteItemIPAddress(siteItemId, packageIpAddress.PackageAddressID);
// update site item
siteItem.SiteIPAddressId = 0;
PackageController.UpdatePackageItem(siteItem);
string parentZone = domain.ZoneName;
if (string.IsNullOrEmpty(parentZone))
{
DomainInfo parentDomain = ServerController.GetDomain(domain.DomainItemId);
parentZone = parentDomain.DomainName;
}
AddWebSitePointer(siteItemId,
((domain.DomainName.Replace("." + parentZone, "") == parentZone) |
(domain.DomainName == parentZone))
? "" : domain.DomainName.Replace("." + parentZone, "")
, ZoneInfo.DomainId, true, true, true);
foreach (DomainInfo pointer in pointers)
{
string pointerParentZone = pointer.ZoneName;
if (string.IsNullOrEmpty(pointerParentZone))
{
DomainInfo parentDomain = ServerController.GetDomain(pointer.DomainItemId);
pointerParentZone = parentDomain.DomainName;
}
ZoneInfo = ServerController.GetDomain(pointerParentZone);
AddWebSitePointer(siteItemId,
((pointer.DomainName.Replace("." + pointerParentZone, "") == pointerParentZone) |
(pointer.DomainName == pointerParentZone))
? "" : pointer.DomainName.Replace("." + pointerParentZone, "")
, ZoneInfo.DomainId, true, true, true);
}
if (oneSiteOnly)
{
sites = WebServerController.GetWebSites(domain.PackageId, false);
// load site item
ip = ServerController.GetIPAddress(sites[0].SiteIPAddressId);
string serviceIp = (ip != null) ? ip.ExternalIP : null;
if (string.IsNullOrEmpty(serviceIp))
{
StringDictionary settings = ServerController.GetServiceSettings(sites[0].ServiceId);
if (settings["PublicSharedIP"] != null)
serviceIp = settings["PublicSharedIP"].ToString();
}
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.Web, domain, serviceIp, true);
}
// TODO - what would be correct logic here?
return 0;
}
@ -736,7 +1074,7 @@ namespace WebsitePanel.EnterpriseServer
if ((bindings.Count == bindingsCount) | (bindings.Count == 0))
{
AddBinding(bindings, new ServerBinding(ipAddr, "80", string.IsNullOrEmpty(hostName) ? domainName : hostName + "." + domainName));
AddBinding(bindings, new ServerBinding(ipAddr, "80", string.IsNullOrEmpty(hostName) ? domainName : string.IsNullOrEmpty(domainName) ? hostName : hostName + "." + domainName));
}
}
@ -837,15 +1175,15 @@ namespace WebsitePanel.EnterpriseServer
public static int AddWebSitePointer(int siteItemId, string hostName, int domainId)
{
return AddWebSitePointer(siteItemId, hostName, domainId, true, true);
return AddWebSitePointer(siteItemId, hostName, domainId, true, true, false);
}
internal static int AddWebSitePointer(int siteItemId, string hostName, int domainId, bool updateWebSite)
{
return AddWebSitePointer(siteItemId, hostName, domainId, updateWebSite, false);
return AddWebSitePointer(siteItemId, hostName, domainId, updateWebSite, false, false);
}
internal static int AddWebSitePointer(int siteItemId, string hostName, int domainId, bool updateWebSite, bool ignoreGlobalDNSRecords)
internal static int AddWebSitePointer(int siteItemId, string hostName, int domainId, bool updateWebSite, bool ignoreGlobalDNSRecords, bool rebuild)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
@ -862,8 +1200,11 @@ namespace WebsitePanel.EnterpriseServer
return BusinessErrorCodes.ERROR_DOMAIN_PACKAGE_ITEM_NOT_FOUND;
// check if the web site already exists
if (!rebuild)
{
if (DataProvider.CheckDomain(domain.PackageId, string.IsNullOrEmpty(hostName) ? domain.DomainName : hostName + "." + domain.DomainName, true) != 0)
return BusinessErrorCodes.ERROR_WEB_SITE_ALREADY_EXISTS;
}
// get zone records for the service
List<GlobalDnsRecord> dnsRecords = ServerController.GetDnsRecordsByService(siteItem.ServiceId);
@ -880,6 +1221,8 @@ namespace WebsitePanel.EnterpriseServer
try
{
// load appropriate zone
DnsZone zone = (DnsZone)PackageController.GetPackageItem(domain.ZoneItemId);
@ -891,6 +1234,13 @@ namespace WebsitePanel.EnterpriseServer
string serviceIp = (ip != null) ? ip.ExternalIP : null;
if (string.IsNullOrEmpty(serviceIp))
{
StringDictionary settings = ServerController.GetServiceSettings(siteItem.ServiceId);
if (settings["PublicSharedIP"] != null)
serviceIp = settings["PublicSharedIP"].ToString();
}
//filter initiat GlobaDNSRecords list
if (ignoreGlobalDNSRecords)
{
@ -898,16 +1248,20 @@ namespace WebsitePanel.EnterpriseServer
foreach (GlobalDnsRecord r in dnsRecords)
{
if (r.RecordName == "[host_name]")
{
tmpDnsRecords.Add(r);
break;
}
}
}
else
tmpDnsRecords = dnsRecords;
List<DnsRecord> resourceRecords = DnsServerController.BuildDnsResourceRecords(
tmpDnsRecords, hostName, domain.DomainName, serviceIp);
List<DnsRecord> resourceRecords = DnsServerController.BuildDnsResourceRecords(tmpDnsRecords, hostName, domain.DomainName, serviceIp);
if (!rebuild)
{
foreach (DnsRecord r in resourceRecords)
{
if (r.RecordName != "*")
@ -917,12 +1271,24 @@ namespace WebsitePanel.EnterpriseServer
return BusinessErrorCodes.ERROR_WEB_SITE_ALREADY_EXISTS;
}
}
}
try
{
DNSServer dns = new DNSServer();
ServiceProviderProxy.Init(dns, zone.ServiceId);
DnsRecord[] domainRecords = dns.GetZoneRecords(zone.Name);
var duplicateRecords = (from zoneRecord in domainRecords
from resRecord in resourceRecords
where zoneRecord.RecordName == resRecord.RecordName
where zoneRecord.RecordType == resRecord.RecordType
select zoneRecord).ToArray();
if (duplicateRecords != null && duplicateRecords.Count() > 0)
{
dns.DeleteZoneRecords(zone.Name, duplicateRecords);
}
// add new resource records
dns.AddZoneRecords(zone.Name, resourceRecords.ToArray());
}
@ -945,8 +1311,6 @@ namespace WebsitePanel.EnterpriseServer
bool dedicatedIp = bindings.Exists(binding => { return String.IsNullOrEmpty(binding.Host) && binding.IP != "*"; });
// update binding only for "shared" ip addresses
if (!dedicatedIp)
{
// add new host headers
string ipAddr = "*";
if (ip != null)
@ -964,26 +1328,49 @@ namespace WebsitePanel.EnterpriseServer
// update bindings
if (updateWebSite)
web.UpdateSiteBindings(siteItem.SiteId, bindings.ToArray());
}
web.UpdateSiteBindings(siteItem.SiteId, bindings.ToArray(), false);
// update domain
if (!rebuild)
{
domain.WebSiteId = siteItemId;
domain.IsDomainPointer = true;
foreach (ServerBinding b in bindings)
{
//add new domain record
if (!string.IsNullOrEmpty(b.Host))
{
domain.DomainName = b.Host;
int domainID = ServerController.AddDomain(domain);
DomainInfo domainTmp = ServerController.GetDomain(domainID);
DomainInfo domainTmp = ServerController.GetDomain(domain.DomainName);
if (!((domainTmp != null) && (domainTmp.WebSiteId == siteItemId)))
{
int domainID = ServerController.AddDomain(domain, domain.IsInstantAlias, false);
domainTmp = ServerController.GetDomain(domainID);
if (domainTmp != null)
{
domainTmp.WebSiteId = siteItemId;
domainTmp.ZoneItemId = domain.ZoneItemId;
domainTmp.DomainItemId = domainId;
ServerController.UpdateDomain(domainTmp);
}
}
}
}
}
else
{
if (domain.ZoneItemId > 0)
{
DomainInfo domainTmp = ServerController.GetDomain(string.IsNullOrEmpty(hostName) ? domain.DomainName : hostName + "." + domain.DomainName, true, true);
if (domainTmp != null)
{
domainTmp.ZoneItemId = domain.ZoneItemId;
ServerController.UpdateDomain(domainTmp);
}
}
}
return 0;
}
@ -999,10 +1386,10 @@ namespace WebsitePanel.EnterpriseServer
public static int DeleteWebSitePointer(int siteItemId, int domainId)
{
return DeleteWebSitePointer(siteItemId, domainId, true, true);
return DeleteWebSitePointer(siteItemId, domainId, true, true, true);
}
public static int DeleteWebSitePointer(int siteItemId, int domainId, bool updateWebSite, bool ignoreGlobalDNSRecords)
public static int DeleteWebSitePointer(int siteItemId, int domainId, bool updateWebSite, bool ignoreGlobalDNSRecords, bool deleteDomainsRecord)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
@ -1042,6 +1429,13 @@ namespace WebsitePanel.EnterpriseServer
string serviceIp = (ip != null) ? ip.ExternalIP : null;
if (string.IsNullOrEmpty(serviceIp))
{
StringDictionary settings = ServerController.GetServiceSettings(siteItem.ServiceId);
if (settings["PublicSharedIP"] != null)
serviceIp = settings["PublicSharedIP"].ToString();
}
if (ignoreGlobalDNSRecords)
{
foreach (GlobalDnsRecord r in dnsRecords)
@ -1078,8 +1472,7 @@ namespace WebsitePanel.EnterpriseServer
bool dedicatedIp = bindings.Exists(binding => { return String.IsNullOrEmpty(binding.Host) && binding.IP != "*"; });
// update binding only for "shared" ip addresses
if (!dedicatedIp)
{
// remove host headers
List<ServerBinding> domainBindings = new List<ServerBinding>();
FillWebServerBindings(domainBindings, dnsRecords, "", domain.DomainName, "", ignoreGlobalDNSRecords);
@ -1094,14 +1487,23 @@ namespace WebsitePanel.EnterpriseServer
// update bindings
if (updateWebSite)
web.UpdateSiteBindings(siteItem.SiteId, bindings.ToArray());
}
web.UpdateSiteBindings(siteItem.SiteId, bindings.ToArray(), true);
// update domain
if (deleteDomainsRecord)
{
if ((domain.WebSiteId > 0) && (!domain.IsDomainPointer))
{
domain.WebSiteId = 0;
ServerController.UpdateDomain(domain);
}
else
{
domain.WebSiteId = 0;
ServerController.UpdateDomain(domain);
ServerController.DeleteDomain(domain.DomainId);
}
}
return 0;
}
catch (Exception ex)
@ -2152,7 +2554,7 @@ namespace WebsitePanel.EnterpriseServer
WebServer server = GetWebServer(item.ServiceId);
StringDictionary webSettings = ServerController.GetServiceSettings(item.ServiceId);
if (webSettings["WmSvc.NETBIOS"] != null)
if (!String.IsNullOrEmpty(webSettings["WmSvc.NETBIOS"]))
{
accountName = webSettings["WmSvc.NETBIOS"].ToString() + "\\" + accountName;
}
@ -2920,7 +3322,7 @@ namespace WebsitePanel.EnterpriseServer
WebServer server = GetWebServer(item.ServiceId);
StringDictionary webSettings = ServerController.GetServiceSettings(item.ServiceId);
if (webSettings["WmSvc.NETBIOS"] != null)
if (!String.IsNullOrEmpty(webSettings["WmSvc.NETBIOS"]))
{
accountName = webSettings["WmSvc.NETBIOS"].ToString() + "\\" + accountName;
}
@ -3363,6 +3765,99 @@ Please ensure the space has been allocated {0} IP address as a dedicated one and
}
}
public static int ImporHostHeader(int userId, int packageId, int siteId)
{
WebSite siteItem = (WebSite)PackageController.GetPackageItem(siteId);
if (siteItem == null)
return -1;
// load live site from service
WebServer web = new WebServer();
ServiceProviderProxy.Init(web, siteItem.ServiceId);
// Verify if already exists
List<DomainInfo> domains = ServerController.GetDomains(packageId);
// Get hostheader
foreach (ServerBinding b in web.GetSiteBindings(siteItem.SiteId))
{
if ((!DoesHeaderExistInDomains(b.Host.ToLower(), domains)) && (!string.IsNullOrEmpty(b.Host)))
{
// If not get domain info and add to domains
int domainId = FindDomainForHeader(b.Host.ToLower(), domains);
if (domainId > 0)
{
DomainInfo domain = ServerController.GetDomain(domainId);
DomainInfo newDomain = new DomainInfo();
newDomain.DomainName = b.Host.ToLower();
newDomain.PackageId = domain.PackageId;
newDomain.IsDomainPointer = true;
int newDomainID = ServerController.AddDomain(newDomain, domain.IsInstantAlias, false);
if (newDomainID > 0)
{
newDomain = ServerController.GetDomain(newDomainID);
if (newDomain != null)
{
newDomain.WebSiteId = siteId;
newDomain.ZoneItemId = domain.ZoneItemId;
newDomain.DomainItemId = domain.DomainId;
ServerController.UpdateDomain(newDomain);
}
}
}
}
}
return 0;
}
private static bool DoesHeaderExistInDomains(string header, List<DomainInfo> domains)
{
bool bExist = false;
if (!string.IsNullOrEmpty(header))
{
foreach (DomainInfo d in domains)
{
if ((header == d.DomainName.ToLower()) &&
(d.IsDomainPointer))
{
bExist = true;
break;
}
}
}
return bExist;
}
private static int FindDomainForHeader(string header, List<DomainInfo> domains)
{
int domainId = 0;
int counter = 0;
while ((header.IndexOf(".") != -1) & (counter < 2))
{
foreach (DomainInfo d in domains)
{
if ((header == d.DomainName.ToLower()) && (!d.IsDomainPointer))
{
return d.DomainId;
}
}
header = header.Substring(header.IndexOf(".") + 1);
counter++;
}
return domainId;
}
#endregion
#region IBackupController Members
@ -3525,6 +4020,10 @@ Please ensure the space has been allocated {0} IP address as a dedicated one and
long ticks = DateTime.UtcNow.Ticks - DateTime.Parse("01/01/1970 00:00:00").Ticks;
ticks /= 10000000; // Convert windows ticks to seconds
//clean up bindings
certificate.FriendlyName = String.Format("{0}_{1}", certificate.Hostname, ticks.ToString());
certificate = server.generateCSR(certificate);
certificate.id = DataProvider.AddSSLRequest(SecurityContext.User.UserId, item.PackageId,
@ -3561,12 +4060,19 @@ Please ensure the space has been allocated {0} IP address as a dedicated one and
WebServer server = GetWebServer(item.ServiceId);
TaskManager.WriteParameter("item.ServiceId", item.ServiceId);
IPAddressInfo ip = ServerController.GetIPAddress(item.SiteIPAddressId);
if (ip != null)
item.SiteIPAddress = !String.IsNullOrEmpty(ip.InternalIP) ? ip.InternalIP : ip.ExternalIP;
certificate = server.installCertificate(certificate, item);
if (certificate.SerialNumber == null)
{
result.AddError("Error_Installing_certificate", null);
result.IsSuccess = false;
}
DataProvider.CompleteSSLRequest(SecurityContext.User.UserId, item.PackageId,
certificate.id, certificate.Certificate,
certificate.DistinguishedName, certificate.SerialNumber,
@ -3604,6 +4110,11 @@ Please ensure the space has been allocated {0} IP address as a dedicated one and
WebServer server = GetWebServer(item.ServiceId);
TaskManager.WriteParameter("item.ServiceId", item.ServiceId);
// remove all web site pointers
List<DomainInfo> pointers = GetWebSitePointers(siteItemId);
foreach (DomainInfo pointer in pointers)
DeleteWebSitePointer(siteItemId, pointer.DomainId, true, true, true);
SSLCertificate certificate = server.installPFX(pfx, password, item);
if (certificate.SerialNumber == null)
{

View file

@ -49,9 +49,9 @@ namespace WebsitePanel.EnterpriseServer
litUrl.Text = url.Substring(0, url.LastIndexOf("/"));
// set version
object[] attrs = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), true);
object[] attrs = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true);
if (attrs.Length > 0)
litVersion.Text = ((AssemblyInformationalVersionAttribute)attrs[0]).InformationalVersion;
litVersion.Text = ((AssemblyFileVersionAttribute)attrs[0]).Version;
imgLogo.ImageUrl = Page.ClientScript.GetWebResourceUrl(
typeof(DefaultPage), "WebsitePanel.EnterpriseServer.Images.logo.png");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Before After
Before After

View file

@ -5,7 +5,7 @@
</configSections>
<!-- Connection strings -->
<connectionStrings>
<add name="EnterpriseServer" connectionString="Server=(local)\SQLExpress;Database=WebsitePanel;uid=WebsitePanel;pwd=Password12" providerName="System.Data.SqlClient" />
<add name="EnterpriseServer" connectionString="Server=(local)\SQLExpress;Database=WebsitePanel;uid=sa;pwd=Password12" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<!-- Encryption util settings -->

View file

@ -19,6 +19,7 @@
</UpgradeBackupLocation>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile />
<UseIISExpress>false</UseIISExpress>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -410,6 +411,9 @@
<Content Include="esWebApplicationGallery.asmx" />
<EmbeddedResource Include="Images\logo.png" />
<Content Include="SystemEventHandlers.config" />
<Content Include="Web6.config">
<SubType>Designer</SubType>
</Content>
<None Include="TaskEventHandlers.config" />
<None Include="WsePolicyCache.Config" />
</ItemGroup>
@ -430,7 +434,7 @@
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<UseIIS>False</UseIIS>
<AutoAssignPort>False</AutoAssignPort>
<DevelopmentServerPort>9002</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>

View file

@ -59,7 +59,7 @@ namespace WebsitePanel.EnterpriseServer
[WebMethod]
public LyncUsersPagedResult GetLyncUsersPaged(int itemId, string sortColumn, string sortDirection, int startRow, int maximumRows)
{
return LyncController.GetLyncUsers(itemId, sortColumn, sortDirection, startRow, maximumRows);
return LyncController.GetLyncUsersPaged(itemId, sortColumn, sortDirection, startRow, maximumRows);
}
[WebMethod]
@ -119,6 +119,13 @@ namespace WebsitePanel.EnterpriseServer
return LyncController.GetLyncUserGeneralSettings(itemId, accountId);
}
[WebMethod]
public LyncUserResult SetLyncUserGeneralSettings(int itemId, int accountId, string sipAddress, string lineUri)
{
return LyncController.SetLyncUserGeneralSettings(itemId, accountId, sipAddress, lineUri);
}
[WebMethod]
public LyncUserResult SetUserLyncPlan(int itemId, int accountId, int lyncUserPlanId)
{

View file

@ -46,9 +46,9 @@ namespace WebsitePanel.EnterpriseServer
#region Organizations
[WebMethod]
public int CreateOrganization(int packageId, string organizationID, string organizationName)
public int CreateOrganization(int packageId, string organizationID, string organizationName, string domainName)
{
return OrganizationController.CreateOrganization(packageId, organizationID, organizationName);
return OrganizationController.CreateOrganization(packageId, organizationID, organizationName, domainName);
}
@ -122,6 +122,12 @@ namespace WebsitePanel.EnterpriseServer
return OrganizationController.AddOrganizationDomain(itemId, domainName);
}
[WebMethod]
public int ChangeOrganizationDomainType(int itemId, int domainId, ExchangeAcceptedDomainType newDomainType)
{
return OrganizationController.ChangeOrganizationDomainType(itemId, domainId, newDomainType);
}
[WebMethod]
public List<OrganizationDomainName> GetOrganizationDomains(int itemId)
{
@ -189,6 +195,22 @@ namespace WebsitePanel.EnterpriseServer
}
[WebMethod]
public int SetUserPrincipalName(int itemId, int accountId, string userPrincipalName, bool inherit)
{
return OrganizationController.SetUserPrincipalName(itemId, accountId, userPrincipalName,
inherit);
}
[WebMethod]
public int SetUserPassword(int itemId, int accountId, string password)
{
return OrganizationController.SetUserPassword(itemId, accountId, password);
}
[WebMethod]
public List<OrganizationUser> SearchAccounts(int itemId,
string filterColumn, string filterValue, string sortColumn, bool includeMailboxes)

View file

@ -518,6 +518,12 @@ namespace WebsitePanel.EnterpriseServer
return ServerController.GetDomains(packageId);
}
[WebMethod]
public List<DomainInfo> GetDomainsByDomainId(int domainId)
{
return ServerController.GetDomainsByDomainItemId(domainId);
}
[WebMethod]
public List<DomainInfo> GetMyDomains(int packageId)
{

View file

@ -105,7 +105,8 @@ namespace WebsitePanel.Providers.HostedSolution
{
foreach (DirectoryEntry child in entry.Children)
{
entry.Children.Remove(child);
//entry.Children.Remove(child);
child.DeleteTree();
}
entry.CommitChanges();
}
@ -113,7 +114,8 @@ namespace WebsitePanel.Providers.HostedSolution
DirectoryEntry parent = entry.Parent;
if (parent != null)
{
parent.Children.Remove(entry);
//parent.Children.Remove(entry);
entry.DeleteTree();
parent.CommitChanges();
}
}
@ -159,6 +161,14 @@ namespace WebsitePanel.Providers.HostedSolution
collection.Value = value;
}
public static void SetADObjectPropertyValue(DirectoryEntry oDE, string name, string[] values)
{
PropertyValueCollection collection = oDE.Properties[name];
collection.Value = values;
}
public static void SetADObjectPropertyValue(DirectoryEntry oDE, string name, Guid value)
{
PropertyValueCollection collection = oDE.Properties[name];
@ -177,6 +187,19 @@ namespace WebsitePanel.Providers.HostedSolution
return entry.Properties.Contains(name) ? entry.Properties[name][0] : null;
}
public static string[] GetADObjectPropertyMultiValue(DirectoryEntry entry, string name)
{
if (!entry.Properties.Contains(name))
return null;
List<string> returnList = new List<string>();
for (int i = 0; i < entry.Properties[name].Count; i++)
returnList.Add(entry.Properties[name][i].ToString());
return returnList.ToArray();
}
public static string GetADObjectStringProperty(DirectoryEntry entry, string name)
{
object ret = GetADObjectProperty(entry, name);

View file

@ -34,6 +34,6 @@
public SharePointStatisticsReport SharePointReport { get; set; }
public CRMStatisticsReport CRMReport { get; set; }
public OrganizationStatisticsReport OrganizationReport { get; set; }
public LyncStatisticsReport LyncReport { get; set; }
}
}

View file

@ -0,0 +1,37 @@
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace WebsitePanel.Providers.HostedSolution
{
public enum ExchangeAcceptedDomainType
{
Authoritative = 0,
InternalRelay = 1,
ExternalRelay = 2
}
}

View file

@ -49,6 +49,7 @@ namespace WebsitePanel.Providers.HostedSolution
int mailboxPlanId;
string mailboxPlan;
string publicFolderPermission;
string userPrincipalName;
public int AccountId
{
@ -142,5 +143,11 @@ namespace WebsitePanel.Providers.HostedSolution
}
public string UserPrincipalName
{
get { return this.userPrincipalName; }
set { this.userPrincipalName = value; }
}
}
}

View file

@ -58,5 +58,7 @@ namespace WebsitePanel.Providers.HostedSolution
get { return primary; }
set { primary = value; }
}
}
}

View file

@ -50,5 +50,6 @@ namespace WebsitePanel.Providers.HostedSolution
public bool Enabled { get; set; }
public ExchangeAccountType MailboxType { get; set; }
public bool BlackberryEnabled { get; set; }
public string MailboxPlan { get; set; }
}
}

View file

@ -0,0 +1,62 @@
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.Text;
namespace WebsitePanel.Providers.HostedSolution
{
public class ExchangeOrganization
{
int itemId;
int exchangeMailboxPlanID;
int lyncUserPlanID;
public int ItemId
{
get { return this.itemId; }
set { this.itemId = value; }
}
public int ExchangeMailboxPlanID
{
get { return this.exchangeMailboxPlanID; }
set { this.exchangeMailboxPlanID = value; }
}
public int LyncUserPlanID
{
get { return this.lyncUserPlanID; }
set { this.lyncUserPlanID = value; }
}
}
}

View file

@ -67,6 +67,7 @@ namespace WebsitePanel.Providers.HostedSolution
sb.AppendFormat("{0},", ToCsvString(item.Enabled, "Enabled", "Disabled"));
sb.AppendFormat("{0},", ToCsvString(item.MailboxType));
sb.AppendFormat("{0}", ToCsvString(item.BlackberryEnabled));
sb.AppendFormat("{0}", ToCsvString(item.MailboxPlan));
mainBuilder.Append(sb.ToString());
}
return mainBuilder.ToString();
@ -74,7 +75,7 @@ namespace WebsitePanel.Providers.HostedSolution
private void AddCSVHeader(StringBuilder sb)
{
sb.Append("Top Reseller,Reseller,Customer,Customer Created,Hosting Space,Hosting Space Created,Ogranization Name,Ogranization Created,Organization ID,Mailbox Display Name,Account Created,Primary E-mail Address,MAPI,OWA,ActiveSync,POP 3,IMAP,Mailbox Size (Mb),Max Mailbox Size (Mb),Last Logon,Enabled,Mailbox Type, BlackBerry");
sb.Append("Top Reseller,Reseller,Customer,Customer Created,Hosting Space,Hosting Space Created,Ogranization Name,Organization Created,Organization ID,Mailbox Display Name,Account Created,Primary E-mail Address,MAPI,OWA,ActiveSync,POP 3,IMAP,Mailbox Size (Mb),Max Mailbox Size (Mb),Last Logon,Enabled,Mailbox Type, BlackBerry, Mailbox Plan");
}
}
}

View file

@ -53,6 +53,7 @@ namespace WebsitePanel.Providers.HostedSolution
// Domains
void AddAuthoritativeDomain(string domain);
void DeleteAuthoritativeDomain(string domain);
void ChangeAcceptedDomainType(string domain, ExchangeAcceptedDomainType domainType);
string[] GetAuthoritativeDomains();
// Mailboxes

View file

@ -39,6 +39,7 @@ namespace WebsitePanel.Providers.HostedSolution
bool CreateUser(string organizationId, string userUpn, LyncUserPlan plan);
LyncUser GetLyncUserGeneralSettings(string organizationId, string userUpn);
bool SetLyncUserGeneralSettings(string organizationId, string userUpn, LyncUser lyncUser);
bool SetLyncUserPlan(string organizationId, string userUpn, LyncUserPlan plan);
bool DeleteUser(string userUpn);

View file

@ -51,6 +51,10 @@ namespace WebsitePanel.Providers.HostedSolution
string businessPhone, string fax, string homePhone, string mobilePhone, string pager,
string webPage, string notes, string externalEmail);
void SetUserPassword(string organizationId, string accountName, string password);
void SetUserPrincipalName(string organizationId, string accountName, string userPrincipalName);
bool OrganizationExists(string organizationId);
void DeleteOrganizationDomain(string organizationDistinguishedName, string domain);

View file

@ -70,5 +70,8 @@
public const string CANNOT_REMOVE_LYNC_FEDERATIONDOMAIN = "CANNOT_REMOVE_LYNC_FEDERATIONDOMAIN";
public const string FAILED_SET_SETTINGS = "FAILED_SET_SETTINGS";
public const string ADDRESS_ALREADY_USED = "ADDRESS_ALREADY_USED";
}
}

View file

@ -0,0 +1,72 @@
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WebsitePanel.Providers.HostedSolution
{
public class LyncOrganizationStatistics
{
private int allocatedLyncUsers;
private int createdLyncUsers;
private int allocatedLyncEVUsers;
private int createdLyncEVUsers;
public int AllocatedLyncUsers
{
get { return this.allocatedLyncUsers; }
set { this.allocatedLyncUsers = value; }
}
public int CreatedLyncUsers
{
get { return this.createdLyncUsers; }
set { this.createdLyncUsers = value; }
}
public int AllocatedLyncEVUsers
{
get { return this.allocatedLyncEVUsers; }
set { this.allocatedLyncEVUsers = value; }
}
public int CreatedLyncEVUsers
{
get { return this.createdLyncEVUsers; }
set { this.createdLyncEVUsers = value; }
}
}
}

View file

@ -0,0 +1,77 @@
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System.Text;
namespace WebsitePanel.Providers.HostedSolution
{
public class LyncStatisticsReport : BaseReport<LyncUserStatistics>
{
public override string ToCSV()
{
StringBuilder mainBuilder = new StringBuilder();
StringBuilder sb = null;
AddCSVHeader(mainBuilder);
foreach (LyncUserStatistics item in Items)
{
sb = new StringBuilder();
sb.Append("\n");
sb.AppendFormat("{0},", ToCsvString(item.TopResellerName));
sb.AppendFormat("{0},", ToCsvString(item.ResellerName));
sb.AppendFormat("{0},", ToCsvString(item.CustomerName));
sb.AppendFormat("{0},", ToCsvString(item.CustomerCreated));
sb.AppendFormat("{0},", ToCsvString(item.HostingSpace));
sb.AppendFormat("{0},", ToCsvString(item.HostingSpaceCreated));
sb.AppendFormat("{0},", ToCsvString(item.OrganizationName));
sb.AppendFormat("{0},", ToCsvString(item.OrganizationCreated));
sb.AppendFormat("{0},", ToCsvString(item.OrganizationID));
sb.AppendFormat("{0},", ToCsvString(item.DisplayName));
sb.AppendFormat("{0},", ToCsvString(item.SipAddress));
sb.AppendFormat("{0},", ToCsvString(item.PhoneNumber));
sb.AppendFormat("{0},", ToCsvString(item.Conferencing));
sb.AppendFormat("{0},", ToCsvString(item.EnterpriseVoice));
sb.AppendFormat("{0},", ToCsvString(item.Federation));
sb.AppendFormat("{0},", ToCsvString(item.InstantMessaing));
sb.AppendFormat("{0},", ToCsvString(item.MobileAccess));
sb.AppendFormat("{0},", ToCsvString(item.LyncUserPlan));
mainBuilder.Append(sb.ToString());
}
return mainBuilder.ToString();
}
private static void AddCSVHeader(StringBuilder sb)
{
sb.Append("Top Reseller,Reseller,Customer,Customer Created,Hosting Space,Hosting Space Created,Ogranization Name,Organization Created,Organization ID,Display Name,SipAddress,PhoneNumber,Conferencing,EnterpriseVoice,Federation,InstantMessaging,MobileAccess");
}
}
}

View file

@ -34,8 +34,8 @@ namespace WebsitePanel.Providers.HostedSolution
{
public class LyncUser
{
public string PrimaryUri { get; set; }
public string PrimaryEmailAddress { get; set; }
public string SipAddress { get; set; }
public string UserPrincipalName { get; set; }
public string DisplayName { get; set; }
public string LineUri { get; set; }
public int AccountID { get; set; }

View file

@ -0,0 +1,49 @@
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.Text;
namespace WebsitePanel.Providers.HostedSolution
{
public class LyncUserStatistics : BaseStatistics
{
public string DisplayName { get; set; }
public DateTime AccountCreated { get; set; }
public string SipAddress { get; set; }
public bool InstantMessaing{ get; set; }
public bool MobileAccess { get; set; }
public bool Federation { get; set; }
public bool Conferencing { get; set; }
public bool EnterpriseVoice { get; set; }
public string EVPolicy { get; set; }
public string PhoneNumber { get; set; }
public string LyncUserPlan { get; set; }
}
}

View file

@ -26,6 +26,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
namespace WebsitePanel.Providers.HostedSolution
{
public class OrganizationDomainName
@ -33,6 +34,7 @@ namespace WebsitePanel.Providers.HostedSolution
int organizationDomainId;
int itemId;
int domainId;
int domainTypeId;
string domainName;
bool isHost;
bool isDefault;
@ -55,6 +57,21 @@ namespace WebsitePanel.Providers.HostedSolution
set { domainId = value; }
}
public int DomainTypeId
{
get { return domainTypeId; }
set { domainTypeId = value; }
}
public ExchangeAcceptedDomainType DomainType
{
get
{
ExchangeAcceptedDomainType type = (ExchangeAcceptedDomainType)domainTypeId;
return type;
}
}
public int OrganizationDomainId
{
get { return organizationDomainId; }

View file

@ -56,7 +56,9 @@ namespace WebsitePanel.Providers.HostedSolution
sb.AppendFormat("{0},", ToCsvString(item.TotalPublicFoldersSize / 1024.0 / 1024.0));
sb.AppendFormat("{0},", ToCsvString(item.TotalSharePointSiteCollections));
sb.AppendFormat("{0},", ToCsvString(item.TotalSharePointSiteCollectionsSize / 1024.0 / 1024.0));
sb.AppendFormat("{0}", ToCsvString(item.TotalCRMUsers));
sb.AppendFormat("{0},", ToCsvString(item.TotalCRMUsers));
sb.AppendFormat("{0},", ToCsvString(item.TotalLyncUsers));
sb.AppendFormat("{0}", ToCsvString(item.TotalLyncEVUsers));
mainBuilder.Append(sb.ToString());
}
@ -65,7 +67,7 @@ namespace WebsitePanel.Providers.HostedSolution
private static void AddCSVHeader(StringBuilder sb)
{
sb.Append("Top Reseller,Reseller,Customer,Customer Created,Hosting Space,Hosting Space Created,Ogranization Name,Ogranization Created,Organization ID,Total mailboxes,Total mailboxes size(Mb),Total Public Folders size(Mb),Total SharePoint site collections,Total SharePoint site collections size(Mb),Total CRM users");
sb.Append("Top Reseller,Reseller,Customer,Customer Created,Hosting Space,Hosting Space Created,Ogranization Name,Ogranization Created,Organization ID,Total mailboxes,Total mailboxes size(Mb),Total Public Folders size(Mb),Total SharePoint site collections,Total SharePoint site collections size(Mb),Total CRM users,Total Lync users,Total Lync EV users");
}
}
}

View file

@ -66,5 +66,18 @@
set;
}
public int TotalLyncUsers
{
get;
set;
}
public int TotalLyncEVUsers
{
get;
set;
}
}
}

View file

@ -64,6 +64,7 @@ namespace WebsitePanel.Providers.HostedSolution
private string country;
private string notes;
private string domainUserName;
private string userPrincipalName;
private bool disabled;
private bool locked;
@ -305,6 +306,11 @@ namespace WebsitePanel.Providers.HostedSolution
set { subscriberNumber = value; }
}
public string UserPrincipalName
{
get { return userPrincipalName; }
set { userPrincipalName = value; }
}
}

View file

@ -51,7 +51,7 @@ namespace WebsitePanel.Providers.Web
ServerBinding[] GetSiteBindings(string siteId);
string CreateSite(WebSite site);
void UpdateSite(WebSite site);
void UpdateSiteBindings(string siteId, ServerBinding[] bindings);
void UpdateSiteBindings(string siteId, ServerBinding[] bindings, bool emptyBindingsAllowed);
void DeleteSite(string siteId);
// virtual directories

View file

@ -47,6 +47,7 @@ namespace WebsitePanel.Providers.Web
private string siteId;
private string siteIPAddress;
private int siteIPAddressId;
private bool isDedicatedIP;
private string dataPath;
private ServerBinding[] bindings;
private bool frontPageAvailable;
@ -85,6 +86,12 @@ namespace WebsitePanel.Providers.Web
set { siteIPAddressId = value; }
}
public bool IsDedicatedIP
{
get { return isDedicatedIP; }
set { isDedicatedIP = value; }
}
/// <summary>
/// Gets or sets logs path for the web site
/// </summary>

View file

@ -238,6 +238,7 @@ namespace WebsitePanel.Providers.WebAppGallery
NotDownloaded,
Downloaded,
Downloading,
UnauthorizedAccessException,
Failed
}

View file

@ -80,12 +80,17 @@
<Compile Include="HostedSolution\BlackBerryErrorsCodes.cs" />
<Compile Include="HostedSolution\BlackBerryStatsItem.cs" />
<Compile Include="HostedSolution\BlackBerryUserDeleteState.cs" />
<Compile Include="HostedSolution\ExchangeOrganization.cs" />
<Compile Include="HostedSolution\ExchangeAcceptedDomainType.cs" />
<Compile Include="HostedSolution\ExchangeMailboxPlanType.cs" />
<Compile Include="HostedSolution\ExchangeMailboxPlan.cs" />
<Compile Include="HostedSolution\ILyncServer.cs" />
<Compile Include="HostedSolution\LyncConstants.cs" />
<Compile Include="HostedSolution\LyncErrorCodes.cs" />
<Compile Include="HostedSolution\LyncFederationDomain.cs" />
<Compile Include="HostedSolution\LyncOrganizationStatistics.cs" />
<Compile Include="HostedSolution\LyncUserStatistics.cs" />
<Compile Include="HostedSolution\LyncStatisticsReport.cs" />
<Compile Include="HostedSolution\LyncUser.cs" />
<Compile Include="HostedSolution\LyncUserPlan.cs" />
<Compile Include="HostedSolution\LyncUserPlanType.cs" />

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012, Outercurve Foundation.
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
@ -99,6 +99,8 @@ namespace WebsitePanel.Providers.DNS
{ DnsRecordType.MX, new BuildDnsRecordDataEventHandler(BuildRecordData_MXRecord) },
// TXT
{ DnsRecordType.TXT, new BuildDnsRecordDataEventHandler(BuildRecordData_TXTRecord) },
// SRV
{ DnsRecordType.SRV, new BuildDnsRecordDataEventHandler(BuildRecordData_SRVRecord) },
};
#endregion
@ -151,7 +153,8 @@ namespace WebsitePanel.Providers.DNS
};
break;
case "AAAA":
dnsRecord = new DnsRecord {
dnsRecord = new DnsRecord
{
RecordName = recordName,
RecordType = DnsRecordType.AAAA,
RecordData = record.DataFields[0]
@ -190,6 +193,17 @@ namespace WebsitePanel.Providers.DNS
RecordData = record.DataFields[0]
};
break;
case "SRV":
dnsRecord = new DnsRecord
{
RecordName = recordName,
RecordType = DnsRecordType.SRV,
RecordData = record.DataFields[3],
SrvPriority = Convert.ToInt32(record.DataFields[0]),
SrvWeight = Convert.ToInt32(record.DataFields[1]),
SrvPort = Convert.ToInt32(record.DataFields[2])
};
break;
}
//
return dnsRecord;
@ -663,6 +677,15 @@ namespace WebsitePanel.Providers.DNS
data.Add(record.RecordData);
}
static void BuildRecordData_SRVRecord(string zoneName, ref string type, DnsRecord record, List<string> data)
{
type = "SRV";
data.Add(Convert.ToString(record.SrvPriority));
data.Add(Convert.ToString(record.SrvWeight));
data.Add(Convert.ToString(record.SrvPort));
data.Add(record.RecordData);
}
#endregion
new static string BuildRecordData(string zoneName, string host, string recordData)

View file

@ -1,4 +1,32 @@
using Microsoft.Win32;
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;

View file

@ -1,4 +1,32 @@
using System.Reflection;
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

View file

@ -230,6 +230,11 @@ namespace WebsitePanel.Providers.HostedSolution
{
DeleteAuthoritativeDomainInternal(domain);
}
public void ChangeAcceptedDomainType(string domainName, ExchangeAcceptedDomainType domainType)
{
ChangeAcceptedDomainTypeInternal(domainName, domainType);
}
#endregion
#region Mailboxes
@ -1374,11 +1379,15 @@ namespace WebsitePanel.Providers.HostedSolution
long size = 0;
Command cmd = new Command("Get-PublicFolderStatistics");
Command cmd = new Command("Get-PublicFolderDatabase");
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd);
if (result != null && result.Count > 0)
{
cmd = new Command("Get-PublicFolderStatistics");
cmd.Parameters.Add("Identity", folder);
if (!string.IsNullOrEmpty(PublicFolderServer))
cmd.Parameters.Add("Server", PublicFolderServer);
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd);
result = ExecuteShellCommand(runSpace, cmd);
if (result != null && result.Count > 0)
{
PSObject obj = result[0];
@ -1398,6 +1407,9 @@ namespace WebsitePanel.Providers.HostedSolution
string id = ObjToString(GetPSObjectProperty(obj, "Identity"));
size += CalculatePublicFolderDiskSpace(runSpace, id);
}
}
else
size = 0;
ExchangeLog.LogEnd("CalculatePublicFolderDiskSpace");
return size;
}
@ -2579,8 +2591,8 @@ namespace WebsitePanel.Providers.HostedSolution
Command cmd = new Command("Set-Mailbox");
cmd.Parameters.Add("Identity", accountName);
cmd.Parameters.Add("PrimarySmtpAddress", primaryEmail);
cmd.Parameters.Add("UserPrincipalName", primaryEmail);
cmd.Parameters.Add("WindowsEmailAddress", primaryEmail);
//cmd.Parameters.Add("UserPrincipalName", primaryEmail);
//cmd.Parameters.Add("WindowsEmailAddress", primaryEmail);
ExecuteShellCommand(runSpace, cmd);
}
@ -5954,6 +5966,31 @@ namespace WebsitePanel.Providers.HostedSolution
ExchangeLog.LogEnd("CreateAuthoritativeDomainInternal");
}
private void ChangeAcceptedDomainTypeInternal(string domainName, ExchangeAcceptedDomainType domainType)
{
ExchangeLog.LogStart("ChangeAcceptedDomainType");
Runspace runSpace = null;
try
{
runSpace = OpenRunspace();
SetAcceptedDomainType(runSpace, domainName,domainType);
}
catch (Exception ex)
{
ExchangeLog.LogError("ChangeAcceptedDomainType", ex);
throw;
}
finally
{
CloseRunspace(runSpace);
}
ExchangeLog.LogEnd("ChangeAcceptedDomainType");
}
private void DeleteAcceptedDomain(string domainName)
{
ExchangeLog.LogStart("DeleteAcceptedDomain");
@ -6018,6 +6055,17 @@ namespace WebsitePanel.Providers.HostedSolution
ExchangeLog.LogEnd("RemoveAcceptedDomain");
}
private void SetAcceptedDomainType(Runspace runSpace, string id, ExchangeAcceptedDomainType domainType)
{
ExchangeLog.LogStart("SetAcceptedDomainType");
Command cmd = new Command("Set-AcceptedDomain");
cmd.Parameters.Add("Identity", id);
cmd.Parameters.Add("DomainType", domainType.ToString());
cmd.Parameters.Add("Confirm", false);
ExecuteShellCommand(runSpace, cmd);
ExchangeLog.LogEnd("SetAcceptedDomainType");
}
#endregion
#region ActiveSync

View file

@ -607,15 +607,42 @@ namespace WebsitePanel.Providers.HostedSolution
ExchangeLog.LogStart("GetDatabase");
ExchangeLog.LogInfo("DAG: " + dagName);
//Get Dag Servers
// this part of code handles mailboxnames like in the old 2007 provider
// check if DAG is in reality DAG\mailboxdatabase
string dagNameDAG = string.Empty;
string dagNameMBX = string.Empty;
bool isFixedDatabase = false;
if (dagName.Contains("\\"))
{
// split the two parts and extract DAG-Name and mailboxdatabase-name
string[] parts = dagName.Split(new char[] { '\\' }, 2, StringSplitOptions.None);
dagNameDAG = parts[0];
dagNameMBX = parts[1];
// check that we realy have a database name
if (!String.IsNullOrEmpty(dagNameMBX))
{
isFixedDatabase = true;
}
}
else
{
// there is no mailboxdatabase-name use the loadbalancing-code
dagNameDAG = dagName;
isFixedDatabase = false;
}
//Get Dag Servers - with the name of the database availability group
Collection<PSObject> dags = null;
Command cmd = new Command("Get-DatabaseAvailabilityGroup");
cmd.Parameters.Add("Identity", dagName);
cmd.Parameters.Add("Identity", dagNameDAG);
dags = ExecuteShellCommand(runSpace, cmd);
if (htBbalancer == null)
htBbalancer = new Hashtable();
// use fully qualified dagName for loadbalancer. Thus if there are two services and one of them
// contains only the DAG, the "fixed" database could also be used in loadbalancing. If you do not want this,
// set either IsExcludedFromProvisioning or IsSuspendedFromProvisioning - it is not evaluated for fixed databases
if (htBbalancer[dagName] == null)
htBbalancer.Add(dagName, 0);
@ -628,6 +655,8 @@ namespace WebsitePanel.Providers.HostedSolution
{
System.Collections.Generic.List<string> lstDatabase = new System.Collections.Generic.List<string>();
if (!isFixedDatabase) // "old" loadbalancing code
{
foreach (object objServer in servers)
{
Collection<PSObject> databases = null;
@ -660,6 +689,25 @@ namespace WebsitePanel.Providers.HostedSolution
}
}
}
}
else // new fixed database code
{
Collection<PSObject> databases = null;
cmd = new Command("Get-MailboxDatabase");
cmd.Parameters.Add("Identity", dagNameMBX);
databases = ExecuteShellCommand(runSpace, cmd);
// do not check "IsExcludedFromProvisioning" or "IsSuspended", just check if it is a member of the DAG
foreach (PSObject objDatabase in databases)
{
string dagSetting = ObjToString(GetPSObjectProperty(objDatabase, "MasterServerOrAvailabilityGroup"));
if (dagNameDAG.Equals(dagSetting, StringComparison.OrdinalIgnoreCase))
{
lstDatabase.Add(dagNameMBX);
ExchangeLog.LogInfo("AddFixedDatabase: " + dagNameMBX);
}
}
}
int balancer = (int)htBbalancer[dagName];
balancer++;

View file

@ -127,6 +127,12 @@ namespace WebsitePanel.Providers.HostedSolution
return GetLyncUserGeneralSettingsInternal(organizationId, userUpn);
}
public bool SetLyncUserGeneralSettings(string organizationId, string userUpn, LyncUser lyncUser)
{
return SetLyncUserGeneralSettingsInternal(organizationId, userUpn, lyncUser);
}
public bool SetLyncUserPlan(string organizationId, string userUpn, LyncUserPlan plan)
{
return SetLyncUserPlanInternal(organizationId, userUpn, plan, null);
@ -162,6 +168,7 @@ namespace WebsitePanel.Providers.HostedSolution
#region organization
private string CreateOrganizationInternal(string organizationId, string sipDomain, bool enableConferencing, bool enableConferencingVideo, int maxConferenceSize, bool enabledFederation, bool enabledEnterpriseVoice)
{
sipDomain = sipDomain.ToLower();
HostedSolutionLog.LogStart("CreateOrganizationInternal");
HostedSolutionLog.DebugInfo("organizationId: {0}", organizationId);
HostedSolutionLog.DebugInfo("sipDomain: {0}", sipDomain);
@ -199,7 +206,8 @@ namespace WebsitePanel.Providers.HostedSolution
//create conferencing policy
cmd = new Command("New-CsConferencingPolicy");
cmd.Parameters.Add("Identity", organizationId);
cmd.Parameters.Add("MaxMeetingSize", maxConferenceSize);
cmd.Parameters.Add("MaxMeetingSize", ((maxConferenceSize == -1) | (maxConferenceSize > 250)) ? 250 : maxConferenceSize);
cmd.Parameters.Add("AllowIPVideo", enableConferencingVideo);
ExecuteShellCommand(runSpace, cmd, false);
transaction.RegisterNewConferencingPolicy(organizationId);
@ -286,11 +294,14 @@ namespace WebsitePanel.Providers.HostedSolution
Guid tenantId = (Guid)GetPSObjectProperty(result[0], "TenantId");
// create sip domain
DeleteSipDomain(runSpace, sipDomain);
//clear the msRTCSIP-Domains, TenantID, ObjectID
string path = AddADPrefix(GetOrganizationPath(organizationId));
DirectoryEntry ou = ActiveDirectoryUtils.GetADObject(path);
string[] sipDs = (string[])ActiveDirectoryUtils.GetADObjectPropertyMultiValue(ou, "msRTCSIP-Domains");
foreach (string sipD in sipDs)
DeleteSipDomain(runSpace, sipD);
//clear the msRTCSIP-Domains, TenantID, ObjectID
ActiveDirectoryUtils.ClearADObjectPropertyValue(ou, "msRTCSIP-Domains");
ActiveDirectoryUtils.ClearADObjectPropertyValue(ou, "msRTCSIP-TenantId");
ActiveDirectoryUtils.ClearADObjectPropertyValue(ou, "msRTCSIP-ObjectId");
@ -381,6 +392,51 @@ namespace WebsitePanel.Providers.HostedSolution
{
tenantId = (Guid)GetPSObjectProperty(result[0], "TenantId");
string[] tmp = userUpn.Split('@');
if (tmp.Length < 2) return false;
// Get SipDomains and verify existence
bool bSipDomainExists = false;
cmd = new Command("Get-CsSipDomain");
Collection<PSObject> sipDomains = ExecuteShellCommand(runSpace, cmd, false);
foreach (PSObject domain in sipDomains)
{
string d = (string)GetPSObjectProperty(domain, "Name");
if (d.ToLower() == tmp[1].ToLower())
{
bSipDomainExists = true;
break;
}
}
string path = string.Empty;
if (!bSipDomainExists)
{
// Create Sip Domain
cmd = new Command("New-CsSipDomain");
cmd.Parameters.Add("Identity", tmp[1].ToLower());
ExecuteShellCommand(runSpace, cmd, false);
transaction.RegisterNewSipDomain(tmp[1].ToLower());
path = AddADPrefix(GetOrganizationPath(organizationId));
DirectoryEntry ou = ActiveDirectoryUtils.GetADObject(path);
string[] sipDs = (string[])ActiveDirectoryUtils.GetADObjectPropertyMultiValue(ou, "msRTCSIP-Domains");
List<string> listSipDs = new List<string>();
listSipDs.AddRange(sipDs);
listSipDs.Add(tmp[1]);
ActiveDirectoryUtils.SetADObjectPropertyValue(ou, "msRTCSIP-Domains", listSipDs.ToArray());
ou.CommitChanges();
//Create simpleurls
CreateSimpleUrl(runSpace, tmp[1].ToLower(), tenantId);
transaction.RegisterNewSimpleUrl(tmp[1].ToLower(), tenantId.ToString());
}
//enable for lync
cmd = new Command("Enable-CsUser");
cmd.Parameters.Add("Identity", userUpn);
@ -395,17 +451,15 @@ namespace WebsitePanel.Providers.HostedSolution
cmd.Parameters.Add("Identity", userUpn);
result = ExecuteShellCommand(runSpace, cmd);
string path = AddADPrefix(GetResultObjectDN(result));
path = AddADPrefix(GetResultObjectDN(result));
DirectoryEntry user = ActiveDirectoryUtils.GetADObject(path);
ActiveDirectoryUtils.SetADObjectPropertyValue(user, "msRTCSIP-GroupingID", tenantId);
ActiveDirectoryUtils.SetADObjectPropertyValue(user, "msRTCSIP-TenantId", tenantId);
string[] tmp = userUpn.Split('@');
if (tmp.Length > 0)
{
string Url = SimpleUrlRoot + tmp[1];
ActiveDirectoryUtils.SetADObjectPropertyValue(user, "msRTCSIP-BaseSimpleUrl", Url);
ActiveDirectoryUtils.SetADObjectPropertyValue(user, "msRTCSIP-BaseSimpleUrl", Url.ToLower());
}
user.CommitChanges();
@ -460,8 +514,10 @@ namespace WebsitePanel.Providers.HostedSolution
PSObject user = result[0];
lyncUser.DisplayName = (string)GetPSObjectProperty(user, "DisplayName");
lyncUser.PrimaryUri = (string)GetPSObjectProperty(user, "SipAddress");
lyncUser.SipAddress = (string)GetPSObjectProperty(user, "SipAddress");
lyncUser.LineUri = (string)GetPSObjectProperty(user, "LineURI");
lyncUser.SipAddress = lyncUser.SipAddress.ToLower().Replace("sip:", "");
}
catch (Exception ex)
{
@ -476,6 +532,114 @@ namespace WebsitePanel.Providers.HostedSolution
return lyncUser;
}
private bool SetLyncUserGeneralSettingsInternal(string organizationId, string userUpn, LyncUser lyncUser)
{
HostedSolutionLog.LogStart("SetLyncUserGeneralSettingsInternal");
HostedSolutionLog.DebugInfo("organizationId: {0}", organizationId);
HostedSolutionLog.DebugInfo("userUpn: {0}", userUpn);
bool ret = true;
Runspace runSpace = null;
Guid tenantId = Guid.Empty;
LyncTransaction transaction = StartTransaction();
try
{
runSpace = OpenRunspace();
Command cmd = new Command("Get-CsTenant");
cmd.Parameters.Add("Identity", GetOrganizationPath(organizationId));
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd, false);
if ((result != null) && (result.Count > 0))
{
tenantId = (Guid)GetPSObjectProperty(result[0], "TenantId");
string[] tmp = userUpn.Split('@');
if (tmp.Length < 2) return false;
// Get SipDomains and verify existence
bool bSipDomainExists = false;
cmd = new Command("Get-CsSipDomain");
Collection<PSObject> sipDomains = ExecuteShellCommand(runSpace, cmd, false);
foreach (PSObject domain in sipDomains)
{
string d = (string)GetPSObjectProperty(domain, "Name");
if (d.ToLower() == tmp[1].ToLower())
{
bSipDomainExists = true;
break;
}
}
string path = string.Empty;
if (!bSipDomainExists)
{
// Create Sip Domain
cmd = new Command("New-CsSipDomain");
cmd.Parameters.Add("Identity", tmp[1].ToLower());
ExecuteShellCommand(runSpace, cmd, false);
transaction.RegisterNewSipDomain(tmp[1].ToLower());
path = AddADPrefix(GetOrganizationPath(organizationId));
DirectoryEntry ou = ActiveDirectoryUtils.GetADObject(path);
string[] sipDs = (string[])ActiveDirectoryUtils.GetADObjectPropertyMultiValue(ou, "msRTCSIP-Domains");
List<string> listSipDs = new List<string>();
listSipDs.AddRange(sipDs);
listSipDs.Add(tmp[1]);
ActiveDirectoryUtils.SetADObjectPropertyValue(ou, "msRTCSIP-Domains", listSipDs.ToArray());
ou.CommitChanges();
//Create simpleurls
CreateSimpleUrl(runSpace, tmp[1].ToLower(), tenantId);
transaction.RegisterNewSimpleUrl(tmp[1].ToLower(), tenantId.ToString());
path = AddADPrefix(GetResultObjectDN(result));
DirectoryEntry user = ActiveDirectoryUtils.GetADObject(path);
if (tmp.Length > 0)
{
string Url = SimpleUrlRoot + tmp[1];
ActiveDirectoryUtils.SetADObjectPropertyValue(user, "msRTCSIP-BaseSimpleUrl", Url.ToLower());
}
user.CommitChanges();
}
}
cmd = new Command("Set-CsUser");
cmd.Parameters.Add("Identity", userUpn);
if (!string.IsNullOrEmpty(lyncUser.SipAddress)) cmd.Parameters.Add("SipAddress", "SIP:"+lyncUser.SipAddress);
if (!string.IsNullOrEmpty(lyncUser.SipAddress)) cmd.Parameters.Add("LineUri", lyncUser.LineUri);
ExecuteShellCommand(runSpace, cmd, false);
//initiate addressbook generation
cmd = new Command("Update-CsAddressBook");
ExecuteShellCommand(runSpace, cmd, false);
//initiate user database replication
cmd = new Command("Update-CsUserDatabase");
ExecuteShellCommand(runSpace, cmd, false);
}
catch (Exception ex)
{
ret = false;
HostedSolutionLog.LogError("SetLyncUserGeneralSettingsInternal", ex);
RollbackTransaction(transaction);
}
finally
{
CloseRunspace(runSpace);
}
HostedSolutionLog.LogEnd("SetLyncUserGeneralSettingsInternal");
return ret;
}
private bool SetLyncUserPlanInternal(string organizationId, string userUpn, LyncUserPlan plan, Runspace runSpace)
{
@ -641,9 +805,6 @@ namespace WebsitePanel.Providers.HostedSolution
SimpleUrls.Add(simpleUrl[0]);
}
Hashtable properties = new Hashtable();
properties.Add("Add", SimpleUrls);
//PSListModifier
cmd = new Command("Set-CsSimpleUrlConfiguration");
cmd.Parameters.Add("Identity", "Global");
@ -838,6 +999,9 @@ namespace WebsitePanel.Providers.HostedSolution
HostedSolutionLog.DebugInfo("organizationId: {0}", organizationId);
HostedSolutionLog.DebugInfo("domainName: {0}", domainName);
domainName = domainName.ToLower();
proxyFqdn = proxyFqdn.ToLower();
Runspace runSpace = null;
try
{
@ -925,8 +1089,18 @@ namespace WebsitePanel.Providers.HostedSolution
if (GetPSObjectProperty(result[0], "AllowedDomains").GetType().ToString() == "Microsoft.Rtc.Management.WritableConfig.Settings.Edge.AllowList")
{
HostedSolutionLog.DebugInfo("Remove DomainName: {0}", domainName);
allowList = (AllowList)GetPSObjectProperty(result[0], "AllowedDomains");
DomainPattern domain = new DomainPattern(domainName);
DomainPattern domain = null;
foreach (DomainPattern d in allowList.AllowedDomain)
{
if (d.Domain.ToLower() == domainName.ToLower())
{
domain = d;
break;
}
}
if (domain != null)
allowList.AllowedDomain.Remove(domain);
}

View file

@ -214,7 +214,7 @@ namespace WebsitePanel.Providers.HostedSolution
org.DistinguishedName = ActiveDirectoryUtils.RemoveADPrefix(orgPath);
org.SecurityGroup = ActiveDirectoryUtils.RemoveADPrefix(GetGroupPath(organizationId));
}
catch(Exception ex)
catch (Exception ex)
{
HostedSolutionLog.LogError(ex);
try
@ -225,7 +225,7 @@ namespace WebsitePanel.Providers.HostedSolution
ActiveDirectoryUtils.DeleteADObject(groupPath);
}
}
catch(Exception e)
catch (Exception e)
{
HostedSolutionLog.LogError(e);
}
@ -238,7 +238,7 @@ namespace WebsitePanel.Providers.HostedSolution
ActiveDirectoryUtils.DeleteADObject(orgPath);
}
}
catch(Exception e)
catch (Exception e)
{
HostedSolutionLog.LogError(e);
}
@ -371,7 +371,7 @@ namespace WebsitePanel.Providers.HostedSolution
userPath = GetUserPath(organizationId, loginName);
if (!ActiveDirectoryUtils.AdObjectExists(userPath))
{
userPath = ActiveDirectoryUtils.CreateUser(path, upn, loginName, displayName, password, enabled);
userPath = ActiveDirectoryUtils.CreateUser(path, null, loginName, displayName, password, enabled);
DirectoryEntry entry = new DirectoryEntry(userPath);
ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.UserPrincipalName, upn);
entry.CommitChanges();
@ -421,7 +421,7 @@ namespace WebsitePanel.Providers.HostedSolution
{
HostedSolutionLog.LogStart("GetPasswordPolicyInternal");
PasswordPolicyResult res = new PasswordPolicyResult {IsSuccess = true};
PasswordPolicyResult res = new PasswordPolicyResult { IsSuccess = true };
string[] policyAttributes = new[] {"minPwdLength",
"pwdProperties",
@ -442,12 +442,12 @@ namespace WebsitePanel.Providers.HostedSolution
PasswordPolicy ret = new PasswordPolicy
{
MinLength = ((int) result.Properties["minPwdLength"][0]),
IsComplexityEnable = ((int) result.Properties["pwdProperties"][0] == 1)
MinLength = ((int)result.Properties["minPwdLength"][0]),
IsComplexityEnable = ((int)result.Properties["pwdProperties"][0] == 1)
};
res.Value = ret;
}
catch(Exception ex)
catch (Exception ex)
{
HostedSolutionLog.LogError(ex);
res.IsSuccess = false;
@ -478,7 +478,7 @@ namespace WebsitePanel.Providers.HostedSolution
string path = GetUserPath(organizationId, loginName);
if (ActiveDirectoryUtils.AdObjectExists(path))
ActiveDirectoryUtils.DeleteADObject(path,true);
ActiveDirectoryUtils.DeleteADObject(path, true);
HostedSolutionLog.LogEnd("DeleteUserInternal");
}
@ -529,6 +529,7 @@ namespace WebsitePanel.Providers.HostedSolution
retUser.DomainUserName = GetDomainName(ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.SAMAccountName));
retUser.DistinguishedName = ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.DistinguishedName);
retUser.Locked = (bool)entry.InvokeGet(ADAttributes.AccountLocked);
retUser.UserPrincipalName= (string)entry.InvokeGet(ADAttributes.UserPrincipalName);
HostedSolutionLog.LogEnd("GetUserGeneralSettingsInternal");
return retUser;
@ -635,6 +636,37 @@ namespace WebsitePanel.Providers.HostedSolution
entry.CommitChanges();
}
public void SetUserPassword(string organizationId, string accountName, string password)
{
SetUserPasswordInternal(organizationId, accountName, password);
}
internal void SetUserPasswordInternal(string organizationId, string accountName, string password)
{
string path = GetUserPath(organizationId, accountName);
DirectoryEntry entry = ActiveDirectoryUtils.GetADObject(path);
if (!string.IsNullOrEmpty(password))
entry.Invoke(ADAttributes.SetPassword, password);
entry.CommitChanges();
}
public void SetUserPrincipalName(string organizationId, string accountName, string userPrincipalName)
{
SetUserPrincipalNameInternal(organizationId, accountName, userPrincipalName);
}
internal void SetUserPrincipalNameInternal(string organizationId, string accountName, string userPrincipalName)
{
string path = GetUserPath(organizationId, accountName);
DirectoryEntry entry = ActiveDirectoryUtils.GetADObject(path);
ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.UserPrincipalName, userPrincipalName);
entry.CommitChanges();
}
public string GetSamAccountNameByUserPrincipalName(string organizationId, string userPrincipalName)
{

View file

@ -2107,7 +2107,7 @@ namespace WebsitePanel.Providers.Mail
if (!String.IsNullOrEmpty(productVersion))
{
string[] split = productVersion.Split(new char[] { '.' });
return split[0].Equals("7");
return split[0].Equals("7")||split[0].Equals("8");
}
}
@ -2140,7 +2140,7 @@ namespace WebsitePanel.Providers.Mail
if (!String.IsNullOrEmpty(productVersion))
{
string[] split = productVersion.Split(new[] { '.' });
return split[0].Equals("7");
return split[0].Equals("7")||split[0].Equals("8");
}
return false;

View file

@ -1237,7 +1237,7 @@ namespace WebsitePanel.Providers.Web
// Create site
webObjectsSvc.CreateSite(site);
// Update web site bindings
webObjectsSvc.UpdateSiteBindings(site.SiteId, site.Bindings);
webObjectsSvc.UpdateSiteBindings(site.SiteId, site.Bindings, false);
// Set web site logging settings
webObjectsSvc.SetWebSiteLoggingSettings(site);
}
@ -1322,7 +1322,7 @@ namespace WebsitePanel.Providers.Web
// Update website
webObjectsSvc.UpdateSite(site);
// Update website bindings
webObjectsSvc.UpdateSiteBindings(site.SiteId, site.Bindings);
webObjectsSvc.UpdateSiteBindings(site.SiteId, site.Bindings, false);
// Set website logging settings
webObjectsSvc.SetWebSiteLoggingSettings(site);
//
@ -1440,9 +1440,9 @@ namespace WebsitePanel.Providers.Web
/// </summary>
/// <param name="siteId">Site's id to update bindings for.</param>
/// <param name="bindings">Bindings information.</param>
public override void UpdateSiteBindings(string siteId, ServerBinding[] bindings)
public override void UpdateSiteBindings(string siteId, ServerBinding[] bindings, bool emptyBindingsAllowed)
{
this.webObjectsSvc.UpdateSiteBindings(siteId, bindings);
this.webObjectsSvc.UpdateSiteBindings(siteId, bindings, emptyBindingsAllowed);
}
/// <summary>
@ -4046,7 +4046,12 @@ namespace WebsitePanel.Providers.Web
{
using (var srvman = new ServerManager())
{
return srvman.ApplicationPools["WebsitePanel Server"].ProcessModel.LoadUserProfile;
string poolName = Environment.GetEnvironmentVariable("APP_POOL_ID", EnvironmentVariableTarget.Process);
ApplicationPool pool = srvman.ApplicationPools[poolName];
if (pool == null)
throw new Exception("ApplicationPool pool is null" + poolName);
return pool.ProcessModel.LoadUserProfile;
}
}
@ -4055,7 +4060,12 @@ namespace WebsitePanel.Providers.Web
{
using (var srvman = new ServerManager())
{
srvman.ApplicationPools["WebsitePanel Server"].ProcessModel.LoadUserProfile = true;
string poolName = Environment.GetEnvironmentVariable("APP_POOL_ID", EnvironmentVariableTarget.Process);
ApplicationPool pool = srvman.ApplicationPools[poolName];
if (pool == null)
throw new Exception("ApplicationPool pool is null" + poolName);
pool.ProcessModel.LoadUserProfile = true;
// save changes
srvman.CommitChanges();
}

View file

@ -1,4 +1,32 @@
using System.Reflection;
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

View file

@ -422,11 +422,14 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
return bindings.ToArray();
}
private void SyncWebSiteBindingsChanges(string siteId, ServerBinding[] bindings)
private void SyncWebSiteBindingsChanges(string siteId, ServerBinding[] bindings, bool emptyBindingsAllowed)
{
// ensure site bindings
if (!emptyBindingsAllowed)
{
if (bindings == null || bindings.Length == 0)
throw new Exception("SiteServerBindingsEmpty");
}
using (var srvman = GetServerManager())
{
@ -438,7 +441,8 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
int i = 0;
while (i < iisObject.Bindings.Count)
{
if (String.Equals(iisObject.Bindings[i].Protocol, Uri.UriSchemeHttp, StringComparison.InvariantCultureIgnoreCase))
if ((String.Equals(iisObject.Bindings[i].Protocol, Uri.UriSchemeHttp, StringComparison.InvariantCultureIgnoreCase)) |
(bindings.Length == 0))
{
iisObject.Bindings.RemoveAt(i);
continue;
@ -461,7 +465,7 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
}
}
public void UpdateSiteBindings(string siteId, ServerBinding[] bindings)
public void UpdateSiteBindings(string siteId, ServerBinding[] bindings, bool emptyBindingsAllowed)
{
using (ServerManager srvman = GetServerManager())
{
@ -470,7 +474,7 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
return;
}
//
SyncWebSiteBindingsChanges(siteId, bindings);
SyncWebSiteBindingsChanges(siteId, bindings, emptyBindingsAllowed);
}
public string GetPhysicalPath(ServerManager srvman, WebVirtualDirectory virtualDir)

View file

@ -847,7 +847,7 @@ namespace WebsitePanel.Providers.Web
}
}
public virtual void UpdateSiteBindings(string siteId, ServerBinding[] bindings)
public virtual void UpdateSiteBindings(string siteId, ServerBinding[] bindings, bool emptyBindingsAllowed)
{
ManagementObject objSite = wmi.GetObject(String.Format("IIsWebServerSetting='{0}'", siteId));
@ -3396,7 +3396,8 @@ namespace WebsitePanel.Providers.Web
virtual public bool CheckLoadUserProfile()
{
throw new NotImplementedException("LoadUserProfile option valid only on IIS7 or higer");
//throw new NotImplementedException("LoadUserProfile option valid only on IIS7 or higer");
return false;
}
virtual public void EnableLoadUserProfile()
@ -3421,20 +3422,28 @@ namespace WebsitePanel.Providers.Web
public bool IsMsDeployInstalled()
{
// project has reference to Microsoft.Web.Deployment, so
return true;
/*
// TO-DO: Implement Web Deploy detection (x64/x86)
var isInstalled = false;
//
try
{
Assembly.Load(MS_DEPLOY_ASSEMBLY_NAME);
return true;
}
catch
var msdeployRegKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\IIS Extensions\MSDeploy\3");
//
var keyValue = msdeployRegKey.GetValue("Install");
// We have found the required key in the registry hive
if (keyValue != null && keyValue.Equals(1))
{
// type could not be instantiated
return false;
isInstalled = true;
}
*/
}
catch (Exception ex)
{
Log.WriteError("Could not retrieve Web Deploy key from the registry", ex);
}
//
return isInstalled;
}
public GalleryLanguagesResult GetGalleryLanguages(int UserId)
@ -3551,6 +3560,11 @@ namespace WebsitePanel.Providers.Web
return module.DownloadAppAndGetStatus(UserId, id);
}
catch (UnauthorizedAccessException ex)
{
Log.WriteError(ex);
return GalleryWebAppStatus.UnauthorizedAccessException;
}
catch (Exception ex)
{
Log.WriteError(ex);

View file

@ -1,4 +1,32 @@
using Microsoft.Win32;
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;

View file

@ -1,4 +1,32 @@
using System.Reflection;
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

View file

@ -1033,6 +1033,16 @@ namespace WebsitePanel.Providers.Exchange
domain});
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/ChangeAcceptedDomainType", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void ChangeAcceptedDomainType(string domain, ExchangeAcceptedDomainType domainType)
{
this.Invoke("ChangeAcceptedDomainType", new object[] {
domain,
domainType});
}
/// <remarks/>
public System.IAsyncResult BeginAddAuthoritativeDomain(string domain, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("AddAuthoritativeDomain", new object[] {

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