This commit is contained in:
dev_amdtel 2014-10-25 03:24:56 +04:00
commit 2c7d74505a
54 changed files with 1283 additions and 303 deletions

View file

@ -514,6 +514,10 @@ namespace WebsitePanel.Setup.Actions
{ {
serviceInfo.ProviderId = 209; serviceInfo.ProviderId = 209;
} }
else if (sqlVersion.StartsWith("12."))
{
serviceInfo.ProviderId = 1203;
}
serviceId = ES.Services.Servers.AddService(serviceInfo); serviceId = ES.Services.Servers.AddService(serviceInfo);
} }
else else

View file

@ -124,11 +124,11 @@ namespace WebsitePanel.Setup
{ {
// check SQL server version // check SQL server version
string sqlVersion = GetSqlServerVersion(connectionString); string sqlVersion = GetSqlServerVersion(connectionString);
if (!sqlVersion.StartsWith("9.") && !sqlVersion.StartsWith("10.") && !sqlVersion.StartsWith("11.")) if (!sqlVersion.StartsWith("9.") && !sqlVersion.StartsWith("10.") && !sqlVersion.StartsWith("11.") && !sqlVersion.StartsWith("12."))
{ {
// SQL Server 2005 engine required // SQL Server 2005 engine required
e.Cancel = true; e.Cancel = true;
ShowWarning("This program can be installed on SQL Server 2005/2008/2012 only."); ShowWarning("This program can be installed on SQL Server 2005/2008/2012/2014 only.");
return; return;
} }
int securityMode = GetSqlServerSecurityMode(connectionString); int securityMode = GetSqlServerSecurityMode(connectionString);

View file

@ -954,6 +954,10 @@ namespace WebsitePanel.Setup
{ {
serviceInfo.ProviderId = 209; serviceInfo.ProviderId = 209;
} }
else if (sqlVersion.StartsWith("12."))
{
serviceInfo.ProviderId = 1203;
}
serviceId = ES.Services.Servers.AddService(serviceInfo); serviceId = ES.Services.Servers.AddService(serviceInfo);
} }
else else

View file

@ -4623,7 +4623,7 @@ BEGIN
@QuotaOrderInGroup + 1, @QuotaOrderInGroup + 1,
@CurQuotaName, @CurQuotaName,
@CurQuotaDescription, @CurQuotaDescription,
3, 2,
0, 0,
NULL) NULL)
END END
@ -5205,4 +5205,173 @@ FROM SupportServiceLevels AS SL
INNER JOIN ExchangeAccounts AS EA ON SL.LevelID = EA.LevelID INNER JOIN ExchangeAccounts AS EA ON SL.LevelID = EA.LevelID
WHERE EA.LevelID = @LevelID WHERE EA.LevelID = @LevelID
RETURN RETURN
GO
-- Service Level Quotas, change type
UPDATE Quotas
SET QuotaTypeID = 2
WHERE QuotaName like 'ServiceLevel.%'
GO
ALTER FUNCTION [dbo].[CalculateQuotaUsage]
(
@PackageID int,
@QuotaID int
)
RETURNS int
AS
BEGIN
DECLARE @QuotaTypeID int
DECLARE @QuotaName nvarchar(50)
SELECT @QuotaTypeID = QuotaTypeID, @QuotaName = QuotaName FROM Quotas
WHERE QuotaID = @QuotaID
IF @QuotaTypeID <> 2
RETURN 0
DECLARE @Result int
IF @QuotaID = 52 -- diskspace
SET @Result = dbo.CalculatePackageDiskspace(@PackageID)
ELSE IF @QuotaID = 51 -- bandwidth
SET @Result = dbo.CalculatePackageBandwidth(@PackageID)
ELSE IF @QuotaID = 53 -- domains
SET @Result = (SELECT COUNT(D.DomainID) FROM PackagesTreeCache AS PT
INNER JOIN Domains AS D ON D.PackageID = PT.PackageID
WHERE IsSubDomain = 0 AND IsInstantAlias = 0 AND IsDomainPointer = 0 AND PT.ParentPackageID = @PackageID)
ELSE IF @QuotaID = 54 -- sub-domains
SET @Result = (SELECT COUNT(D.DomainID) FROM PackagesTreeCache AS PT
INNER JOIN Domains AS D ON D.PackageID = PT.PackageID
WHERE IsSubDomain = 1 AND IsInstantAlias = 0 AND IsDomainPointer = 0 AND PT.ParentPackageID = @PackageID)
ELSE IF @QuotaID = 220 -- domain pointers
SET @Result = (SELECT COUNT(D.DomainID) FROM PackagesTreeCache AS PT
INNER JOIN Domains AS D ON D.PackageID = PT.PackageID
WHERE IsDomainPointer = 1 AND PT.ParentPackageID = @PackageID)
ELSE IF @QuotaID = 71 -- scheduled tasks
SET @Result = (SELECT COUNT(S.ScheduleID) FROM PackagesTreeCache AS PT
INNER JOIN Schedule AS S ON S.PackageID = PT.PackageID
WHERE PT.ParentPackageID = @PackageID)
ELSE IF @QuotaID = 305 -- RAM of VPS
SET @Result = (SELECT SUM(CAST(SIP.PropertyValue AS int)) FROM ServiceItemProperties AS SIP
INNER JOIN ServiceItems AS SI ON SIP.ItemID = SI.ItemID
INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID
WHERE SIP.PropertyName = 'RamSize' AND PT.ParentPackageID = @PackageID)
ELSE IF @QuotaID = 306 -- HDD of VPS
SET @Result = (SELECT SUM(CAST(SIP.PropertyValue AS int)) FROM ServiceItemProperties AS SIP
INNER JOIN ServiceItems AS SI ON SIP.ItemID = SI.ItemID
INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID
WHERE SIP.PropertyName = 'HddSize' AND PT.ParentPackageID = @PackageID)
ELSE IF @QuotaID = 309 -- External IP addresses of VPS
SET @Result = (SELECT COUNT(PIP.PackageAddressID) FROM PackageIPAddresses AS PIP
INNER JOIN IPAddresses AS IP ON PIP.AddressID = IP.AddressID
INNER JOIN PackagesTreeCache AS PT ON PIP.PackageID = PT.PackageID
WHERE PT.ParentPackageID = @PackageID AND IP.PoolID = 3)
ELSE IF @QuotaID = 100 -- Dedicated Web IP addresses
SET @Result = (SELECT COUNT(PIP.PackageAddressID) FROM PackageIPAddresses AS PIP
INNER JOIN IPAddresses AS IP ON PIP.AddressID = IP.AddressID
INNER JOIN PackagesTreeCache AS PT ON PIP.PackageID = PT.PackageID
WHERE PT.ParentPackageID = @PackageID AND IP.PoolID = 2)
ELSE IF @QuotaID = 350 -- RAM of VPSforPc
SET @Result = (SELECT SUM(CAST(SIP.PropertyValue AS int)) FROM ServiceItemProperties AS SIP
INNER JOIN ServiceItems AS SI ON SIP.ItemID = SI.ItemID
INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID
WHERE SIP.PropertyName = 'Memory' AND PT.ParentPackageID = @PackageID)
ELSE IF @QuotaID = 351 -- HDD of VPSforPc
SET @Result = (SELECT SUM(CAST(SIP.PropertyValue AS int)) FROM ServiceItemProperties AS SIP
INNER JOIN ServiceItems AS SI ON SIP.ItemID = SI.ItemID
INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID
WHERE SIP.PropertyName = 'HddSize' AND PT.ParentPackageID = @PackageID)
ELSE IF @QuotaID = 354 -- External IP addresses of VPSforPc
SET @Result = (SELECT COUNT(PIP.PackageAddressID) FROM PackageIPAddresses AS PIP
INNER JOIN IPAddresses AS IP ON PIP.AddressID = IP.AddressID
INNER JOIN PackagesTreeCache AS PT ON PIP.PackageID = PT.PackageID
WHERE PT.ParentPackageID = @PackageID AND IP.PoolID = 3)
ELSE IF @QuotaID = 319 -- BB Users
SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts ea
INNER JOIN BlackBerryUsers bu ON ea.AccountID = bu.AccountID
INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
WHERE pt.ParentPackageID = @PackageID)
ELSE IF @QuotaID = 320 -- OCS Users
SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts ea
INNER JOIN OCSUsers ocs ON ea.AccountID = ocs.AccountID
INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
WHERE pt.ParentPackageID = @PackageID)
ELSE IF @QuotaID = 206 -- HostedSolution.Users
SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts AS ea
INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
WHERE pt.ParentPackageID = @PackageID AND ea.AccountType IN (1,5,6,7))
ELSE IF @QuotaID = 78 -- Exchange2007.Mailboxes
SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts AS ea
INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
WHERE pt.ParentPackageID = @PackageID
AND ea.AccountType IN (1)
AND ea.MailboxPlanId IS NOT NULL)
ELSE IF @QuotaID = 77 -- Exchange2007.DiskSpace
SET @Result = (SELECT SUM(B.MailboxSizeMB) FROM ExchangeAccounts AS ea
INNER JOIN ExchangeMailboxPlans AS B ON ea.MailboxPlanId = B.MailboxPlanId
INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
WHERE pt.ParentPackageID = @PackageID)
ELSE IF @QuotaID = 370 -- Lync.Users
SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts AS ea
INNER JOIN LyncUsers lu ON ea.AccountID = lu.AccountID
INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
WHERE pt.ParentPackageID = @PackageID)
ELSE IF @QuotaID = 376 -- Lync.EVUsers
SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts AS ea
INNER JOIN LyncUsers lu ON ea.AccountID = lu.AccountID
INNER JOIN LyncUserPlans lp ON lu.LyncUserPlanId = lp.LyncUserPlanId
INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
WHERE pt.ParentPackageID = @PackageID AND lp.EnterpriseVoice = 1)
ELSE IF @QuotaID = 381 -- Dedicated Lync Phone Numbers
SET @Result = (SELECT COUNT(PIP.PackageAddressID) FROM PackageIPAddresses AS PIP
INNER JOIN IPAddresses AS IP ON PIP.AddressID = IP.AddressID
INNER JOIN PackagesTreeCache AS PT ON PIP.PackageID = PT.PackageID
WHERE PT.ParentPackageID = @PackageID AND IP.PoolID = 5)
ELSE IF @QuotaID = 430 -- Enterprise Storage
SET @Result = (SELECT SUM(ESF.FolderQuota) FROM EnterpriseFolders AS ESF
INNER JOIN ServiceItems SI ON ESF.ItemID = SI.ItemID
INNER JOIN PackagesTreeCache PT ON SI.PackageID = PT.PackageID
WHERE PT.ParentPackageID = @PackageID)
ELSE IF @QuotaID = 431 -- Enterprise Storage Folders
SET @Result = (SELECT COUNT(ESF.EnterpriseFolderID) FROM EnterpriseFolders AS ESF
INNER JOIN ServiceItems SI ON ESF.ItemID = SI.ItemID
INNER JOIN PackagesTreeCache PT ON SI.PackageID = PT.PackageID
WHERE PT.ParentPackageID = @PackageID)
ELSE IF @QuotaID = 423 -- HostedSolution.SecurityGroups
SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts AS ea
INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
WHERE pt.ParentPackageID = @PackageID AND ea.AccountType IN (8,9))
ELSE IF @QuotaName like 'ServiceLevel.%' -- Support Service Level Quota
BEGIN
DECLARE @LevelID int
SELECT @LevelID = LevelID FROM SupportServiceLevels
WHERE LevelName = REPLACE(@QuotaName,'ServiceLevel.','')
IF (@LevelID IS NOT NULL)
SET @Result = (SELECT COUNT(EA.AccountID)
FROM SupportServiceLevels AS SL
INNER JOIN ExchangeAccounts AS EA ON SL.LevelID = EA.LevelID
INNER JOIN ServiceItems SI ON EA.ItemID = SI.ItemID
INNER JOIN PackagesTreeCache PT ON SI.PackageID = PT.PackageID
WHERE EA.LevelID = @LevelID AND PT.ParentPackageID = @PackageID)
ELSE SET @Result = 0
END
ELSE
SET @Result = (SELECT COUNT(SI.ItemID) FROM Quotas AS Q
INNER JOIN ServiceItems AS SI ON SI.ItemTypeID = Q.ItemTypeID
INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID AND PT.ParentPackageID = @PackageID
WHERE Q.QuotaID = @QuotaID)
RETURN @Result
END
GO GO

View file

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

View file

