WebApplication gallery filter mode: include or exclude apps

This commit is contained in:
Sergey 2012-09-25 16:59:50 +03:00
parent 34e566e7d1
commit feae050792
9 changed files with 122 additions and 131 deletions

View file

@ -270,6 +270,7 @@ namespace WebsitePanel.EnterpriseServer
// x => MatchGalleryAppDependencies(x.Dependency, appsFilter.ToArray())
// || MatchMenaltoGalleryApp(x, appsFilter.ToArray())));
{
FilterResultApplications(packageId, result);
@ -293,15 +294,34 @@ namespace WebsitePanel.EnterpriseServer
int userId = SecurityContext.User.UserId;
//
SecurityContext.SetThreadSupervisorPrincipal();
//get filter mode
int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.Web);
StringDictionary serviceSettings = ServerController.GetServiceSettings(serviceId);
bool bExclude = (Utils.ParseInt(serviceSettings["GalleryAppsFilterMode"], 0) != 1); //0 - Exclude apps, 1- Include apps
//
string[] filteredApps = GetServiceAppsCatalogFilter(packageId);
//
if (filteredApps != null)
{
if (bExclude)
{
result.Value = new List<GalleryApplication>(Array.FindAll(result.Value.ToArray(),
x => !Array.Exists(filteredApps,
z => z.Equals(x.Id, StringComparison.InvariantCultureIgnoreCase))));
}
else
{
result.Value = new List<GalleryApplication>(Array.FindAll(result.Value.ToArray(),
x => Array.Exists(filteredApps,
z => z.Equals(x.Id, StringComparison.InvariantCultureIgnoreCase))));
}
}
//
SecurityContext.SetThreadPrincipal(userId);
}

View file

@ -200,7 +200,7 @@
<value>Shared SSL Web Sites:</value>
</data>
<data name="lblWebAppGallery.Text" xml:space="preserve">
<value>Microsoft Web Appication Gallery</value>
<value>Web Appication Gallery</value>
</data>
<data name="lblWebFarms.Text" xml:space="preserve">
<value>Web Farms Support:</value>
@ -226,9 +226,6 @@
<data name="secWebExtensions.Text" xml:space="preserve">
<value>Web Extensions</value>
</data>
<data name="lclGalleryFilterNote.Text" xml:space="preserve">
<value>Please select items from the feed you would like to remove from the list of apps available to end-users.</value>
</data>
<data name="lblAspNet40Path.Text" xml:space="preserve">
<value>ASP.NET 4.0 Library Path:</value>
</data>

View file

@ -178,7 +178,7 @@
<value>Gallery feed URL:</value>
</data>
<data name="lblWebAppGallery.Text" xml:space="preserve">
<value>Microsoft Web Appication Gallery</value>
<value>Web Appication Gallery</value>
</data>
<data name="lclGalleryFeedNote.Text" xml:space="preserve">
<value>You could overwrite default Web App Gallery ATOM feed located at Microsoft web site by your own to provide your own applications to your customers. Leave this field blank to use default feed.</value>
@ -214,7 +214,7 @@
<value>Module Assembly:</value>
</data>
<data name="FilterDialogButton.AlternateText" xml:space="preserve">
<value>Click to modify the filter...</value>
<value>Select applications</value>
</data>
<data name="FilterDialogButton.Text" xml:space="preserve">
<value>Click to create a filter...</value>
@ -225,9 +225,6 @@
<data name="GalleryFeedFilter.Text" xml:space="preserve">
<value>Gallery feed filter:</value>
</data>
<data name="lclGalleryFilterNote.Text" xml:space="preserve">
<value>Please select items from the feed you would like to remove from the list of apps available to end-users.</value>
</data>
<data name="ClassicAspNet40PoolLocalize.Text" xml:space="preserve">
<value>ASP.NET 4.0 Classic:</value>
</data>

View file

