CheckLoadUserProfile

This commit is contained in:
Sergey 2012-09-13 16:16:23 +03:00
parent cfb58e3423
commit 444473a73d
10 changed files with 641 additions and 233 deletions

View file

@ -33,6 +33,7 @@ using System.Data.SqlClient;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using WebsitePanel.Providers.HostedSolution; using WebsitePanel.Providers.HostedSolution;
using Microsoft.ApplicationBlocks.Data; using Microsoft.ApplicationBlocks.Data;
using System.Collections.Generic;
namespace WebsitePanel.EnterpriseServer namespace WebsitePanel.EnterpriseServer
{ {
@ -3399,5 +3400,45 @@ namespace WebsitePanel.EnterpriseServer
#endregion #endregion
public static int GetPackageIdByName(string Name)
{
// get Helicon Zoo provider
int packageId = -1;
List<ProviderInfo> providers = ServerController.GetProviders();
foreach (ProviderInfo providerInfo in providers)
{
if (string.Equals(Name, providerInfo.ProviderName, StringComparison.OrdinalIgnoreCase))
{
packageId = providerInfo.ProviderId;
break;
}
}
if (-1 == packageId)
{
throw new Exception("Provider not found");
}
return packageId;
}
public static int GetServiceIdByProviderForServer(int providerId, int serverId)
{
IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.Text,
@"SELECT TOP 1
ServiceID
FROM Services
WHERE ProviderID = @ProviderID AND ServerID = @ServerID",
new SqlParameter("@ProviderID", providerId),
new SqlParameter("@ServerID", serverId));
if (reader.Read())
{
return (int)reader["ServiceID"];
}
return -1;
}
} }
} }

View file

@ -41,6 +41,7 @@ using WebsitePanel.Providers.OS;
using OS = WebsitePanel.Providers.OS; using OS = WebsitePanel.Providers.OS;
using System.Collections; using System.Collections;
namespace WebsitePanel.EnterpriseServer namespace WebsitePanel.EnterpriseServer
{ {
public class OperatingSystemController : IImportController, IBackupController public class OperatingSystemController : IImportController, IBackupController
@ -409,6 +410,23 @@ namespace WebsitePanel.EnterpriseServer
#region Web Platform Installer #region Web Platform Installer
public static bool CheckLoadUserProfile(int serverId)
{
int packageId = DataProvider.GetPackageIdByName("IIS70");
int serviceId = DataProvider.GetServiceIdByProviderForServer(packageId, serverId);
return WebServerController.GetWebServer(serviceId).CheckLoadUserProfile();
}
public static void EnableLoadUserProfile(int serverId)
{
int packageId = DataProvider.GetPackageIdByName("IIS70");
int serviceId = DataProvider.GetServiceIdByProviderForServer(packageId, serverId);
WebServerController.GetWebServer(serviceId).EnableLoadUserProfile();
}
public static void InitWPIFeeds(int serverId, string feedUrls) public static void InitWPIFeeds(int serverId, string feedUrls)
{ {
GetServerService(serverId).InitWPIFeeds(feedUrls); GetServerService(serverId).InitWPIFeeds(feedUrls);
@ -747,6 +765,7 @@ namespace WebsitePanel.EnterpriseServer
} }
#endregion #endregion
} }
} }

View file

@ -670,6 +670,20 @@ namespace WebsitePanel.EnterpriseServer
#region Web Platform Installer #region Web Platform Installer
[WebMethod]
public bool CheckLoadUserProfile(int serverId)
{
return OperatingSystemController.CheckLoadUserProfile(serverId);
}
[WebMethod]
public void EnableLoadUserProfile(int serverId)
{
OperatingSystemController.EnableLoadUserProfile(serverId);
}
[WebMethod] [WebMethod]
public void InitWPIFeeds(int serverId) public void InitWPIFeeds(int serverId)
{ {

View file

@ -119,6 +119,8 @@ namespace WebsitePanel.Providers.Web
// web app gallery // web app gallery
bool CheckLoadUserProfile();
void EnableLoadUserProfile();
void InitFeeds(int UserId, string[] feeds); void InitFeeds(int UserId, string[] feeds);
void SetResourceLanguage(int UserId, string resourceLanguage); void SetResourceLanguage(int UserId, string resourceLanguage);
bool IsMsDeployInstalled(); bool IsMsDeployInstalled();
@ -153,5 +155,7 @@ namespace WebsitePanel.Providers.Web
ResultObject DeleteCertificate(SSLCertificate certificate, WebSite website); ResultObject DeleteCertificate(SSLCertificate certificate, WebSite website);
SSLCertificate ImportCertificate(WebSite website); SSLCertificate ImportCertificate(WebSite website);
bool CheckCertificate(WebSite webSite); bool CheckCertificate(WebSite webSite);
} }
} }