@ -121,6 +121,7 @@
<Compile Include="HostedSolution\CRMLycenseTypes.cs" /> <Compile Include="HostedSolution\CRMLycenseTypes.cs" />
<Compile Include="HostedSolution\ESPermission.cs" /> <Compile Include="HostedSolution\ESPermission.cs" />
<Compile Include="Log\LogRecord.cs" /> <Compile Include="Log\LogRecord.cs" />
<Compile Include="Packages\ServiceLevelQuotaValueInfo.cs" />
<Compile Include="Packages\HostingPlanContext.cs" /> <Compile Include="Packages\HostingPlanContext.cs" />
<Compile Include="Packages\HostingPlanGroupInfo.cs" /> <Compile Include="Packages\HostingPlanGroupInfo.cs" />
<Compile Include="Packages\HostingPlanInfo.cs" /> <Compile Include="Packages\HostingPlanInfo.cs" />

View file

@ -365,6 +365,7 @@ namespace WebsitePanel.EnterpriseServer
quota.QuotaId = (int)dr["QuotaId"]; quota.QuotaId = (int)dr["QuotaId"];
quota.GroupId = (int)dr["GroupId"]; quota.GroupId = (int)dr["GroupId"];
quota.QuotaName = (string)dr["QuotaName"]; quota.QuotaName = (string)dr["QuotaName"];
quota.QuotaDescription = ((object)dr["QuotaDescription"]).GetType() == typeof(System.DBNull) ? string.Empty : (string)dr["QuotaDescription"];
quota.QuotaTypeId = (int)dr["QuotaTypeId"]; quota.QuotaTypeId = (int)dr["QuotaTypeId"];
quota.QuotaAllocatedValue = (int)dr["QuotaValue"]; quota.QuotaAllocatedValue = (int)dr["QuotaValue"];
quota.QuotaUsedValue = (int)dr["QuotaUsedValue"]; quota.QuotaUsedValue = (int)dr["QuotaUsedValue"];

View file

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

View file

@ -81,6 +81,7 @@ namespace WebsitePanel.Providers.Web
private bool sharePointInstalled; private bool sharePointInstalled;
private bool iis7; private bool iis7;
private string consoleUrl; private string consoleUrl;
private string php5VersionsInstalled;
public string AnonymousUsername public string AnonymousUsername
{ {
@ -285,7 +286,13 @@ namespace WebsitePanel.Providers.Web
set { consoleUrl = value; } set { consoleUrl = value; }
} }
#region Web Deploy Publishing Properties public string Php5VersionsInstalled
{
get { return php5VersionsInstalled; }
set { php5VersionsInstalled = value; }
}
#region Web Deploy Publishing Properties
/// <summary> /// <summary>
/// Gets or sets Web Deploy publishing account name /// Gets or sets Web Deploy publishing account name
/// </summary> /// </summary>

View file

@ -329,6 +329,7 @@
<Compile Include="WebAppGallery\GalleryApplication.cs" /> <Compile Include="WebAppGallery\GalleryApplication.cs" />
<Compile Include="WebAppGallery\GalleryCategory.cs" /> <Compile Include="WebAppGallery\GalleryCategory.cs" />
<Compile Include="WebAppGallery\GalleryErrors.cs" /> <Compile Include="WebAppGallery\GalleryErrors.cs" />
<Compile Include="Web\PhpVersion.cs" />
<Compile Include="Web\HtaccessFolder.cs" /> <Compile Include="Web\HtaccessFolder.cs" />
<Compile Include="Web\HttpError.cs" /> <Compile Include="Web\HttpError.cs" />
<Compile Include="Web\HttpHeader.cs" /> <Compile Include="Web\HttpHeader.cs" />

View file

@ -30,6 +30,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.DirectoryServices.ActiveDirectory; using System.DirectoryServices.ActiveDirectory;
using System.IO; using System.IO;
using System.Linq;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using WebsitePanel.Providers.FTP.IIs70; using WebsitePanel.Providers.FTP.IIs70;
@ -99,6 +100,20 @@ namespace WebsitePanel.Providers.FTP
{ {
get { return ProviderSettings["ADGroupsOU"]; } get { return ProviderSettings["ADGroupsOU"]; }
} }
protected string AdFtpRoot
{
get { return ProviderSettings["AdFtpRoot"]; }
}
protected Mode UserIsolationMode
{
get
{
var site = GetSite(ProviderSettings["SiteId"]);
return (Mode)Enum.Parse(typeof(Mode), site["UserIsolationMode"]);
}
}
#endregion #endregion
#region IFtpServer Members #region IFtpServer Members
@ -291,134 +306,275 @@ namespace WebsitePanel.Providers.FTP
this.ftpSitesService.DeleteSite(siteId); this.ftpSitesService.DeleteSite(siteId);
} }
/// <summary> /// <summary>
/// Checks whether account with given name exists. /// Checks whether account with given name exists.
/// </summary> /// </summary>
/// <param name="accountName">Account name to check.</param> /// <param name="accountName">Account name to check.</param>
/// <returns>true - if it exists; false - otherwise.</returns> /// <returns>true - if it exists; false - otherwise.</returns>
public bool AccountExists(string accountName) public bool AccountExists(string accountName)
{ {
if (String.IsNullOrEmpty(accountName)) if (String.IsNullOrEmpty(accountName))
{ {
return false; return false;
} }
// check acocunt on FTP server switch (UserIsolationMode)
bool ftpExists = this.ftpSitesService.VirtualDirectoryExists(this.SiteId, accountName); {
case Mode.ActiveDirectory:
return SecurityUtils.UserExists(accountName, ServerSettings, UsersOU);
// check account in the system default:
bool systemExists = SecurityUtils.UserExists(accountName, ServerSettings, UsersOU); // check acocunt on FTP server
return (ftpExists || systemExists); bool ftpExists = this.ftpSitesService.VirtualDirectoryExists(this.SiteId, accountName);
// check account in the system
bool systemExists = SecurityUtils.UserExists(accountName, ServerSettings, UsersOU);
return (ftpExists || systemExists);
}
} }
/// <summary> /// <summary>
/// Gets available ftp accounts. /// Gets available ftp accounts.
/// </summary> /// </summary>
/// <returns>List of avaialble accounts.</returns> /// <returns>List of avaialble accounts.</returns>
public FtpAccount[] GetAccounts() public FtpAccount[] GetAccounts()
{ {
List<FtpAccount> accounts = new List<FtpAccount>(); switch (UserIsolationMode)
{
case Mode.ActiveDirectory:
return SecurityUtils.GetUsers(ServerSettings, UsersOU).Select(GetAccount).ToArray();
default:
List<FtpAccount> accounts = new List<FtpAccount>();
foreach (string directory in this.ftpSitesService.GetVirtualDirectoriesNames(this.SiteId)) foreach (string directory in this.ftpSitesService.GetVirtualDirectoriesNames(this.SiteId))
{ {
// Skip root virtual directory // Skip root virtual directory
if (String.Equals(directory, "/")) if (String.Equals(directory, "/"))
continue; continue;
// //
accounts.Add(this.GetAccount(directory.Substring(1))); accounts.Add(this.GetAccount(directory.Substring(1)));
} }
return accounts.ToArray(); return accounts.ToArray();
}
} }
/// <summary> /// <summary>
/// Gets account with given name. /// Gets account with given name.
/// </summary> /// </summary>
/// <param name="accountName">Account's name to get.</param> /// <param name="accountName">Account's name to get.</param>
/// <returns>Ftp account.</returns> /// <returns>Ftp account.</returns>
public FtpAccount GetAccount(string accountName) public FtpAccount GetAccount(string accountName)
{ {
FtpAccount acc = new FtpAccount(); switch (UserIsolationMode)
acc.Name = accountName; {
this.FillFtpAccountFromIis(acc); case Mode.ActiveDirectory:
return acc; var user = SecurityUtils.GetUser(accountName, ServerSettings, UsersOU);
var path = Path.Combine(user.MsIIS_FTPRoot, user.MsIIS_FTPDir);
var permission = GetUserPermission(accountName, path);
var account = new FtpAccount()
{
CanRead = permission.Read,
CanWrite = permission.Write,
CreatedDate = user.CreatedDate,
Enabled = !user.AccountDisabled,
Folder = path,
GroupName = user.GroupName,
Name = user.Name
};
return account;
default:
FtpAccount acc = new FtpAccount();
acc.Name = accountName;
this.FillFtpAccountFromIis(acc);
return acc;
}
} }
/// <summary> protected UserPermission GetUserPermission(string accountName, string folder)
{
var userPermission = new UserPermission {AccountName = accountName};
return SecurityUtils.GetGroupNtfsPermissions(folder, new[] {userPermission}, ServerSettings, UsersOU, GroupsOU)[0];
}
/// <summary>
/// Creates ftp account under root ftp site. /// Creates ftp account under root ftp site.
/// </summary> /// </summary>
/// <param name="account">Ftp account to create.</param> /// <param name="account">Ftp account to create.</param>
public void CreateAccount(FtpAccount account) public void CreateAccount(FtpAccount account)
{ {
// Create user account. switch (UserIsolationMode)
SystemUser user = new SystemUser(); {
user.Name = account.Name; case Mode.ActiveDirectory:
user.FullName = account.Name; SecurityUtils.EnsureOrganizationalUnitsExist(ServerSettings, UsersOU, GroupsOU);
user.Description = "WebsitePanel System Account";
user.MemberOf = new string[] { FtpGroupName };
user.Password = account.Password;
user.PasswordCantChange = true;
user.PasswordNeverExpires = true;
user.AccountDisabled = !account.Enabled;
user.System = true;
// Create in the operating system. var systemUser = SecurityUtils.GetUser(account.Name, ServerSettings, UsersOU);
if (SecurityUtils.UserExists(user.Name, ServerSettings, UsersOU))
{
SecurityUtils.DeleteUser(user.Name, ServerSettings, UsersOU);
}
SecurityUtils.CreateUser(user, ServerSettings, UsersOU, GroupsOU);
// Prepare account's home folder. if (systemUser == null)
this.EnsureUserHomeFolderExists(account.Folder, account.Name, account.CanRead, account.CanWrite); {
systemUser = new SystemUser
{
Name = account.Name,
FullName = account.Name,
Password = account.Password,
PasswordCantChange = true,
PasswordNeverExpires = true,
System = true
};
// Future account will be given virtual directory under default ftp web site. SecurityUtils.CreateUser(systemUser, ServerSettings, UsersOU, GroupsOU);
this.ftpSitesService.CreateFtpAccount(this.SiteId, account); }
//
this.ftpSitesService.ConfigureConnectAs(account.Folder, this.SiteId, account.VirtualPath,
this.GetQualifiedAccountName(account.Name), account.Password, true);
}
/// <summary> UpdateAccount(account);
/// Updates ftp account.
/// </summary> break;
/// <param name="account">Accoun to update.</param>
default:
// Create user account.
SystemUser user = new SystemUser();
user.Name = account.Name;
user.FullName = account.Name;
user.Description = "WebsitePanel System Account";
user.MemberOf = new string[] {FtpGroupName};
user.Password = account.Password;
user.PasswordCantChange = true;
user.PasswordNeverExpires = true;
user.AccountDisabled = !account.Enabled;
user.System = true;
// Create in the operating system.
if (SecurityUtils.UserExists(user.Name, ServerSettings, UsersOU))
{
SecurityUtils.DeleteUser(user.Name, ServerSettings, UsersOU);
}
SecurityUtils.CreateUser(user, ServerSettings, UsersOU, GroupsOU);
// Prepare account's home folder.
this.EnsureUserHomeFolderExists(account.Folder, account.Name, account.CanRead, account.CanWrite);
// Future account will be given virtual directory under default ftp web site.
this.ftpSitesService.CreateFtpAccount(this.SiteId, account);
//
this.ftpSitesService.ConfigureConnectAs(account.Folder, this.SiteId, account.VirtualPath,
this.GetQualifiedAccountName(account.Name), account.Password, true);
break;
}
}
/// <summary>
/// Updates ftp account.
/// </summary>
/// <param name="account">Accoun to update.</param>
public void UpdateAccount(FtpAccount account) public void UpdateAccount(FtpAccount account)
{ {
// Change user account state and password (if required). var user = SecurityUtils.GetUser(account.Name, ServerSettings, UsersOU);
SystemUser user = SecurityUtils.GetUser(account.Name, ServerSettings, UsersOU);
user.Password = account.Password; switch (UserIsolationMode)
user.AccountDisabled = !account.Enabled; {
SecurityUtils.UpdateUser(user, ServerSettings, UsersOU, GroupsOU); case Mode.ActiveDirectory:
// Update iis configuration. var ftpRoot = AdFtpRoot.ToLower();
this.FillIisFromFtpAccount(account); var ftpDir = account.Folder.ToLower().Replace(ftpRoot, "");
var oldDir = user.MsIIS_FTPDir;
user.Password = account.Password;
user.PasswordCantChange = true;
user.PasswordNeverExpires = true;
user.Description = "WebsitePanel FTP Account with AD User Isolation";
user.MemberOf = new[] {FtpGroupName};
user.AccountDisabled = !account.Enabled;
user.MsIIS_FTPRoot = ftpRoot;
user.MsIIS_FTPDir = ftpDir;
user.System = true;
SecurityUtils.UpdateUser(user, ServerSettings, UsersOU, GroupsOU);
// Set NTFS permissions
var userPermission = GetUserPermission(account.Name, account.Folder);
// Do we need to change the NTFS permissions? i.e. is users home dir changed or are permissions changed?
if (oldDir != ftpDir || account.CanRead != userPermission.Read || account.CanWrite != userPermission.Write)
{
// First get sid of user account
var sid = SecurityUtils.GetAccountSid(account.Name, ServerSettings, UsersOU, GroupsOU);
// Remove the permissions set for this account on previous folder
SecurityUtils.RemoveNtfsPermissionsBySid(Path.Combine(ftpRoot, oldDir), sid);
// If no permissions is to be set, exit
if (!account.CanRead && !account.CanWrite)
{
return;
}
// Add the new permissions
var ntfsPermissions = account.CanRead ? NTFSPermission.Read : NTFSPermission.Write;
if (account.CanRead && account.CanWrite)
{
ntfsPermissions = NTFSPermission.Modify;
}
SecurityUtils.GrantNtfsPermissionsBySid(account.Folder, sid, ntfsPermissions, true, true);
}
break;
default:
// Change user account state and password (if required).
user.Password = account.Password;
user.AccountDisabled = !account.Enabled;
SecurityUtils.UpdateUser(user, ServerSettings, UsersOU, GroupsOU);
// Update iis configuration.
this.FillIisFromFtpAccount(account);
break;
}
} }
/// <summary> /// <summary>
/// Deletes account with given name. /// Deletes account with given name.
/// </summary> /// </summary>
/// <param name="accountName">Account's name to be deleted.</param> /// <param name="accountName">Account's name to be deleted.</param>
public void DeleteAccount(string accountName) public void DeleteAccount(string accountName)
{ {
string virtualDirectory = String.Format("/{0}", accountName); switch (UserIsolationMode)
string currentPhysicalPath = this.ftpSitesService.GetSitePhysicalPath(this.SiteId, virtualDirectory); {
case Mode.ActiveDirectory:
var account = GetAccount(accountName);
// Delete virtual directory // Remove the NTFS permissions first
this.ftpSitesService.DeleteFtpAccount(this.SiteId, virtualDirectory); SecurityUtils.RemoveNtfsPermissions(account.Folder, account.Name, ServerSettings, UsersOU, GroupsOU);
this.ftpSitesService.CommitChanges(); if (SecurityUtils.UserExists(accountName, ServerSettings, UsersOU))
{
SecurityUtils.DeleteUser(accountName, ServerSettings, UsersOU);
}
break;
// Remove permissions default:
RemoveFtpFolderPermissions(currentPhysicalPath, accountName); string virtualDirectory = String.Format("/{0}", accountName);
string currentPhysicalPath = this.ftpSitesService.GetSitePhysicalPath(this.SiteId, virtualDirectory);
// Delete system user account // Delete virtual directory
if (SecurityUtils.UserExists(accountName, ServerSettings, UsersOU)) this.ftpSitesService.DeleteFtpAccount(this.SiteId, virtualDirectory);
{
SecurityUtils.DeleteUser(accountName, ServerSettings, UsersOU); this.ftpSitesService.CommitChanges();
}
// Remove permissions
RemoveFtpFolderPermissions(currentPhysicalPath, accountName);
// Delete system user account
if (SecurityUtils.UserExists(accountName, ServerSettings, UsersOU))
{
SecurityUtils.DeleteUser(accountName, ServerSettings, UsersOU);
}
break;
}
} }
/// <summary> /// <summary>
/// Fills iis configuration from ftp account. /// Fills iis configuration from ftp account.
/// </summary> /// </summary>
/// <param name="ftpAccount">Ftp account to fill from.</param> /// <param name="ftpAccount">Ftp account to fill from.</param>
@ -519,6 +675,7 @@ namespace WebsitePanel.Providers.FTP
ftpSite.AllowAnonymous = iisFtpSite.Security.Authentication.AnonymousAuthentication.Enabled; ftpSite.AllowAnonymous = iisFtpSite.Security.Authentication.AnonymousAuthentication.Enabled;
ftpSite.AnonymousUsername = iisFtpSite.Security.Authentication.AnonymousAuthentication.UserName; ftpSite.AnonymousUsername = iisFtpSite.Security.Authentication.AnonymousAuthentication.UserName;
ftpSite.AnonymousUserPassword = iisFtpSite.Security.Authentication.AnonymousAuthentication.Password; ftpSite.AnonymousUserPassword = iisFtpSite.Security.Authentication.AnonymousAuthentication.Password;
ftpSite["UserIsolationMode"] = iisFtpSite.UserIsolation.Mode.ToString();
// Logging settings. // Logging settings.
ftpSite[FtpSite.MSFTP7_SITE_ID] = iisFtpSite.SiteServiceId; ftpSite[FtpSite.MSFTP7_SITE_ID] = iisFtpSite.SiteServiceId;
if (iisFtpSite.LogFile.Enabled) if (iisFtpSite.LogFile.Enabled)