@ -4,6 +4,7 @@
<%@ Register Src="../UserControls/EditDomainsList.ascx" TagName="EditDomainsList" TagPrefix="uc5" %>
<%@ Register Src="../UserControls/CollapsiblePanel.ascx" TagPrefix="wsp" TagName="CollapsiblePanel" %>
<%@ Register Src="../UserControls/PopupHeader.ascx" TagName="PopupHeader" TagPrefix="wsp" %>
<%@ Register src="../UserControls/EditFeedsList.ascx" tagname="EditFeedsList" tagprefix="uc6" %>
<fieldset>
<legend>
@ -117,29 +118,32 @@
</legend>
<br />
<table width="100%" cellpadding="4">
<tr>
<td class="Normal" valign="top" width="192">
<asp:Label ID="lblGalleryFeed" runat="server" meta:resourcekey="lblGalleryFeed" Text="Gallery feed URL:"></asp:Label>
</td>
<td class="Normal" valign="top">
<asp:TextBox ID="txtGalleryFeedUrl" runat="server" CssClass="NormalTextBox" Width="300px"></asp:TextBox>
<p style="text-align: justify;"><i><asp:Localize runat="server" meta:resourcekey="lclGalleryFeedNote" /></i></p>
</td>
</tr>
<tr>
<td class="Normal" valign="top" width="192">
<asp:Label ID="Label1" runat="server" meta:resourcekey="GalleryFeedFilter" Text="Gallery feed filter:"></asp:Label>
</td>
<td class="Normal" valign="top">
<asp:LinkButton runat="server" ID="FilterDialogButton" meta:resourcekey="FilterDialogButton" Text="Click to apply a filter..." />
</td>
</tr>
<tr>
<td colspan="2">
<asp:RadioButtonList ID="radioFilterAppsList" runat="server">
<asp:ListItem Value="Exclude">Exclude selected applications</asp:ListItem>
<asp:ListItem Value="Include">Include only selected applications</asp:ListItem>
</asp:RadioButtonList>
<br/>
<asp:Button runat="server" CssClass="Button1" ID="FilterDialogButton" Text="Change a filter" />
<br/><br/>
<asp:CheckBox ID="chkGalleryAppsAlwaysIgnoreDependencies" runat="server" meta:resourcekey="chkGalleryAppsAlwaysIgnoreDependencies" Text="Always ignore dependencies" />
</td>
</tr>
<tr>
<td class="SubHead" colspan="2">Custom feeds:</td>
</tr>
<tr>
<td colspan="2"><uc6:EditFeedsList ID="wpiEditFeedsList" runat="server" DisplayNames="false" /><br/></td>
</tr>
</table>
</fieldset>
<br />
@ -149,7 +153,6 @@
<wsp:PopupHeader runat="server" meta:resourcekey="popWebAppGalleryFilter" Text="Web Application Gallery Filter" />
<div class="Content">
<div class="Body">
<div style="padding: 5px 10px 5px 10px;"><asp:Localize ID="Localize1" runat="server" meta:resourcekey="lclGalleryFilterNote" /></div>
<div class="BorderFillBox" style="padding: 5px 5px 5px 5px; overflow-y: scroll; width: auto; height: 300px;">
<asp:CheckBoxList runat="server" ID="WebAppGalleryList" DataSourceID="WebAppGalleryListDS"
DataValueField="Id" DataTextField="Title" OnDataBound="WebAppGalleryList_DataBound">

View file

@ -109,7 +109,6 @@ namespace WebsitePanel.Portal.ProviderControls
txtAspNet11Pool.Text = settings["AspNet11Pool"];
txtAspNet20Pool.Text = settings["AspNet20Pool"];
txtAspNet40Pool.Text = settings["AspNet40Pool"];
txtGalleryFeedUrl.Text = settings["GalleryXmlFeedUrl"];
txtAspPath.Text = settings["AspPath"];
txtAspNet11Path.Text = settings["AspNet11Path"];
txtAspNet20Path.Text = settings["AspNet20Path"];
@ -130,8 +129,11 @@ namespace WebsitePanel.Portal.ProviderControls
sharedSslSites.Value = settings[PackageSettings.SHARED_SSL_SITES];
ActiveDirectoryIntegration.BindSettings(settings);
//
wpiEditFeedsList.Value = settings["FeedUrls"];
FilteredAppIds = settings["GalleryAppsFilter"];
radioFilterAppsList.SelectedIndex = Utils.ParseInt(settings["GalleryAppsFilterMode"], 0);
chkGalleryAppsAlwaysIgnoreDependencies.Checked = Utils.ParseBool(settings["GalleryAppsAlwaysIgnoreDependencies"], false);
}
@ -148,7 +150,6 @@ namespace WebsitePanel.Portal.ProviderControls
settings["AspNet11Path"] = txtAspNet11Path.Text.Trim();
settings["AspNet20Path"] = txtAspNet20Path.Text.Trim();
settings["AspNet40Path"] = txtAspNet40Path.Text.Trim();
settings["GalleryXmlFeedUrl"] = txtGalleryFeedUrl.Text.Trim();
settings["Php4Path"] = txtPhp4Path.Text.Trim();
settings["Php5Path"] = txtPhp5Path.Text.Trim();
settings["PerlPath"] = txtPerlPath.Text.Trim();
@ -166,7 +167,9 @@ namespace WebsitePanel.Portal.ProviderControls
ActiveDirectoryIntegration.SaveSettings(settings);
//
settings["FeedUrls"] = wpiEditFeedsList.Value;
settings["GalleryAppsFilter"] = GetAppsCatalogFilter();
settings["GalleryAppsFilterMode"] = radioFilterAppsList.SelectedIndex.ToString();
settings["GalleryAppsAlwaysIgnoreDependencies"] = chkGalleryAppsAlwaysIgnoreDependencies.Checked.ToString();
}
}