View file

@ -4042,6 +4042,26 @@ namespace WebsitePanel.Providers.Web
// moved down to IIs60 // moved down to IIs60
override public bool CheckLoadUserProfile()
{
using (var srvman = new ServerManager())
{
return srvman.ApplicationPools["WebsitePanel Server"].ProcessModel.LoadUserProfile;
}
}
override public void EnableLoadUserProfile()
{
using (var srvman = new ServerManager())
{
srvman.ApplicationPools["WebsitePanel Server"].ProcessModel.LoadUserProfile = true;
// save changes
srvman.CommitChanges();
}
}
#endregion #endregion
} }
} }

View file

@ -3394,6 +3394,18 @@ namespace WebsitePanel.Providers.Web
private const string WPI_INSTANCE_VIEWER = "viewer"; private const string WPI_INSTANCE_VIEWER = "viewer";
private const string WPI_INSTANCE_INSTALLER = "installer"; private const string WPI_INSTANCE_INSTALLER = "installer";
virtual public bool CheckLoadUserProfile()
{
throw new NotImplementedException("LoadUserProfile option valid only on IIS7 or higer");
}
virtual public void EnableLoadUserProfile()
{
throw new NotImplementedException("LoadUserProfile option valid only on IIS7 or higer");
}
public void InitFeeds(int UserId, string[] feeds) public void InitFeeds(int UserId, string[] feeds)
{ {
//need to call InitFeeds() before any operation with WPIApplicationGallery() //need to call InitFeeds() before any operation with WPIApplicationGallery()
@ -3667,5 +3679,10 @@ namespace WebsitePanel.Providers.Web
throw new NotSupportedException(); throw new NotSupportedException();
} }
#endregion #endregion
} }
} }

View file