View file

@ -2838,7 +2838,7 @@ namespace WebsitePanel.Providers.HostedSolution
Command cmd = new Command("Set-Mailbox"); Command cmd = new Command("Set-Mailbox");
cmd.Parameters.Add("Identity", accountName); cmd.Parameters.Add("Identity", accountName);
cmd.Parameters.Add("PrimarySmtpAddress", primaryEmail); cmd.Parameters.Add("PrimarySmtpAddress", primaryEmail);
cmd.Parameters.Add("UserPrincipalName", primaryEmail); //cmd.Parameters.Add("UserPrincipalName", primaryEmail);
cmd.Parameters.Add("WindowsEmailAddress", primaryEmail); cmd.Parameters.Add("WindowsEmailAddress", primaryEmail);
ExecuteShellCommand(runSpace, cmd); ExecuteShellCommand(runSpace, cmd);

View file

@ -25,7 +25,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>..\WebsitePanel.Server\bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>

View file

@ -26,6 +26,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System.Linq;
namespace WebsitePanel.Providers.Web.Handlers namespace WebsitePanel.Providers.Web.Handlers
{ {
using System; using System;
@ -178,7 +180,7 @@ namespace WebsitePanel.Providers.Web.Handlers
} }
} }
internal void InheritScriptMapsFromParent(string fqPath) internal void InheritScriptMapsFromParent(string fqPath)
{ {
if (String.IsNullOrEmpty(fqPath)) if (String.IsNullOrEmpty(fqPath))
return; return;
@ -241,5 +243,40 @@ namespace WebsitePanel.Providers.Web.Handlers
// //
return null; return null;
} }
internal void CopyInheritedHandlers(string siteName, string vDirPath)
{
if (string.IsNullOrEmpty(siteName))
{
return;
}
if (string.IsNullOrEmpty(vDirPath))
{
vDirPath = "/";
}
using (var srvman = GetServerManager())
{
var config = srvman.GetWebConfiguration(siteName, vDirPath);
var handlersSection = (HandlersSection)config.GetSection(Constants.HandlersSection, typeof(HandlersSection));
var handlersCollection = handlersSection.Handlers;
var list = new HandlerAction[handlersCollection.Count];
((System.Collections.ICollection) handlersCollection).CopyTo(list, 0);
handlersCollection.Clear();
foreach (var handler in list)
{
handlersCollection.AddCopy(handler);
}
srvman.CommitChanges();
}
}
} }
} }

View file

