Ejemplo n.º 1
0
		/// <summary>
		/// Updates virtual iisDirObject settings.
		/// </summary>
		/// <param name="siteId">Site's id that owns supplied iisDirObject.</param>
		/// <param name="iisDirObject">Web iisDirObject that needs to be updated.</param>
        public override void UpdateVirtualDirectory(string siteId, WebVirtualDirectory directory)
		{
			if (this.webObjectsSvc.SiteExists(siteId))
			{
				WebAppPoolHelper aphl = new WebAppPoolHelper(ProviderSettings);
                //
                bool dedicatedPool = !aphl.is_shared_pool(directory.ApplicationPool);
				//
				SiteAppPoolMode sisMode = dedicatedPool ? SiteAppPoolMode.Dedicated : SiteAppPoolMode.Shared;
				//
				directory.ParentSiteName = siteId;
                //
                string origPath = webObjectsSvc.GetPhysicalPath(directory);
				// remove unnecessary permissions
				// if original folder has been changed
				if (String.Compare(origPath, directory.ContentPath, true) != 0)
					RemoveWebFolderPermissions(origPath, GetNonQualifiedAccountName(directory.AnonymousUsername));
				// set folder permissions
				SetWebFolderPermissions(directory.ContentPath, GetNonQualifiedAccountName(directory.AnonymousUsername),
						directory.EnableWritePermissions, dedicatedPool);
                //
				var pool = Array.Find<WebAppPool>(aphl.SupportedAppPools.ToArray(),
					x => x.AspNetInstalled.Equals(directory.AspNetInstalled) && aphl.isolation(x.Mode) == sisMode);
				// Assign to virtual iisDirObject iisAppObject pool 
				directory.ApplicationPool = WSHelper.InferAppPoolName(pool.Name, siteId, pool.Mode);
				//
                webObjectsSvc.UpdateVirtualDirectory(directory);
                //
				this.FillIISObjectFromVirtualDirectory(directory);
				this.FillIISObjectFromVirtualDirectoryRest(directory);
			}
		}
Ejemplo n.º 2
0
        /// <summary>
        /// Gets virtual iisDirObject description that belongs to site with supplied id and has specified name.
        /// </summary>
        /// <param name="siteId">Site's id that owns virtual iisDirObject.</param>
        /// <param name="directoryName">Directory's name to get description for.</param>
        /// <returns>virtual iisDirObject description that belongs to site with supplied id and has specified name.</returns>
        public override WebVirtualDirectory GetVirtualDirectory(string siteId, string directoryName)
        {
			WebAppPoolHelper aphl = new WebAppPoolHelper(ProviderSettings);
			//
            WebVirtualDirectory webVirtualDirectory = webObjectsSvc.GetVirtualDirectory(siteId, directoryName);
            //
            this.FillVirtualDirectoryFromIISObject(webVirtualDirectory);
            this.FillVirtualDirectoryRestFromIISObject(webVirtualDirectory);
            //
            webVirtualDirectory.DedicatedApplicationPool = !aphl.is_shared_pool(webVirtualDirectory.ApplicationPool);
            //
            CheckEnableWritePermissions(webVirtualDirectory);
			//
			ReadWebManagementAccessDetails(webVirtualDirectory);
            //
            return webVirtualDirectory;
        }
Ejemplo n.º 3
0
		public void EnforceDelegationRulesRestrictions(string siteName, string accountName)
		{
			var moduleService = new DelegationRulesModuleService();
			// Adjust web publishing permissions to the user accordingly to deny some rules for shared app pools
			var webSite = webObjectsSvc.GetWebSiteFromIIS(siteName);
			//
			var fqUsername = GetFullQualifiedAccountName(accountName);
			// Instantiate application pool helper to retrieve the app pool mode web site is running in
			WebAppPoolHelper aphl = new WebAppPoolHelper(ProviderSettings);
			// Shared app pool is a subject restrictions to change ASP.NET version and recycle the pool
			if (aphl.is_shared_pool(webSite.ApplicationPool) == true)
			{
				//
				moduleService.RestrictRuleToUser("recycleApp", "{userScope}", fqUsername);
				moduleService.RestrictRuleToUser("appPoolPipeline,appPoolNetFx", "{userScope}", fqUsername);
			}
			// Dedicated app pool is not a subject for any restrictions
			else
			{
				//
				moduleService.AllowRuleToUser("recycleApp", "{userScope}", fqUsername);
				moduleService.AllowRuleToUser("appPoolPipeline,appPoolNetFx", "{userScope}", fqUsername);
			}
		}
Ejemplo n.º 4
0
        public override WebSite GetSite(string siteId)
		{
			WebAppPoolHelper aphl = new WebAppPoolHelper(ProviderSettings);
            //
			WebSite site = webObjectsSvc.GetWebSiteFromIIS(siteId);
            //
            site.Bindings = webObjectsSvc.GetSiteBindings(siteId);
			//
			FillVirtualDirectoryFromIISObject(site);
            //
            FillVirtualDirectoryRestFromIISObject(site);

            // check frontpage
            site.FrontPageAvailable = IsFrontPageSystemInstalled();
            site.FrontPageInstalled = IsFrontPageInstalled(siteId);

            //check ColdFusion
            if (IsColdFusionSystemInstalled())
            {
                if (IsColdFusion7Installed())
                {
                    site.ColdFusionVersion = "7";
                    site.ColdFusionAvailable = true;
                }
                else
                {
                    if (IsColdFusion8Installed())
                    {
                        site.ColdFusionVersion = "8";
                        site.ColdFusionAvailable = true;
                    }
                }

                if (IsColdFusion9Installed())
                {
                    site.ColdFusionVersion = "9";
                    site.ColdFusionAvailable = true;
                }
            }
            else
            {
                site.ColdFusionAvailable = false;
            }

            site.CreateCFVirtualDirectories = ColdFusionDirectoriesAdded(siteId);
            
            //site.ColdFusionInstalled = IsColdFusionEnabledOnSite(GetSiteId(site.Name));

            // check sharepoint
            site.SharePointInstalled = false;
            //
            site.DedicatedApplicationPool = !aphl.is_shared_pool(site.ApplicationPool);
            //
            CheckEnableWritePermissions(site);
			//
			ReadWebManagementAccessDetails(site);
            //
            site.SecuredFoldersInstalled = IsSecuredFoldersInstalled(siteId);
            //
            site.SiteState = GetSiteState(siteId);
			//
			return site;
		}
Ejemplo n.º 5
0
        private void RemoveDelegationRulesRestrictions(string siteName, string accountName)
        {
            WebSite webSite = null;
            using (ServerManager srvman = webObjectsSvc.GetServerManager())
            {
                webSite = webObjectsSvc.GetWebSiteFromIIS(srvman, siteName);
            }
            var moduleService = new DelegationRulesModuleService();
            // Adjust web publishing permissions to the user accordingly to deny some rules for shared app pools

            var fqUsername = GetFullQualifiedAccountName(accountName);
            // Instantiate application pool helper to retrieve the app pool mode web site is running in
            WebAppPoolHelper aphl = new WebAppPoolHelper(ProviderSettings);
            //
            // Shared app pool is a subject restrictions to change ASP.NET version and recycle the pool,
            // so we need to remove these restrictions
            if (aphl.is_shared_pool(webSite.ApplicationPool) == true)
            {
                //
                moduleService.RemoveUserFromRule("recycleApp", "{userScope}", fqUsername);
                moduleService.RemoveUserFromRule("appPoolPipeline,appPoolNetFx", "{userScope}", fqUsername);
            }
        }