@ -1,8 +1,3 @@
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// //
// - Redistributions of source code must retain the above copyright notice, this // - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer. // list of conditions and the following disclaimer.
@ -52,6 +47,7 @@ namespace WebsitePanel.Providers.Web
using WebsitePanel.Providers.Common; using WebsitePanel.Providers.Common;
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()]
@ -180,6 +176,10 @@ namespace WebsitePanel.Providers.Web
private System.Threading.SendOrPostCallback DeleteHeliconApeGroupOperationCompleted; private System.Threading.SendOrPostCallback DeleteHeliconApeGroupOperationCompleted;
private System.Threading.SendOrPostCallback CheckLoadUserProfileOperationCompleted;
private System.Threading.SendOrPostCallback EnableLoadUserProfileOperationCompleted;
private System.Threading.SendOrPostCallback InitFeedsOperationCompleted; private System.Threading.SendOrPostCallback InitFeedsOperationCompleted;
private System.Threading.SendOrPostCallback SetResourceLanguageOperationCompleted; private System.Threading.SendOrPostCallback SetResourceLanguageOperationCompleted;
@ -416,6 +416,12 @@ namespace WebsitePanel.Providers.Web
/// <remarks/> /// <remarks/>
public event DeleteHeliconApeGroupCompletedEventHandler DeleteHeliconApeGroupCompleted; public event DeleteHeliconApeGroupCompletedEventHandler DeleteHeliconApeGroupCompleted;
/// <remarks/>
public event CheckLoadUserProfileCompletedEventHandler CheckLoadUserProfileCompleted;
/// <remarks/>
public event EnableLoadUserProfileCompletedEventHandler EnableLoadUserProfileCompleted;
/// <remarks/> /// <remarks/>
public event InitFeedsCompletedEventHandler InitFeedsCompleted; public event InitFeedsCompletedEventHandler InitFeedsCompleted;
@ -3005,6 +3011,82 @@ namespace WebsitePanel.Providers.Web
} }
} }
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/CheckLoadUserProfile", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public bool CheckLoadUserProfile() {
object[] results = this.Invoke("CheckLoadUserProfile", new object[0]);
return ((bool)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginCheckLoadUserProfile(System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("CheckLoadUserProfile", new object[0], callback, asyncState);
}
/// <remarks/>
public bool EndCheckLoadUserProfile(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((bool)(results[0]));
}
/// <remarks/>
public void CheckLoadUserProfileAsync() {
this.CheckLoadUserProfileAsync(null);
}
/// <remarks/>
public void CheckLoadUserProfileAsync(object userState) {
if ((this.CheckLoadUserProfileOperationCompleted == null)) {
this.CheckLoadUserProfileOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCheckLoadUserProfileOperationCompleted);
}
this.InvokeAsync("CheckLoadUserProfile", new object[0], this.CheckLoadUserProfileOperationCompleted, userState);
}
private void OnCheckLoadUserProfileOperationCompleted(object arg) {
if ((this.CheckLoadUserProfileCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.CheckLoadUserProfileCompleted(this, new CheckLoadUserProfileCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/EnableLoadUserProfile", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void EnableLoadUserProfile() {
this.Invoke("EnableLoadUserProfile", new object[0]);
}
/// <remarks/>
public System.IAsyncResult BeginEnableLoadUserProfile(System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("EnableLoadUserProfile", new object[0], callback, asyncState);
}
/// <remarks/>
public void EndEnableLoadUserProfile(System.IAsyncResult asyncResult) {
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void EnableLoadUserProfileAsync() {
this.EnableLoadUserProfileAsync(null);
}
/// <remarks/>
public void EnableLoadUserProfileAsync(object userState) {
if ((this.EnableLoadUserProfileOperationCompleted == null)) {
this.EnableLoadUserProfileOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnableLoadUserProfileOperationCompleted);
}
this.InvokeAsync("EnableLoadUserProfile", new object[0], this.EnableLoadUserProfileOperationCompleted, userState);
}
private void OnEnableLoadUserProfileOperationCompleted(object arg) {
if ((this.EnableLoadUserProfileCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.EnableLoadUserProfileCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/> /// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/InitFeeds", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/InitFeeds", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
@ -5064,6 +5146,36 @@ namespace WebsitePanel.Providers.Web
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void DeleteHeliconApeGroupCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); public delegate void DeleteHeliconApeGroupCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void CheckLoadUserProfileCompletedEventHandler(object sender, CheckLoadUserProfileCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class CheckLoadUserProfileCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal CheckLoadUserProfileCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public bool Result {
get {
this.RaiseExceptionIfNecessary();
return ((bool)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void EnableLoadUserProfileCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void InitFeedsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); public delegate void InitFeedsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);

View file

@ -1061,6 +1061,42 @@ namespace WebsitePanel.Server
#endregion #endregion
#region Web Application Gallery #region Web Application Gallery
[WebMethod, SoapHeader("settings")]
public bool CheckLoadUserProfile()
{
try
{
Log.WriteStart("CheckLoadUserProfile");
return WebProvider.CheckLoadUserProfile();
Log.WriteEnd("CheckLoadUserProfile");
}
catch (Exception ex)
{
Log.WriteError("CheckLoadUserProfile", ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void EnableLoadUserProfile()
{
try
{
Log.WriteStart("EnableLoadUserProfile");
WebProvider.EnableLoadUserProfile();
Log.WriteEnd("EnableLoadUserProfile");
}
catch (Exception ex)
{
Log.WriteError("EnableLoadUserProfile", ex);
throw;
}
}
[WebMethod, SoapHeader("settings")] [WebMethod, SoapHeader("settings")]
public void InitFeeds(int UserId, string[] feeds) public void InitFeeds(int UserId, string[] feeds)
{ {

View file

@ -52,6 +52,30 @@ namespace WebsitePanel.Portal
{ {
if (!IsPostBack) if (!IsPostBack)
{ {
try
{
if (!ES.Services.Servers.CheckLoadUserProfile(PanelRequest.ServerId))
{
ShowWarningMessage("Server application pool \"Load User Profile\" setting is set to false. Please open IIS Manager, Application Pools, select pool running Web Site Panel Server component and set \"Load User Profile\" to TRUE. This setting is required for Web Paltform Installer to run.");
//ES.Services.Servers.EnableLoadUserProfile(PanelRequest.ServerId);
}
}
catch
{
ProductsPanel.Visible = false;
keywordsList.Visible = false;
SearchPanel.Visible = false;
InstallButtons1.Visible = false;
InstallButtons2.Visible = false;
ShowWarningMessage("Server application pool \"Load User Profile\" setting is set to false. Please open IIS Manager, Application Pools, select pool running Web Site Panel Server component and set \"Load User Profile\" to TRUE. This setting is required for Web Paltform Installer to run.");
}
try try
{ {
ES.Services.Servers.InitWPIFeeds(PanelRequest.ServerId); ES.Services.Servers.InitWPIFeeds(PanelRequest.ServerId);