@ -28,6 +28,8 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Diagnostics;
using System.Linq;
using System.Management; using System.Management;
using System.DirectoryServices; using System.DirectoryServices;
using System.DirectoryServices.ActiveDirectory; using System.DirectoryServices.ActiveDirectory;
@ -280,7 +282,7 @@ namespace WebsitePanel.Providers.Web
Name = settings[Constants.IntegratedAspNet40Pool].Trim() Name = settings[Constants.IntegratedAspNet40Pool].Trim()
}); });
} }
#endregion #endregion
#region Populate Dedicated Application Pools #region Populate Dedicated Application Pools
// ASP.NET 1.1 // ASP.NET 1.1
@ -711,9 +713,9 @@ namespace WebsitePanel.Providers.Web
if (!String.IsNullOrEmpty(AspPath) && String.Equals(AspPath, processor, StringComparison.InvariantCultureIgnoreCase)) if (!String.IsNullOrEmpty(AspPath) && String.Equals(AspPath, processor, StringComparison.InvariantCultureIgnoreCase))
virtualDir.AspInstalled = true; virtualDir.AspInstalled = true;
// Detect whether PHP 5 scripting is enabled //// Detect whether PHP 5 scripting is enabled (non fast_cgi)
if (!String.IsNullOrEmpty(PhpExecutablePath) && String.Equals(PhpExecutablePath, processor, StringComparison.InvariantCultureIgnoreCase)) if (PhpMode != Constants.PhpMode.FastCGI && !String.IsNullOrEmpty(PhpExecutablePath) && String.Equals(PhpExecutablePath, processor, StringComparison.InvariantCultureIgnoreCase))
virtualDir.PhpInstalled = PHP_5; virtualDir.PhpInstalled = PHP_5;
// Detect whether PHP 4 scripting is enabled // Detect whether PHP 4 scripting is enabled
if (!String.IsNullOrEmpty(Php4Path) && String.Equals(Php4Path, processor, StringComparison.InvariantCultureIgnoreCase)) if (!String.IsNullOrEmpty(Php4Path) && String.Equals(Php4Path, processor, StringComparison.InvariantCultureIgnoreCase))
@ -727,7 +729,18 @@ namespace WebsitePanel.Providers.Web
if (!String.IsNullOrEmpty(PerlPath) && String.Equals(PerlPath, processor, StringComparison.InvariantCultureIgnoreCase)) if (!String.IsNullOrEmpty(PerlPath) && String.Equals(PerlPath, processor, StringComparison.InvariantCultureIgnoreCase))
virtualDir.PerlInstalled = true; virtualDir.PerlInstalled = true;
} }
// Detect PHP 5 Fast_cgi version(s)
var activePhp5Handler = GetActivePhpHandlerName(srvman, virtualDir);
if (!string.IsNullOrEmpty(activePhp5Handler))
{
virtualDir.PhpInstalled = PHP_5 + "|" + activePhp5Handler;
var versions = GetPhpVersions(srvman, virtualDir);
// This versionstring is used in UI to view and change php5 version.
var versionString = string.Join("|", versions.Select(v => v.HandlerName + ";" + v.Version).ToArray());
virtualDir.Php5VersionsInstalled = versionString;
}
// //
string fqPath = virtualDir.FullQualifiedPath; string fqPath = virtualDir.FullQualifiedPath;
if (!fqPath.EndsWith(@"/")) if (!fqPath.EndsWith(@"/"))
@ -865,32 +878,60 @@ namespace WebsitePanel.Providers.Web
#endregion #endregion
#region PHP 5 script mappings #region PHP 5 script mappings
if (!String.IsNullOrEmpty(PhpExecutablePath) && File.Exists(PhpExecutablePath)) if (virtualDir.PhpInstalled.StartsWith(PHP_5))
{ {
if (virtualDir.PhpInstalled == PHP_5) if (PhpMode == Constants.PhpMode.FastCGI && virtualDir.PhpInstalled.Contains('|'))
{ {
switch (PhpMode) var args = virtualDir.PhpInstalled.Split('|');
{
case Constants.PhpMode.FastCGI: if (args.Count() > 1)
handlersSvc.AddScriptMaps(virtualDir, PHP_EXTENSIONS, {
PhpExecutablePath, Constants.HandlerAlias.PHP_FASTCGI, Constants.FastCgiModule); // Handler name is present, use it to set choosen version
break; var handlerName = args[1];
case Constants.PhpMode.CGI:
handlersSvc.AddScriptMaps(virtualDir, PHP_EXTENSIONS, if (handlerName != GetActivePhpHandlerName(virtualDir))
PhpExecutablePath, Constants.HandlerAlias.PHP_CGI, Constants.CgiModule); {
break; // Only change handler if it is different from the current one
case Constants.PhpMode.ISAPI: handlersSvc.CopyInheritedHandlers(((WebSite)virtualDir).SiteId, virtualDir.VirtualPath);
handlersSvc.AddScriptMaps(virtualDir, PHP_EXTENSIONS, MakeHandlerActive(handlerName, virtualDir);
PhpExecutablePath, Constants.HandlerAlias.PHP_ISAPI, Constants.IsapiModule); }
break; }
} }
} else
else {
{ if (!String.IsNullOrEmpty(PhpExecutablePath) && File.Exists(PhpExecutablePath))
handlersSvc.RemoveScriptMaps(virtualDir, PHP_EXTENSIONS, PhpExecutablePath); {
} switch (PhpMode)
} {
// case Constants.PhpMode.FastCGI:
handlersSvc.AddScriptMaps(virtualDir, PHP_EXTENSIONS,
PhpExecutablePath, Constants.HandlerAlias.PHP_FASTCGI, Constants.FastCgiModule);
break;
case Constants.PhpMode.CGI:
handlersSvc.AddScriptMaps(virtualDir, PHP_EXTENSIONS,
PhpExecutablePath, Constants.HandlerAlias.PHP_CGI, Constants.CgiModule);
break;
case Constants.PhpMode.ISAPI:
handlersSvc.AddScriptMaps(virtualDir, PHP_EXTENSIONS,
PhpExecutablePath, Constants.HandlerAlias.PHP_ISAPI, Constants.IsapiModule);
break;
}
}
}
}
else
{
if (PhpMode == Constants.PhpMode.FastCGI && GetPhpVersions(virtualDir).Any())
{
// Don't erase handler mappings, if we do, the virtualDir cannot see and choose what version of PHP to run later
}
else
{
handlersSvc.RemoveScriptMaps(virtualDir, PHP_EXTENSIONS, PhpExecutablePath);
}
}
//
#endregion #endregion
#region PHP 4 script mappings (IsapiModule only) #region PHP 4 script mappings (IsapiModule only)
@ -4437,5 +4478,91 @@ namespace WebsitePanel.Providers.Web
#endregion #endregion
}
#region Php Management
protected PhpVersion[] GetPhpVersions(ServerManager srvman, WebVirtualDirectory virtualDir)
{
var config = srvman.GetWebConfiguration(((WebSite)virtualDir).SiteId, virtualDir.VirtualPath);
//var config = srvman.GetApplicationHostConfiguration();
var handlersSection = config.GetSection(Constants.HandlersSection);
var result = new List<PhpVersion>();
// Loop through available maps and fill installed processors
foreach (var handler in handlersSection.GetCollection())
{
if (string.Equals(handler["path"].ToString(), "*.php", StringComparison.OrdinalIgnoreCase))
{
var executable = handler["ScriptProcessor"].ToString().Split('|')[0];
if (string.Equals(handler["Modules"].ToString(), "FastCgiModule", StringComparison.OrdinalIgnoreCase) && File.Exists(executable))
{
var handlerName = handler["Name"].ToString();
result.Add(new PhpVersion() {HandlerName = handlerName, Version = GetPhpExecutableVersion(executable), ExecutionPath = handler["ScriptProcessor"].ToString()});
}
}
}
return result.ToArray();
}
protected PhpVersion[] GetPhpVersions(WebVirtualDirectory virtualDir)
{
using (var srvman = webObjectsSvc.GetServerManager())
{
return GetPhpVersions(srvman, virtualDir);
}
}
protected string GetActivePhpHandlerName(WebVirtualDirectory virtualDir)
{
using (var srvman = webObjectsSvc.GetServerManager())
{
return GetActivePhpHandlerName(srvman, virtualDir);
}
}
protected string GetActivePhpHandlerName(ServerManager srvman, WebVirtualDirectory virtualDir)
{
var config = srvman.GetWebConfiguration(((WebSite)virtualDir).SiteId, virtualDir.VirtualPath);
var handlersSection = config.GetSection(Constants.HandlersSection);
// Find first handler for *.php
return (from handler in handlersSection.GetCollection()
where string.Equals(handler["path"].ToString(), "*.php", StringComparison.OrdinalIgnoreCase) && string.Equals(handler["Modules"].ToString(), "FastCgiModule", StringComparison.OrdinalIgnoreCase)
select handler["name"].ToString()
).FirstOrDefault();
}
protected static string GetPhpExecutableVersion(string phpexePath)
{
return FileVersionInfo.GetVersionInfo(phpexePath).ProductVersion;
}
protected void MakeHandlerActive(string handlerName, WebVirtualDirectory virtualDir)
{
using (var srvman = webObjectsSvc.GetServerManager())
{
var config = srvman.GetWebConfiguration(((WebSite)virtualDir).SiteId, virtualDir.VirtualPath);
var handlersSection = (HandlersSection)config.GetSection(Constants.HandlersSection, typeof(HandlersSection));
var handlersCollection = handlersSection.Handlers;
var handlerElement = handlersCollection[handlerName];
var activeHandlerElement = handlersCollection[GetActivePhpHandlerName(srvman, virtualDir)];
var activeHandlerIndex = handlersCollection.IndexOf(activeHandlerElement);
handlersCollection.Remove(handlerElement);
handlersCollection.AddCopyAt(activeHandlerIndex, handlerElement);
srvman.CommitChanges();
}
}
#endregion
}
} }

View file

@ -511,6 +511,8 @@ namespace WebsitePanel.Providers.Utils
user.PasswordCantChange = ((userFlags & ADAccountOptions.UF_PASSWD_CANT_CHANGE) != 0); user.PasswordCantChange = ((userFlags & ADAccountOptions.UF_PASSWD_CANT_CHANGE) != 0);
user.PasswordNeverExpires = ((userFlags & ADAccountOptions.UF_DONT_EXPIRE_PASSWD) != 0); user.PasswordNeverExpires = ((userFlags & ADAccountOptions.UF_DONT_EXPIRE_PASSWD) != 0);
user.AccountDisabled = ((userFlags & ADAccountOptions.UF_ACCOUNTDISABLE) != 0); user.AccountDisabled = ((userFlags & ADAccountOptions.UF_ACCOUNTDISABLE) != 0);
user.MsIIS_FTPDir = GetObjectProperty(objUser, "msIIS-FTPDir").ToString();
user.MsIIS_FTPRoot = GetObjectProperty(objUser, "msIIS-FTPRoot").ToString();
// get user groups // get user groups
user.MemberOf = GetUserGroups(objUser); user.MemberOf = GetUserGroups(objUser);
@ -727,6 +729,12 @@ namespace WebsitePanel.Providers.Utils
objUser.Properties["description"].Value = String.IsNullOrEmpty(user.Description) ? "WebsitePanel System Account" : user.Description; objUser.Properties["description"].Value = String.IsNullOrEmpty(user.Description) ? "WebsitePanel System Account" : user.Description;
if (user.MsIIS_FTPDir != string.Empty)
{
SetObjectProperty(objUser, "msIIS-FTPDir", user.MsIIS_FTPDir);
SetObjectProperty(objUser, "msIIS-FTPRoot", user.MsIIS_FTPRoot);
}
ADAccountOptions userFlags = ADAccountOptions.UF_NORMAL_ACCOUNT; ADAccountOptions userFlags = ADAccountOptions.UF_NORMAL_ACCOUNT;
if (user.PasswordCantChange) if (user.PasswordCantChange)

View file

@ -36,6 +36,7 @@ Default skin template. The following skins are provided as examples only.
<asp:Image SkinID="OrganizationUser48" runat="server" ImageUrl="images/Exchange/admin_48.png" ImageAlign="AbsMiddle" Width="48" Height="48"></asp:Image> <asp:Image SkinID="OrganizationUser48" runat="server" ImageUrl="images/Exchange/admin_48.png" ImageAlign="AbsMiddle" Width="48" Height="48"></asp:Image>
<asp:Image SkinID="OrganizationUserAdd48" runat="server" ImageUrl="images/Exchange/admin_add_48.png" ImageAlign="AbsMiddle" Width="48" Height="48"></asp:Image> <asp:Image SkinID="OrganizationUserAdd48" runat="server" ImageUrl="images/Exchange/admin_add_48.png" ImageAlign="AbsMiddle" Width="48" Height="48"></asp:Image>
<asp:Image SkinID="VipUser16" runat="server" ImageUrl="images/Exchange/vip_user_16.png" ImageAlign="AbsMiddle" Width="16" Height="16"></asp:Image>
<%-- Exchange Icons --%> <%-- Exchange Icons --%>
<asp:Image SkinID="ExchangeOrg48" runat="server" ImageUrl="images/Exchange/server_mail_48.png" ImageAlign="AbsMiddle" Width="48" Height="48"></asp:Image> <asp:Image SkinID="ExchangeOrg48" runat="server" ImageUrl="images/Exchange/server_mail_48.png" ImageAlign="AbsMiddle" Width="48" Height="48"></asp:Image>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 353 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

View file

@ -219,4 +219,7 @@
<data name="locEnterpriseStorage.Text" xml:space="preserve"> <data name="locEnterpriseStorage.Text" xml:space="preserve">
<value>Enterprise Storage</value> <value>Enterprise Storage</value>
</data> </data>
<data name="locServiceLevels.Text" xml:space="preserve">
<value>Service Levels</value>
</data>
</root> </root>

View file

@ -21,6 +21,8 @@
<asp:Localize ID="locTitle" runat="server" meta:resourcekey="locTitle" Text="Edit Mailbox"></asp:Localize> <asp:Localize ID="locTitle" runat="server" meta:resourcekey="locTitle" Text="Edit Mailbox"></asp:Localize>
- -
<asp:Literal ID="litDisplayName" runat="server" Text="John Smith" /> <asp:Literal ID="litDisplayName" runat="server" Text="John Smith" />
<asp:Image ID="imgVipUser" SkinID="VipUser16" runat="server" tooltip="VIP user" Visible="false"/>
<asp:Label ID="litServiceLevel" runat="server" style="float:right;padding-right:8px;" Visible="false"></asp:Label>
</div> </div>
<div class="FormBody"> <div class="FormBody">
<wsp:MailboxTabs id="tabs" runat="server" SelectedTab="mailbox_settings" /> <wsp:MailboxTabs id="tabs" runat="server" SelectedTab="mailbox_settings" />

View file