View file

@ -219,24 +219,6 @@ namespace WebsitePanel.Portal.ProviderControls {
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblWebAppGallery;
/// <summary>
/// lblGalleryFeed 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 lblGalleryFeed;
/// <summary>
/// txtGalleryFeedUrl 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 txtGalleryFeedUrl;
/// <summary>
/// Label1 control.
/// </summary>
@ -246,6 +228,15 @@ namespace WebsitePanel.Portal.ProviderControls {
/// </remarks>
protected global::System.Web.UI.WebControls.Label Label1;
/// <summary>
/// radioFilterAppsList 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.RadioButtonList radioFilterAppsList;
/// <summary>
/// FilterDialogButton control.
/// </summary>
@ -253,7 +244,7 @@ namespace WebsitePanel.Portal.ProviderControls {
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton FilterDialogButton;
protected global::System.Web.UI.WebControls.Button FilterDialogButton;
/// <summary>
/// chkGalleryAppsAlwaysIgnoreDependencies control.
@ -264,6 +255,15 @@ namespace WebsitePanel.Portal.ProviderControls {
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkGalleryAppsAlwaysIgnoreDependencies;
/// <summary>
/// wpiEditFeedsList control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.UserControls.EditFeedsList wpiEditFeedsList;
/// <summary>
/// FilterDialogPanel control.
/// </summary>
@ -273,15 +273,6 @@ namespace WebsitePanel.Portal.ProviderControls {
/// </remarks>
protected global::System.Web.UI.WebControls.Panel FilterDialogPanel;
/// <summary>
/// Localize1 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 Localize1;
/// <summary>
/// WebAppGalleryList control.
/// </summary>

View file

@ -188,39 +188,35 @@
<table width="100%" cellpadding="4">
<tr>
<td class="Normal" valign="top" width="192">
<asp:Label runat="server" meta:resourcekey="GalleryFeedFilter" Text="Gallery feed filter:"></asp:Label>
</td>
<td class="Normal" valign="top">
<asp:LinkButton runat="server" ID="FilterDialogButton" meta:resourcekey="FilterDialogButton" Text="Click to apply a filter..." />
<asp:RadioButtonList ID="radioFilterAppsList" runat="server">
<asp:ListItem Value="Exclude">Exclude selected applications</asp:ListItem>
<asp:ListItem Value="Include">Include only selected applications</asp:ListItem>
</asp:RadioButtonList>
<br/>
<asp:Button runat="server" CssClass="Button1" ID="FilterDialogButton" Text="Change a filter" />
<br/><br/>
<asp:CheckBox ID="chkGalleryAppsAlwaysIgnoreDependencies" runat="server" meta:resourcekey="chkGalleryAppsAlwaysIgnoreDependencies" Text="Always ignore dependencies" />
</td>
</tr>
<%-- <tr>
<td class="SubHead" style="width:200px;">Enable Microsoft feed</td>
<td class="Normal">
<asp:CheckBox ID="wpiMicrosoftFeed" runat="server" Text="Yes" Visible="false" />
</td>
<tr>
<td class="SubHead" colspan="2">Custom feeds:</td>
</tr>
<tr>
<td class="SubHead" style="width:200px;">Enable HeliconTech feed</td>
<td class="Normal">
<asp:CheckBox ID="wpiHeliconTechFeed" runat="server" Text="Yes" />
</td>
<td colspan="2"><uc6:EditFeedsList ID="wpiEditFeedsList" runat="server" DisplayNames="false" /><br/></td>
</tr>
--%>
</table>
<uc6:EditFeedsList ID="wpiEditFeedsList" runat="server" DisplayNames="false" />
<br/>
<asp:CheckBox ID="chkGalleryAppsAlwaysIgnoreDependencies" runat="server" meta:resourcekey="chkGalleryAppsAlwaysIgnoreDependencies" Text="Always ignore dependencies" />
</fieldset>
@ -233,7 +229,6 @@
DefaultButton="OkButton">
<wsp:PopupHeader runat="server" meta:resourcekey="popWebAppGalleryFilter" Text="Web Application Gallery Filter" />
<div class="Content">
<div style="padding: 5px 10px 5px 10px;"><asp:Localize runat="server" meta:resourcekey="lclGalleryFilterNote" /></div>
<div class="BorderFillBox" style="padding: 5px 5px 5px 5px; overflow-y: scroll; width: auto; height: 300px;">
<asp:CheckBoxList runat="server" ID="WebAppGalleryList" DataSourceID="WebAppGalleryListDS"
DataValueField="Id" DataTextField="Title" OnDataBound="WebAppGalleryList_DataBound">

View file

@ -130,10 +130,7 @@ namespace WebsitePanel.Portal.ProviderControls
// WPI
//wpiMicrosoftFeed.Checked = Utils.ParseBool(settings["FeedEnableMicrosoft"], true);
//wpiHeliconTechFeed.Checked = Utils.ParseBool(settings["FeedEnableHelicon"], true);
wpiEditFeedsList.Value = settings["FeedUrls"];
txtAspPath.Text = settings["AspPath"];
@ -187,7 +184,7 @@ namespace WebsitePanel.Portal.ProviderControls
//
Utils.SelectListItem(ddlWmSvcCredentialsMode, settings["WmSvc.CredentialsMode"]);
//
FilteredAppIds = settings["GalleryAppsFilter"];
//
if (String.IsNullOrEmpty(settings[WDeployEnabled]) == false)
{
@ -201,6 +198,12 @@ namespace WebsitePanel.Portal.ProviderControls
}
}
// WPI
//wpiMicrosoftFeed.Checked = Utils.ParseBool(settings["FeedEnableMicrosoft"], true);
//wpiHeliconTechFeed.Checked = Utils.ParseBool(settings["FeedEnableHelicon"], true);
wpiEditFeedsList.Value = settings["FeedUrls"];
FilteredAppIds = settings["GalleryAppsFilter"];
radioFilterAppsList.SelectedIndex = Utils.ParseInt(settings["GalleryAppsFilterMode"], 0);
chkGalleryAppsAlwaysIgnoreDependencies.Checked = Utils.ParseBool(settings["GalleryAppsAlwaysIgnoreDependencies"], false);
}
@ -253,10 +256,6 @@ namespace WebsitePanel.Portal.ProviderControls
//settings["FeedEnableMicrosoft"] = wpiMicrosoftFeed.Checked.ToString();
//settings["FeedEnableHelicon"] = wpiHeliconTechFeed.Checked.ToString();
settings["FeedUrls"] = wpiEditFeedsList.Value;
settings["GalleryAppsFilter"] = GetAppsCatalogFilter();
if (WDeployEnabledCheckBox.Checked)
{
@ -272,6 +271,11 @@ namespace WebsitePanel.Portal.ProviderControls
settings[WDeployEnabled] = Boolean.FalseString;
}
//settings["FeedEnableMicrosoft"] = wpiMicrosoftFeed.Checked.ToString();
//settings["FeedEnableHelicon"] = wpiHeliconTechFeed.Checked.ToString();
settings["FeedUrls"] = wpiEditFeedsList.Value;
settings["GalleryAppsFilter"] = GetAppsCatalogFilter();
settings["GalleryAppsFilterMode"] = radioFilterAppsList.SelectedIndex.ToString();
settings["GalleryAppsAlwaysIgnoreDependencies"] = chkGalleryAppsAlwaysIgnoreDependencies.Checked.ToString();
}

View file

@ -1,31 +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
// 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>
// This code was generated by a tool.
@ -319,6 +291,15 @@ namespace WebsitePanel.Portal.ProviderControls {
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblWebAppGallery;
/// <summary>
/// radioFilterAppsList 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.RadioButtonList radioFilterAppsList;
/// <summary>
/// FilterDialogButton control.
/// </summary>
@ -326,16 +307,7 @@ namespace WebsitePanel.Portal.ProviderControls {
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton FilterDialogButton;
/// <summary>
/// wpiEditFeedsList control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.UserControls.EditFeedsList wpiEditFeedsList;
protected global::System.Web.UI.WebControls.Button FilterDialogButton;
/// <summary>
/// chkGalleryAppsAlwaysIgnoreDependencies control.
@ -346,6 +318,15 @@ namespace WebsitePanel.Portal.ProviderControls {
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkGalleryAppsAlwaysIgnoreDependencies;
/// <summary>
/// wpiEditFeedsList control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.UserControls.EditFeedsList wpiEditFeedsList;
/// <summary>
/// FilterDialogPanel control.
/// </summary>