@ -172,6 +172,17 @@ namespace WebsitePanel.Portal.ExchangeServer
archivingQuotaViewer.QuotaValue = ArchivingMaxSize; archivingQuotaViewer.QuotaValue = ArchivingMaxSize;
rowArchiving.Visible = chkEnableArchiving.Checked; rowArchiving.Visible = chkEnableArchiving.Checked;
if (account.LevelId > 0 && Cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels))
{
WebsitePanel.EnterpriseServer.Base.HostedSolution.ServiceLevel serviceLevel = ES.Services.Organizations.GetSupportServiceLevel(account.LevelId);
litServiceLevel.Visible = true;
litServiceLevel.Text = serviceLevel.LevelName;
litServiceLevel.ToolTip = serviceLevel.LevelDescription;
}
imgVipUser.Visible = account.IsVIP && Cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels);
} }
catch (Exception ex) catch (Exception ex)
{ {

View file

@ -39,6 +39,24 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.Literal litDisplayName; protected global::System.Web.UI.WebControls.Literal litDisplayName;
/// <summary>
/// imgVipUser control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Image imgVipUser;
/// <summary>
/// litServiceLevel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label litServiceLevel;
/// <summary> /// <summary>
/// tabs control. /// tabs control.
/// </summary> /// </summary>

View file

@ -112,10 +112,25 @@
</SelectParameters> </SelectParameters>
</asp:ObjectDataSource> </asp:ObjectDataSource>
<br /> <br />
<asp:Localize ID="locQuota" runat="server" meta:resourcekey="locQuota" Text="Total Mailboxes Created:"></asp:Localize> <div>
&nbsp;&nbsp;&nbsp; <asp:Localize ID="locQuota" runat="server" meta:resourcekey="locQuota" Text="Total Mailboxes Created:"></asp:Localize>
<wsp:QuotaViewer ID="mailboxesQuota" runat="server" QuotaTypeId="2" /> &nbsp;&nbsp;&nbsp;
<wsp:QuotaViewer ID="mailboxesQuota" runat="server" QuotaTypeId="2" />
</div>
<asp:Repeater ID="dlServiceLevelQuotas" runat="server" EnableViewState="false">
<ItemTemplate>
<div>
<asp:Localize ID="locServiceLevelQuota" runat="server" Text='<%# Eval("QuotaDescription") %>'></asp:Localize>
&nbsp;&nbsp;&nbsp;
<wsp:QuotaViewer ID="serviceLevelQuota" runat="server"
QuotaTypeId='<%# Eval("QuotaTypeId") %>'
QuotaUsedValue='<%# Eval("QuotaUsedValue") %>'
QuotaValue='<%# Eval("QuotaValue") %>'
QuotaAvailable='<%# Eval("QuotaAvailable")%>'/>
</div>
</ItemTemplate>
</asp:Repeater>
</div> </div>
</div> </div>

View file

@ -32,6 +32,7 @@ using System.Web.UI.WebControls;
using WebsitePanel.Providers.HostedSolution; using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.EnterpriseServer; using WebsitePanel.EnterpriseServer;
using WebsitePanel.EnterpriseServer.Base.HostedSolution; using WebsitePanel.EnterpriseServer.Base.HostedSolution;
using System.Collections.Generic;
namespace WebsitePanel.Portal.ExchangeServer namespace WebsitePanel.Portal.ExchangeServer
{ {
@ -55,6 +56,8 @@ namespace WebsitePanel.Portal.ExchangeServer
btnCreateMailbox.Visible = !ArchivingBoxes; btnCreateMailbox.Visible = !ArchivingBoxes;
cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (!IsPostBack) if (!IsPostBack)
{ {
BindStats(); BindStats();
@ -62,7 +65,7 @@ namespace WebsitePanel.Portal.ExchangeServer
BindServiceLevels(); BindServiceLevels();
cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_ISCONSUMER)) if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_ISCONSUMER))
{ {
if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1) if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1)
@ -87,6 +90,35 @@ namespace WebsitePanel.Portal.ExchangeServer
mailboxesQuota.QuotaUsedValue = stats.CreatedMailboxes; mailboxesQuota.QuotaUsedValue = stats.CreatedMailboxes;
mailboxesQuota.QuotaValue = stats.AllocatedMailboxes; mailboxesQuota.QuotaValue = stats.AllocatedMailboxes;
if (stats.AllocatedMailboxes != -1) mailboxesQuota.QuotaAvailable = tenantStats.AllocatedMailboxes - tenantStats.CreatedMailboxes; if (stats.AllocatedMailboxes != -1) mailboxesQuota.QuotaAvailable = tenantStats.AllocatedMailboxes - tenantStats.CreatedMailboxes;
if (cntx != null && cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels)) BindServiceLevelsStats();
}
private void BindServiceLevelsStats()
{
ServiceLevels = ES.Services.Organizations.GetSupportServiceLevels();
OrganizationUser[] accounts = ES.Services.Organizations.SearchAccounts(PanelRequest.ItemID, "", "", "", true);
List<ServiceLevelQuotaValueInfo> serviceLevelQuotas = new List<ServiceLevelQuotaValueInfo>();
foreach (var quota in Array.FindAll<QuotaValueInfo>(
cntx.QuotasArray, x => x.QuotaName.Contains(Quotas.SERVICE_LEVELS)))
{
int levelId = ServiceLevels.Where(x => x.LevelName == quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "")).FirstOrDefault().LevelId;
int usedInOrgCount = accounts.Where(x => x.LevelId == levelId).Count();
serviceLevelQuotas.Add(new ServiceLevelQuotaValueInfo
{
QuotaName = quota.QuotaName,
QuotaDescription = quota.QuotaDescription + " in this Organization:",
QuotaTypeId = quota.QuotaTypeId,
QuotaValue = quota.QuotaAllocatedValue,
QuotaUsedValue = usedInOrgCount,
//QuotaUsedValue = quota.QuotaUsedValue,
QuotaAvailable = quota.QuotaAllocatedValue - quota.QuotaUsedValue
});
}
dlServiceLevelQuotas.DataSource = serviceLevelQuotas;
dlServiceLevelQuotas.DataBind();
} }
protected void btnCreateMailbox_Click(object sender, EventArgs e) protected void btnCreateMailbox_Click(object sender, EventArgs e)
@ -204,7 +236,7 @@ namespace WebsitePanel.Portal.ExchangeServer
bool enable = !string.IsNullOrEmpty(serviceLevel.LevelName); bool enable = !string.IsNullOrEmpty(serviceLevel.LevelName);
enable = enable ? cntx.Quotas.ContainsKey(Quotas.SERVICE_LEVELS + serviceLevel.LevelName) : false; enable = enable ? cntx.Quotas.ContainsKey(Quotas.SERVICE_LEVELS + serviceLevel.LevelName) : false;
enable = enable ? cntx.Quotas[Quotas.SERVICE_LEVELS + serviceLevel.LevelName].QuotaAllocatedValue > 0 : false; enable = enable ? cntx.Quotas[Quotas.SERVICE_LEVELS + serviceLevel.LevelName].QuotaAllocatedValue != 0 : false;
if (!enable) if (!enable)
{ {
@ -212,7 +244,6 @@ namespace WebsitePanel.Portal.ExchangeServer
serviceLevel.LevelDescription = ""; serviceLevel.LevelDescription = "";
} }
//return ServiceLevels.Where(x => x.LevelId == levelId).DefaultIfEmpty(new ServiceLevel { LevelName = "", LevelDescription = "" }).FirstOrDefault();
return serviceLevel; return serviceLevel;
} }
} }

View file

@ -137,5 +137,14 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer mailboxesQuota; protected global::WebsitePanel.Portal.QuotaViewer mailboxesQuota;
/// <summary>
/// dlServiceLevelQuotas control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Repeater dlServiceLevelQuotas;
} }
} }

View file

@ -315,6 +315,14 @@
</td> </td>
</tr> </tr>
</asp:Panel> </asp:Panel>
<asp:Panel runat="server" ID="serviceLevelsStatsPanel">
<tr>
<td class="OrgStatsGroup" width="100%" colspan="2">
<asp:Localize ID="locServiceLevels" runat="server" meta:resourcekey="locServiceLevels" ></asp:Localize>
</td>
</tr>
</asp:Panel>
</table> </table>
</div> </div>

View file

@ -27,6 +27,9 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System; using System;
using System.Linq;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using WebsitePanel.EnterpriseServer; using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.HostedSolution; using WebsitePanel.Providers.HostedSolution;
@ -279,6 +282,14 @@ namespace WebsitePanel.Portal.ExchangeServer
} }
else else
enterpriseStorageStatsPanel.Visible = false; enterpriseStorageStatsPanel.Visible = false;
if (cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels))
{
serviceLevelsStatsPanel.Visible = true;
BindServiceLevelsStats(cntx);
}
else
serviceLevelsStatsPanel.Visible = false;
} }
private void BindCRMStats(OrganizationStatistics stats, OrganizationStatistics tenantStats) private void BindCRMStats(OrganizationStatistics stats, OrganizationStatistics tenantStats)
@ -379,5 +390,47 @@ namespace WebsitePanel.Portal.ExchangeServer
"SpaceID=" + PanelSecurity.PackageId.ToString()); "SpaceID=" + PanelSecurity.PackageId.ToString());
} }
private void BindServiceLevelsStats(PackageContext cntx)
{
WebsitePanel.EnterpriseServer.Base.HostedSolution.ServiceLevel[] serviceLevels = ES.Services.Organizations.GetSupportServiceLevels();
OrganizationUser[] accounts = ES.Services.Organizations.SearchAccounts(PanelRequest.ItemID, "", "", "", true);
foreach (var quota in Array.FindAll<QuotaValueInfo>(
cntx.QuotasArray, x => x.QuotaName.Contains(Quotas.SERVICE_LEVELS)))
{
HtmlTableRow tr = new HtmlTableRow();
tr.Attributes["class"] = "OrgStatsRow";
HtmlTableCell col1 = new HtmlTableCell();
col1.Attributes["class"] = "OrgStatsQuota";
col1.Attributes["nowrap"] = "nowrap";
HyperLink link = new HyperLink();
link.ID = "lnk_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "").Replace(" ", string.Empty).Trim();
link.Text = quota.QuotaDescription.Replace(", users", " (users):");
col1.Controls.Add(link);
int levelId = serviceLevels.Where(x => x.LevelName == quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "")).FirstOrDefault().LevelId;
int usedInOrgCount = accounts.Where(x => x.LevelId == levelId).Count();
HtmlTableCell col2 = new HtmlTableCell();
QuotaViewer quotaControl = (QuotaViewer)LoadControl("../UserControls/QuotaViewer.ascx");
quotaControl.ID = quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "").Replace(" ", string.Empty).Trim() + "Stats";
quotaControl.QuotaTypeId = quota.QuotaTypeId;
quotaControl.DisplayGauge = true;
quotaControl.QuotaValue = quota.QuotaAllocatedValue;
quotaControl.QuotaUsedValue = usedInOrgCount;
//quotaControl.QuotaUsedValue = quota.QuotaUsedValue;
if (quota.QuotaAllocatedValue != -1)
quotaControl.QuotaAvailable = quota.QuotaAllocatedValue - quota.QuotaUsedValue;
col2.Controls.Add(quotaControl);
tr.Controls.Add(col1);
tr.Controls.Add(col2);
serviceLevelsStatsPanel.Controls.Add(tr);
}
}
} }
} }

View file

@ -740,5 +740,23 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer enterpriseStorageFoldersStats; protected global::WebsitePanel.Portal.QuotaViewer enterpriseStorageFoldersStats;
/// <summary>
/// serviceLevelsStatsPanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel serviceLevelsStatsPanel;
/// <summary>
/// locServiceLevels control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locServiceLevels;
} }
} }

View file

@ -28,6 +28,8 @@
<asp:Localize ID="locTitle" runat="server" meta:resourcekey="locTitle" Text="Edit User"></asp:Localize> <asp:Localize ID="locTitle" runat="server" meta:resourcekey="locTitle" Text="Edit User"></asp:Localize>
- -
<asp:Literal ID="litDisplayName" runat="server" Text="John Smith" /> <asp:Literal ID="litDisplayName" runat="server" Text="John Smith" />
<asp:Image ID="imgVipUser" SkinID="VipUser16" runat="server" tooltip="VIP user" Visible="false"/>
<asp:Label ID="litServiceLevel" runat="server" style="float:right;padding-right:8px;" Visible="false"></asp:Label>
</div> </div>
<div class="FormBody"> <div class="FormBody">

View file

@ -128,23 +128,35 @@ namespace WebsitePanel.Portal.HostedSolution
if (user.LevelId > 0 && secServiceLevels.Visible) if (user.LevelId > 0 && secServiceLevels.Visible)
{ {
secServiceLevels.IsCollapsed = false;
ServiceLevel serviceLevel = ES.Services.Organizations.GetSupportServiceLevel(user.LevelId); ServiceLevel serviceLevel = ES.Services.Organizations.GetSupportServiceLevel(user.LevelId);
litServiceLevel.Visible = true;
litServiceLevel.Text = serviceLevel.LevelName;
litServiceLevel.ToolTip = serviceLevel.LevelDescription;
bool addLevel = ddlServiceLevels.Items.FindByValue(serviceLevel.LevelId.ToString()) == null; bool addLevel = ddlServiceLevels.Items.FindByValue(serviceLevel.LevelId.ToString()) == null;
addLevel = addLevel && cntx.Quotas.ContainsKey(Quotas.SERVICE_LEVELS + serviceLevel.LevelName); addLevel = addLevel && cntx.Quotas.ContainsKey(Quotas.SERVICE_LEVELS + serviceLevel.LevelName);
addLevel = addLevel ? cntx.Quotas[Quotas.SERVICE_LEVELS + serviceLevel.LevelName].QuotaAllocatedValue > 0 : addLevel; addLevel = addLevel ? cntx.Quotas[Quotas.SERVICE_LEVELS + serviceLevel.LevelName].QuotaAllocatedValue != 0 : addLevel;
if (addLevel) if (addLevel)
{ {
ddlServiceLevels.Items.Add(new ListItem(serviceLevel.LevelName, serviceLevel.LevelId.ToString())); ddlServiceLevels.Items.Add(new ListItem(serviceLevel.LevelName, serviceLevel.LevelId.ToString()));
}
bool levelInDDL = ddlServiceLevels.Items.FindByValue(serviceLevel.LevelId.ToString()) != null;
if (levelInDDL)
{
ddlServiceLevels.Items.FindByValue(string.Empty).Selected = false; ddlServiceLevels.Items.FindByValue(string.Empty).Selected = false;
ddlServiceLevels.Items.FindByValue(serviceLevel.LevelId.ToString()).Selected = true; ddlServiceLevels.Items.FindByValue(serviceLevel.LevelId.ToString()).Selected = true;
} }
} }
chkVIP.Checked = user.IsVIP && secServiceLevels.Visible; chkVIP.Checked = user.IsVIP && secServiceLevels.Visible;
imgVipUser.Visible = user.IsVIP && secServiceLevels.Visible;
if (cntx.Quotas.ContainsKey(Quotas.ORGANIZATION_ALLOWCHANGEUPN)) if (cntx.Quotas.ContainsKey(Quotas.ORGANIZATION_ALLOWCHANGEUPN))
@ -235,7 +247,7 @@ namespace WebsitePanel.Portal.HostedSolution
{ {
foreach (var serviceLevel in ES.Services.Organizations.GetSupportServiceLevels()) foreach (var serviceLevel in ES.Services.Organizations.GetSupportServiceLevels())
{ {
if (quota.Key.Replace(Quotas.SERVICE_LEVELS, "") == serviceLevel.LevelName && CheckServiceLevelQuota(quota.Value, serviceLevel.LevelId)) if (quota.Key.Replace(Quotas.SERVICE_LEVELS, "") == serviceLevel.LevelName && CheckServiceLevelQuota(quota.Value))
{ {
enabledServiceLevels.Add(serviceLevel); enabledServiceLevels.Add(serviceLevel);
} }
@ -256,9 +268,8 @@ namespace WebsitePanel.Portal.HostedSolution
} }
private bool CheckServiceLevelQuota(QuotaValueInfo quota, int levelID) private bool CheckServiceLevelQuota(QuotaValueInfo quota)
{ {
quota.QuotaUsedValue = ES.Services.Organizations.SearchAccounts(PanelRequest.ItemID, "", "", "", true).Where(x => x.LevelId == levelID).Count();
if (quota.QuotaAllocatedValue != -1) if (quota.QuotaAllocatedValue != -1)
{ {
@ -322,6 +333,18 @@ namespace WebsitePanel.Portal.HostedSolution
if (!chkLocked.Checked) if (!chkLocked.Checked)
chkLocked.Enabled = false; chkLocked.Enabled = false;
litServiceLevel.Visible = !string.IsNullOrEmpty(ddlServiceLevels.SelectedValue) && secServiceLevels.Visible;
if (litServiceLevel.Visible)
{
ServiceLevel serviceLevel = ES.Services.Organizations.GetSupportServiceLevel(int.Parse(ddlServiceLevels.SelectedValue));
litServiceLevel.Text = serviceLevel.LevelName;
litServiceLevel.ToolTip = serviceLevel.LevelDescription;
}
imgVipUser.Visible = chkVIP.Checked && secServiceLevels.Visible;
messageBox.ShowSuccessMessage("ORGANIZATION_UPDATE_USER_SETTINGS"); messageBox.ShowSuccessMessage("ORGANIZATION_UPDATE_USER_SETTINGS");
} }
catch (Exception ex) catch (Exception ex)

View file

@ -48,6 +48,24 @@ namespace WebsitePanel.Portal.HostedSolution {
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.Literal litDisplayName; protected global::System.Web.UI.WebControls.Literal litDisplayName;
/// <summary>
/// imgVipUser control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Image imgVipUser;
/// <summary>
/// litServiceLevel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label litServiceLevel;
/// <summary> /// <summary>
/// UserTabsId control. /// UserTabsId control.
/// </summary> /// </summary>

View file

@ -109,9 +109,25 @@
</SelectParameters> </SelectParameters>
</asp:ObjectDataSource> </asp:ObjectDataSource>
<br /> <br />
<asp:Localize ID="locQuota" runat="server" meta:resourcekey="locQuota" Text="Total Users Created:"></asp:Localize> <div>
&nbsp;&nbsp;&nbsp; <asp:Localize ID="locQuota" runat="server" meta:resourcekey="locQuota" Text="Total Users Created:"></asp:Localize>
<wsp:QuotaViewer ID="usersQuota" runat="server" QuotaTypeId="2" /> &nbsp;&nbsp;&nbsp;
<wsp:QuotaViewer ID="usersQuota" runat="server" QuotaTypeId="2" />
</div>
<asp:Repeater ID="dlServiceLevelQuotas" runat="server" EnableViewState="false">
<ItemTemplate>
<div>
<asp:Localize ID="locServiceLevelQuota" runat="server" Text='<%# Eval("QuotaDescription") %>'></asp:Localize>
&nbsp;&nbsp;&nbsp;
<wsp:QuotaViewer ID="serviceLevelQuota" runat="server"
QuotaTypeId='<%# Eval("QuotaTypeId") %>'
QuotaUsedValue='<%# Eval("QuotaUsedValue") %>'
QuotaValue='<%# Eval("QuotaValue") %>'
QuotaAvailable='<%# Eval("QuotaAvailable")%>'/>
</div>
</ItemTemplate>
</asp:Repeater>
</div> </div>
</div> </div>
</div> </div>

View file

@ -43,6 +43,8 @@ namespace WebsitePanel.Portal.HostedSolution
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
{ {
cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (!IsPostBack) if (!IsPostBack)
{ {
BindStats(); BindStats();
@ -50,7 +52,6 @@ namespace WebsitePanel.Portal.HostedSolution
BindServiceLevels(); BindServiceLevels();
cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_ISCONSUMER)) if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_ISCONSUMER))
{ {
if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1) if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1)
@ -74,6 +75,32 @@ namespace WebsitePanel.Portal.HostedSolution
usersQuota.QuotaUsedValue = stats.CreatedUsers; usersQuota.QuotaUsedValue = stats.CreatedUsers;
usersQuota.QuotaValue = stats.AllocatedUsers; usersQuota.QuotaValue = stats.AllocatedUsers;
if (stats.AllocatedUsers != -1) usersQuota.QuotaAvailable = tenantStats.AllocatedUsers - tenantStats.CreatedUsers; if (stats.AllocatedUsers != -1) usersQuota.QuotaAvailable = tenantStats.AllocatedUsers - tenantStats.CreatedUsers;
if(cntx != null && cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels)) BindServiceLevelsStats();
}
private void BindServiceLevelsStats()
{
ServiceLevels = ES.Services.Organizations.GetSupportServiceLevels();
OrganizationUser[] accounts = ES.Services.Organizations.SearchAccounts(PanelRequest.ItemID, "", "", "", true);
List<ServiceLevelQuotaValueInfo> serviceLevelQuotas = new List<ServiceLevelQuotaValueInfo>();
foreach (var quota in Array.FindAll<QuotaValueInfo>(
cntx.QuotasArray, x => x.QuotaName.Contains(Quotas.SERVICE_LEVELS)))
{
int levelId = ServiceLevels.Where(x => x.LevelName == quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "")).FirstOrDefault().LevelId;
int usedInOrgCount = accounts.Where(x => x.LevelId == levelId).Count();
serviceLevelQuotas.Add(new ServiceLevelQuotaValueInfo { QuotaName = quota.QuotaName,
QuotaDescription = quota.QuotaDescription + " in this Organization:",
QuotaTypeId = quota.QuotaTypeId,
QuotaValue = quota.QuotaAllocatedValue,
QuotaUsedValue = usedInOrgCount,
//QuotaUsedValue = quota.QuotaUsedValue,
QuotaAvailable = quota.QuotaAllocatedValue - quota.QuotaUsedValue });
}
dlServiceLevelQuotas.DataSource = serviceLevelQuotas;
dlServiceLevelQuotas.DataBind();
} }
protected void btnCreateUser_Click(object sender, EventArgs e) protected void btnCreateUser_Click(object sender, EventArgs e)
@ -317,7 +344,7 @@ namespace WebsitePanel.Portal.HostedSolution
bool enable = !string.IsNullOrEmpty(serviceLevel.LevelName); bool enable = !string.IsNullOrEmpty(serviceLevel.LevelName);
enable = enable ? cntx.Quotas.ContainsKey(Quotas.SERVICE_LEVELS + serviceLevel.LevelName) : false; enable = enable ? cntx.Quotas.ContainsKey(Quotas.SERVICE_LEVELS + serviceLevel.LevelName) : false;
enable = enable ? cntx.Quotas[Quotas.SERVICE_LEVELS + serviceLevel.LevelName].QuotaAllocatedValue > 0 : false; enable = enable ? cntx.Quotas[Quotas.SERVICE_LEVELS + serviceLevel.LevelName].QuotaAllocatedValue != 0 : false;
if (!enable) if (!enable)
{ {
@ -325,7 +352,6 @@ namespace WebsitePanel.Portal.HostedSolution
serviceLevel.LevelDescription = ""; serviceLevel.LevelDescription = "";
} }
//return ServiceLevels.Where(x => x.LevelId == levelId).DefaultIfEmpty(new ServiceLevel { LevelName = "", LevelDescription = "" }).FirstOrDefault();
return serviceLevel; return serviceLevel;
} }
} }

View file

@ -137,5 +137,14 @@ namespace WebsitePanel.Portal.HostedSolution {
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer usersQuota; protected global::WebsitePanel.Portal.QuotaViewer usersQuota;
/// <summary>
/// dlServiceLevelQuotas control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Repeater dlServiceLevelQuotas;
} }
} }

View file

@ -19,6 +19,8 @@
<asp:Localize ID="locTitle" runat="server" meta:resourcekey="locTitle"></asp:Localize> <asp:Localize ID="locTitle" runat="server" meta:resourcekey="locTitle"></asp:Localize>
- -
<asp:Literal ID="litDisplayName" runat="server" Text="John Smith" /> <asp:Literal ID="litDisplayName" runat="server" Text="John Smith" />
<asp:Image ID="imgVipUser" SkinID="VipUser16" runat="server" tooltip="VIP user" Visible="false"/>
<asp:Label ID="litServiceLevel" runat="server" style="float:right;padding-right:8px;" Visible="false"></asp:Label>
</div> </div>
<div class="FormBody"> <div class="FormBody">

View file

@ -118,6 +118,22 @@ namespace WebsitePanel.Portal.Lync
lyncUserSettings.sipAddress = lyncUser.SipAddress; lyncUserSettings.sipAddress = lyncUser.SipAddress;
Utils.SelectListItem(ddlPhoneNumber, lyncUser.LineUri); Utils.SelectListItem(ddlPhoneNumber, lyncUser.LineUri);
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
OrganizationUser user = ES.Services.Organizations.GetUserGeneralSettings(PanelRequest.ItemID,
PanelRequest.AccountID);
if (user.LevelId > 0 && cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels))
{
WebsitePanel.EnterpriseServer.Base.HostedSolution.ServiceLevel serviceLevel = ES.Services.Organizations.GetSupportServiceLevel(user.LevelId);
litServiceLevel.Visible = true;
litServiceLevel.Text = serviceLevel.LevelName;
litServiceLevel.ToolTip = serviceLevel.LevelDescription;
}
imgVipUser.Visible = user.IsVIP && cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels);
} }
protected bool SaveSettings() protected bool SaveSettings()

View file

@ -1,32 +1,4 @@
// Copyright (c) 2014, Outercurve Foundation. //------------------------------------------------------------------------------
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// //
@ -76,6 +48,24 @@ namespace WebsitePanel.Portal.Lync {
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.Literal litDisplayName; protected global::System.Web.UI.WebControls.Literal litDisplayName;
/// <summary>
/// imgVipUser control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Image imgVipUser;
/// <summary>
/// litServiceLevel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label litServiceLevel;
/// <summary> /// <summary>
/// messageBox control. /// messageBox control.
/// </summary> /// </summary>

View file

@ -256,7 +256,10 @@
<data name="txtPublicSharedIP.Text" xml:space="preserve"> <data name="txtPublicSharedIP.Text" xml:space="preserve">
<value>Web Sites Public Shared Address:</value> <value>Web Sites Public Shared Address:</value>
</data> </data>
<data name="chkHeliconApeGlobalRegistration.Text"> <data name="chkHeliconApeGlobalRegistration.Text" xml:space="preserve">
<value xml:space="preserve">Register Helicon Ape module globally:</value> <value>Register Helicon Ape module globally:</value>
</data>
<data name="litPHP5Info.Text" xml:space="preserve">
<value>If any PHP5 FastCGI handlers are present on the server, the PHP 5.x Executable Path given above will be ignored and not used.</value>
</data> </data>
</root> </root>

View file

@ -112,10 +112,10 @@
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<data name="chkBuildUncFilesPath.Text" xml:space="preserve"> <data name="chkBuildUncFilesPath.Text" xml:space="preserve">
<value>Yes</value> <value>Yes</value>
@ -138,4 +138,7 @@
<data name="Text.SelectSite" xml:space="preserve"> <data name="Text.SelectSite" xml:space="preserve">
<value>&lt;Select FTP Site&gt;</value> <value>&lt;Select FTP Site&gt;</value>
</data> </data>
<data name="lblAdFtpRoot.Text" xml:space="preserve">
<value>FTP RootDir:</value>
</data>
</root> </root>

View file

@ -291,6 +291,11 @@
</asp:DropDownList> </asp:DropDownList>
</td> </td>
</tr> </tr>
<tr>
<td colspan="2" class="Normal">
<asp:Literal ID="litPHP5Info" runat="server" meta:resourcekey="litPHP5Info" Text="If any PHP5 FastCGI handlers are present on the server, the PHP 5.x Executable Path given above will be ignored and not used."></asp:Literal>
</td>
</tr>
<tr> <tr>
<td class="Normal" valign="top"> <td class="Normal" valign="top">
<asp:Label runat="server" meta:resourcekey="perlPathLabel" Text="Perl Executable Path:"></asp:Label> <asp:Label runat="server" meta:resourcekey="perlPathLabel" Text="Perl Executable Path:"></asp:Label>

View file

@ -490,6 +490,15 @@ namespace WebsitePanel.Portal.ProviderControls {
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.DropDownList ddlPhpMode; protected global::System.Web.UI.WebControls.DropDownList ddlPhpMode;
/// <summary>
/// litPHP5Info control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litPHP5Info;
/// <summary> /// <summary>
/// perlPath control. /// perlPath control.
/// </summary> /// </summary>

View file

@ -1,45 +1,61 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MSFTP70_Settings.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.MSFTP70_Settings" %> <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MSFTP70_Settings.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.MSFTP70_Settings" %>
<%@ Register Src="Common_ActiveDirectoryIntegration.ascx" TagName="ActiveDirectoryIntegration" TagPrefix="uc1" %> <%@ Register Src="Common_ActiveDirectoryIntegration.ascx" TagName="ActiveDirectoryIntegration" TagPrefix="uc1" %>
<%@ Register Src="../UserControls/SelectIPAddress.ascx" TagName="SelectIPAddress" TagPrefix="uc1" %> <%@ Register Src="../UserControls/SelectIPAddress.ascx" TagName="SelectIPAddress" TagPrefix="uc1" %>
<table cellpadding="4" cellspacing="0" width="100%"> <table width="100%">
<tr> <tr>
<td class="Normal" width="200" nowrap> <td class="SubHead" width="150">
<asp:Label ID="lblSharedIP" runat="server" meta:resourcekey="lblSharedIP" Text="Web Sites Shared IP Address:"></asp:Label> <asp:Label ID="lblSharedIP" runat="server" meta:resourcekey="lblSharedIP" Text="Web Sites Shared IP Address:"></asp:Label>
</td> </td>
<td width="100%"> <td class="Normal">
<uc1:SelectIPAddress ID="ipAddress" runat="server" ServerIdParam="ServerID" /> <uc1:SelectIPAddress ID="ipAddress" runat="server" ServerIdParam="ServerID" />
</td>
</tr>
<tr>
<td class="SubHead" width="200" nowrap>
<asp:Label ID="lblSite" runat="server" meta:resourcekey="lblSite" Text="FTP Accounts Site:"></asp:Label>
</td>
<td width="100%">
<asp:TextBox ID="txtSiteId" runat="server" CssClass="NormalTextBox" Width="200px"></asp:TextBox>
</td> </td>
</tr> </tr>
<tr> </table>
<td class="SubHead"> <asp:UpdatePanel runat="server" UpdateMode="Conditional">
<asp:Label ID="lblGroupName" runat="server" meta:resourcekey="lblGroupName" Text="FTP Users Group Name:"></asp:Label> <ContentTemplate>
</td> <table width="100%">
<td class="Normal"> <tr>
<td class="SubHead" width="150">
<asp:Label ID="lblSite" runat="server" meta:resourcekey="lblSite" Text="FTP Accounts Site:"></asp:Label>
</td>
<td class="Normal">
<asp:DropDownList runat="server" ID="ddlSite" AutoPostBack="True" OnSelectedIndexChanged="ddlSite_SelectedIndexChanged" />
</td>
</tr>
<tr runat="server" id="FtpRootRow" visible="False">
<td class="SubHead">
<asp:Label ID="lblAdFtpRoot" runat="server" meta:resourcekey="lblAdFtpRoot" Text="FTP RootDir:"></asp:Label>
</td>
<td class="Normal">
<asp:TextBox ID="txtAdFtpRoot" runat="server" CssClass="NormalTextBox" Width="200px"></asp:TextBox>
<asp:RequiredFieldValidator runat="server" ID="txtAdFtpRootReqValidator" ControlToValidate="txtAdFtpRoot" Enabled="False" ErrorMessage="*"></asp:RequiredFieldValidator>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
<table width="100%">
<tr>
<td class="SubHead" width="150">
<asp:Label ID="lblGroupName" runat="server" meta:resourcekey="lblGroupName" Text="FTP Users Group Name:"></asp:Label>
</td>
<td class="Normal">
<asp:TextBox ID="txtFtpGroupName" runat="server" CssClass="NormalTextBox" Width="200px"></asp:TextBox></td> <asp:TextBox ID="txtFtpGroupName" runat="server" CssClass="NormalTextBox" Width="200px"></asp:TextBox></td>
</tr> </tr>
<tr> <tr>
<td class="SubHead"> <td class="SubHead">
<asp:Label ID="lblBuildUncFilesPath" runat="server" meta:resourcekey="lblBuildUncFilesPath" Text="Build UNC Path to Space Files:"></asp:Label> <asp:Label ID="lblBuildUncFilesPath" runat="server" meta:resourcekey="lblBuildUncFilesPath" Text="Build UNC Path to Space Files:"></asp:Label>
</td>
<td>
<asp:CheckBox ID="chkBuildUncFilesPath" runat="server" meta:resourcekey="chkBuildUncFilesPath" Text="Yes" />
</td>
</tr>
<tr>
<td class="SubHead">
<asp:Label ID="lblADIntegration" runat="server" meta:resourcekey="lblADIntegration" Text="Active Directory Integration:"></asp:Label>
</td>
<td class="Normal">
<uc1:ActiveDirectoryIntegration ID="ActiveDirectoryIntegration" runat="server" />
</td> </td>
</tr> <td>
</table> <asp:CheckBox ID="chkBuildUncFilesPath" runat="server" meta:resourcekey="chkBuildUncFilesPath" Text="Yes" />
</td>
</tr>
<tr>
<td class="SubHead">
<asp:Label ID="lblADIntegration" runat="server" meta:resourcekey="lblADIntegration" Text="Active Directory Integration:"></asp:Label>
</td>
<td class="Normal">
<uc1:ActiveDirectoryIntegration ID="ActiveDirectoryIntegration" runat="server" />
</td>
</tr>
</table>

View file

@ -27,10 +27,12 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System; using System;
using System.Collections.Generic;
using System.Data; using System.Data;
using System.Configuration; using System.Configuration;
using System.Collections; using System.Collections;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Linq;
using System.Web; using System.Web;
using System.Web.Security; using System.Web.Security;
using System.Web.UI; using System.Web.UI;
@ -51,7 +53,8 @@ namespace WebsitePanel.Portal.ProviderControls
{ {
int selectedAddressid = this.FindAddressByText(settings["SharedIP"]); int selectedAddressid = this.FindAddressByText(settings["SharedIP"]);
ipAddress.AddressId = (selectedAddressid > 0) ? selectedAddressid : 0; ipAddress.AddressId = (selectedAddressid > 0) ? selectedAddressid : 0;
txtSiteId.Text = settings["SiteId"]; BindSiteId(settings);
txtAdFtpRoot.Text = settings["AdFtpRoot"];
txtFtpGroupName.Text = settings["FtpGroupName"]; txtFtpGroupName.Text = settings["FtpGroupName"];
chkBuildUncFilesPath.Checked = Utils.ParseBool(settings["BuildUncFilesPath"], false); chkBuildUncFilesPath.Checked = Utils.ParseBool(settings["BuildUncFilesPath"], false);
ActiveDirectoryIntegration.BindSettings(settings); ActiveDirectoryIntegration.BindSettings(settings);
@ -75,7 +78,11 @@ namespace WebsitePanel.Portal.ProviderControls
{ {
settings["SharedIP"] = String.Empty; settings["SharedIP"] = String.Empty;
} }
settings["SiteId"] = txtSiteId.Text.Trim(); settings["SiteId"] = ddlSite.SelectedValue;
if (!string.IsNullOrWhiteSpace(txtAdFtpRoot.Text))
{
settings["AdFtpRoot"] = txtAdFtpRoot.Text.Trim();
}
settings["FtpGroupName"] = txtFtpGroupName.Text.Trim(); settings["FtpGroupName"] = txtFtpGroupName.Text.Trim();
settings["BuildUncFilesPath"] = chkBuildUncFilesPath.Checked.ToString(); settings["BuildUncFilesPath"] = chkBuildUncFilesPath.Checked.ToString();
ActiveDirectoryIntegration.SaveSettings(settings); ActiveDirectoryIntegration.SaveSettings(settings);
@ -83,6 +90,11 @@ namespace WebsitePanel.Portal.ProviderControls
private int FindAddressByText(string address) private int FindAddressByText(string address)
{ {
if (string.IsNullOrEmpty(address))
{
return 0;
}
foreach (IPAddressInfo addressInfo in ES.Services.Servers.GetIPAddresses(IPAddressPool.General, PanelRequest.ServerId)) foreach (IPAddressInfo addressInfo in ES.Services.Servers.GetIPAddresses(IPAddressPool.General, PanelRequest.ServerId))
{ {
if (addressInfo.InternalIP == address || addressInfo.ExternalIP == address) if (addressInfo.InternalIP == address || addressInfo.ExternalIP == address)
@ -92,5 +104,31 @@ namespace WebsitePanel.Portal.ProviderControls
} }
return 0; return 0;
} }
private void BindSiteId(StringDictionary settings)
{
var sites = ES.Services.FtpServers.GetFtpSites(PanelRequest.ServiceId);
foreach (var site in sites)
{
var item = new ListItem(site.Name + " (User Isolation Mode: " + site["UserIsolationMode"] + ")", site.Name);
if (item.Value == settings["SiteId"])
{
item.Selected = true;
}
ddlSite.Items.Add(item);
}
ddlSite_SelectedIndexChanged(this, null);
}
protected void ddlSite_SelectedIndexChanged(object sender, EventArgs e)
{
var isActiveDirectoryUserIsolated = ddlSite.SelectedItem.Text.Contains("ActiveDirectory");
FtpRootRow.Visible = isActiveDirectoryUserIsolated;
txtAdFtpRootReqValidator.Enabled= isActiveDirectoryUserIsolated;
}
} }
} }

View file

@ -1,22 +1,15 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:2.0.50727.1378
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace WebsitePanel.Portal.ProviderControls { namespace WebsitePanel.Portal.ProviderControls {
/// <summary>
/// MSFTP70_Settings class.
/// </summary>
/// <remarks>
/// Auto-generated class.
/// </remarks>
public partial class MSFTP70_Settings { public partial class MSFTP70_Settings {
/// <summary> /// <summary>
@ -47,13 +40,49 @@ namespace WebsitePanel.Portal.ProviderControls {
protected global::System.Web.UI.WebControls.Label lblSite; protected global::System.Web.UI.WebControls.Label lblSite;
/// <summary> /// <summary>
/// txtSiteId control. /// ddlSite control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtSiteId; protected global::System.Web.UI.WebControls.DropDownList ddlSite;
/// <summary>
/// FtpRootRow control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow FtpRootRow;
/// <summary>
/// lblAdFtpRoot control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblAdFtpRoot;
/// <summary>
/// txtAdFtpRoot control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtAdFtpRoot;
/// <summary>
/// txtAdFtpRootReqValidator control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.RequiredFieldValidator txtAdFtpRootReqValidator;
/// <summary> /// <summary>
/// lblGroupName control. /// lblGroupName control.

View file

@ -46,8 +46,8 @@
<td class="FormLabel200" align="right"> <td class="FormLabel200" align="right">
<asp:Label ID="lblServiceLevelName" runat="server" meta:resourcekey="lblServiceLevelName" Text="Name:"></asp:Label> <asp:Label ID="lblServiceLevelName" runat="server" meta:resourcekey="lblServiceLevelName" Text="Name:"></asp:Label>
</td> </td>
<td class="Normal"> <td>
<asp:TextBox ID="txtServiceLevelName" runat="server" Width="100%" CssClass="NormalTextBox" MaxLength="255"></asp:TextBox> <asp:TextBox ID="txtServiceLevelName" runat="server" Width="720px" CssClass="NormalTextBox" MaxLength="255"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireServiceLevelName" runat="server" meta:resourcekey="valRequireServiceLevelName" ControlToValidate="txtServiceLevelName" <asp:RequiredFieldValidator ID="valRequireServiceLevelName" runat="server" meta:resourcekey="valRequireServiceLevelName" ControlToValidate="txtServiceLevelName"
ErrorMessage="Enter service level name" ValidationGroup="CreateServiceLevel" Display="Dynamic" Text="*" SetFocusOnError="True"></asp:RequiredFieldValidator> ErrorMessage="Enter service level name" ValidationGroup="CreateServiceLevel" Display="Dynamic" Text="*" SetFocusOnError="True"></asp:RequiredFieldValidator>
</td> </td>
@ -56,8 +56,9 @@
<td class="FormLabel200" align="right"> <td class="FormLabel200" align="right">
<asp:Label ID="lblServiceLevelDescr" runat="server" meta:resourcekey="lblServiceLevelDescr" Text="Description:"></asp:Label> <asp:Label ID="lblServiceLevelDescr" runat="server" meta:resourcekey="lblServiceLevelDescr" Text="Description:"></asp:Label>
</td> </td>
<td class="Normal" valign=top> <td>
<asp:TextBox ID="txtServiceLevelDescr" runat="server" Rows="10" TextMode="MultiLine" Width="100%" CssClass="NormalTextBox" Wrap="False" MaxLength="511"></asp:TextBox></td> <asp:TextBox ID="txtServiceLevelDescr" runat="server" Rows="7" TextMode="MultiLine" Width="720px" CssClass="NormalTextBox" Wrap="False" MaxLength="511"></asp:TextBox>
</td>
</tr> </tr>
</table> </table>
</asp:Panel> </asp:Panel>

View file

@ -63,6 +63,13 @@ namespace WebsitePanel.Portal
BindServiceLevels(); BindServiceLevels();
txtStatus.Visible = false; txtStatus.Visible = false;
try
{
//Change container title
((Label)this.Parent.Parent.Parent.Parent.Parent.FindControl(WebsitePanel.WebPortal.DefaultPage.MODULE_TITLE_CONTROL_ID)).Text = "Service Levels";
}
catch { /*to do*/ }
} }

View file

@ -2,7 +2,7 @@
<%@ Register Src="UserControls/Quota.ascx" TagName="Quota" TagPrefix="wsp" %> <%@ Register Src="UserControls/Quota.ascx" TagName="Quota" TagPrefix="wsp" %>
<div class="FormBody"> <div class="FormBody">
<table cellpadding="3"> <table id="tblQuotas" runat="server" cellpadding="3">
<tr ID="pnlDiskspace" runat="server"> <tr ID="pnlDiskspace" runat="server">
<td class="SubHead" nowrap><asp:Label runat="server" meta:resourcekey="lblDiskspace" Text="Diskspace, MB:"/></td> <td class="SubHead" nowrap><asp:Label runat="server" meta:resourcekey="lblDiskspace" Text="Diskspace, MB:"/></td>
<td class="Normal"><wsp:Quota ID="quotaDiskspace" runat="server" QuotaName="OS.Diskspace" DisplayGauge="True" />&nbsp;&nbsp;(<asp:HyperLink <td class="Normal"><wsp:Quota ID="quotaDiskspace" runat="server" QuotaName="OS.Diskspace" DisplayGauge="True" />&nbsp;&nbsp;(<asp:HyperLink
@ -22,12 +22,12 @@
<td class="SubHead" nowrap><asp:Label ID="lblSubDomains" runat="server" meta:resourcekey="lblSubDomains" Text="Sub-Domains:"></asp:Label></td> <td class="SubHead" nowrap><asp:Label ID="lblSubDomains" runat="server" meta:resourcekey="lblSubDomains" Text="Sub-Domains:"></asp:Label></td>
<td class="Normal"><wsp:Quota ID="quotaSubDomains" runat="server" QuotaName="OS.SubDomains" DisplayGauge="True" /></td> <td class="Normal"><wsp:Quota ID="quotaSubDomains" runat="server" QuotaName="OS.SubDomains" DisplayGauge="True" /></td>
</tr> </tr>
<!--
<tr ID="pnlDomainPointers" runat="server"> <%-- <tr ID="pnlDomainPointers" runat="server">
<td class="SubHead" nowrap><asp:Label ID="lblDomainPointers" runat="server" meta:resourcekey="lblDomainPointers" Text="Domain Pointers:"></asp:Label></td> <td class="SubHead" nowrap><asp:Label ID="lblDomainPointers" runat="server" meta:resourcekey="lblDomainPointers" Text="Domain Pointers:"></asp:Label></td>
<td class="Normal"><wsp:Quota ID="quotaDomainPointers" runat="server" QuotaName="OS.DomainPointers" DisplayGauge="True" /></td> <td class="Normal"><wsp:Quota ID="quotaDomainPointers" runat="server" QuotaName="OS.DomainPointers" DisplayGauge="True" /></td>
</tr> </tr>--%>
-->
<tr ID="pnlOrganizations" runat="server"> <tr ID="pnlOrganizations" runat="server">
<td class="SubHead" nowrap><asp:Label ID="lblOrganizations" runat="server" meta:resourcekey="lblOrganizations" Text="Organizations:"></asp:Label></td> <td class="SubHead" nowrap><asp:Label ID="lblOrganizations" runat="server" meta:resourcekey="lblOrganizations" Text="Organizations:"></asp:Label></td>
<td class="Normal"><wsp:Quota ID="quotaOrganizations" runat="server" QuotaName="HostedSolution.Organizations" DisplayGauge="True" /></td> <td class="Normal"><wsp:Quota ID="quotaOrganizations" runat="server" QuotaName="HostedSolution.Organizations" DisplayGauge="True" /></td>

View file

@ -131,6 +131,8 @@ namespace WebsitePanel.Portal
protected override void OnPreRender(EventArgs e) protected override void OnPreRender(EventArgs e)
{ {
//
AddServiceLevelsQuotas();
// //
SetVisibilityStatus4BriefQuotasBlock(); SetVisibilityStatus4BriefQuotasBlock();
// //
@ -175,5 +177,37 @@ namespace WebsitePanel.Portal
} }
} }
} }
private void AddServiceLevelsQuotas()
{
foreach (var quota in Array.FindAll<QuotaValueInfo>(
cntx.QuotasArray, x => x.QuotaName.Contains(Quotas.SERVICE_LEVELS)))
{
HtmlTableRow tr = new HtmlTableRow();
tr.ID = "pnl_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "").Replace(" ", string.Empty).Trim();
HtmlTableCell col1 = new HtmlTableCell();
col1.Attributes["class"] = "SubHead";
col1.Attributes["nowrap"] = "nowrap";
Label lbl = new Label();
lbl.ID = "lbl_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "").Replace(" ", string.Empty).Trim();
lbl.Text = quota.QuotaDescription + ":";
col1.Controls.Add(lbl);
HtmlTableCell col2 = new HtmlTableCell();
col2.Attributes["class"] = "Normal";
Quota quotaControl = (Quota)LoadControl("UserControls/Quota.ascx");
quotaControl.ID = "quota_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "").Replace(" ", string.Empty).Trim();
quotaControl.QuotaName = quota.QuotaName;
quotaControl.DisplayGauge = true;
col2.Controls.Add(quotaControl);
tr.Controls.Add(col1);
tr.Controls.Add(col2);
tblQuotas.Controls.Add(tr);
}
}
} }
} }

View file

@ -1,31 +1,3 @@
// Copyright (c) 2014, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
@ -40,6 +12,15 @@ namespace WebsitePanel.Portal {
public partial class SpaceQuotas { public partial class SpaceQuotas {
/// <summary>
/// tblQuotas control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTable tblQuotas;
/// <summary> /// <summary>
/// pnlDiskspace control. /// pnlDiskspace control.
/// </summary> /// </summary>
@ -148,33 +129,6 @@ namespace WebsitePanel.Portal {
/// </remarks> /// </remarks>
protected global::WebsitePanel.Portal.Quota quotaSubDomains; protected global::WebsitePanel.Portal.Quota quotaSubDomains;
/// <summary>
/// pnlDomainPointers control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow pnlDomainPointers;
/// <summary>
/// lblDomainPointers control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblDomainPointers;
/// <summary>
/// quotaDomainPointers control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.Quota quotaDomainPointers;
/// <summary> /// <summary>
/// pnlOrganizations control. /// pnlOrganizations control.
/// </summary> /// </summary>

View file

@ -13,7 +13,7 @@
<ItemTemplate> <ItemTemplate>
<div class="Quota"> <div class="Quota">
<div class="Left"> <div class="Left">
<%# GetQuotaTitle((string)Eval("QuotaName"), (string)Eval("QuotaDescription"))%>: <%# GetQuotaTitle((string)Eval("QuotaName"), (object)Eval("QuotaDescription"))%>:
</div> </div>
<div class="Viewer"> <div class="Viewer">
<uc1:QuotaViewer ID="quota" runat="server" <uc1:QuotaViewer ID="quota" runat="server"

View file

@ -76,11 +76,11 @@ namespace WebsitePanel.Portal
return new DataView(dsQuotas.Tables[1], "GroupID=" + groupId.ToString(), "", DataViewRowState.CurrentRows); return new DataView(dsQuotas.Tables[1], "GroupID=" + groupId.ToString(), "", DataViewRowState.CurrentRows);
} }
public string GetQuotaTitle(string quotaName, string quotaDescription) public string GetQuotaTitle(string quotaName, object quotaDescription)
{ {
return quotaName.Contains("ServiceLevel") ? string description = (quotaDescription.GetType() == typeof(System.DBNull)) ? string.Empty : (string)quotaDescription;
(string.IsNullOrEmpty(quotaDescription) ?
string.Empty : quotaDescription).ToString() return quotaName.Contains("ServiceLevel") ? description
: GetSharedLocalizedString("Quota." + quotaName); : GetSharedLocalizedString("Quota." + quotaName);
} }
} }

View file

@ -30,8 +30,6 @@
<td class="Normal"> <td class="Normal">
<asp:DropDownList ID="ddlPhp" runat="server" CssClass="NormalTextBox" resourcekey="ddlPhp"> <asp:DropDownList ID="ddlPhp" runat="server" CssClass="NormalTextBox" resourcekey="ddlPhp">
<asp:ListItem Value="">None</asp:ListItem> <asp:ListItem Value="">None</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
<asp:ListItem Value="5">5</asp:ListItem>
</asp:DropDownList> </asp:DropDownList>
</td> </td>
</tr> </tr>

View file

@ -30,6 +30,7 @@ using System;
using System.Data; using System.Data;
using System.Configuration; using System.Configuration;
using System.Collections; using System.Collections;
using System.Linq;
using System.Web; using System.Web;
using System.Web.Security; using System.Web.Security;
using System.Web.UI; using System.Web.UI;
@ -98,13 +99,23 @@ namespace WebsitePanel.Portal
if (!IIs7 || !PackagesHelper.CheckGroupQuotaEnabled(packageId, ResourceGroups.Web, Quotas.WEB_ASPNET40)) if (!IIs7 || !PackagesHelper.CheckGroupQuotaEnabled(packageId, ResourceGroups.Web, Quotas.WEB_ASPNET40))
ddlAspNet.Items.Remove(ddlAspNet.Items.FindByValue("4I")); ddlAspNet.Items.Remove(ddlAspNet.Items.FindByValue("4I"));
rowAspNet.Visible = ddlAspNet.Items.Count > 1;
// php // php
if (!PackagesHelper.CheckGroupQuotaEnabled(packageId, ResourceGroups.Web, Quotas.WEB_PHP4)) if (PackagesHelper.CheckGroupQuotaEnabled(packageId, ResourceGroups.Web, Quotas.WEB_PHP4))
ddlPhp.Items.Remove(ddlPhp.Items.FindByValue("4")); ddlPhp.Items.Add("4");
if (!PackagesHelper.CheckGroupQuotaEnabled(packageId, ResourceGroups.Web, Quotas.WEB_PHP5)) if (PackagesHelper.CheckGroupQuotaEnabled(packageId, ResourceGroups.Web, Quotas.WEB_PHP5))
ddlPhp.Items.Remove(ddlPhp.Items.FindByValue("5")); {
if (!string.IsNullOrEmpty(item.Php5VersionsInstalled))
{
// Add items from list
ddlPhp.Items.Remove(ddlPhp.Items.FindByValue(""));
ddlPhp.Items.AddRange(item.Php5VersionsInstalled.Split('|').Select(v => new ListItem(v.Split(';')[1], "5|" + v.Split(';')[0])).OrderBy(i => i.Text).ToArray());
}
else
{
ddlPhp.Items.Add("5");
}
}
Utils.SelectListItem(ddlPhp, item.PhpInstalled);
rowPhp.Visible = ddlPhp.Items.Count > 1; rowPhp.Visible = ddlPhp.Items.Count > 1;
rowPerl.Visible = PackagesHelper.CheckGroupQuotaEnabled(packageId, ResourceGroups.Web, Quotas.WEB_PERL); rowPerl.Visible = PackagesHelper.CheckGroupQuotaEnabled(packageId, ResourceGroups.Web, Quotas.WEB_PERL);

View file

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