JBoss Portal SVN: r13736 - tags/Enterprise_Portal_Platform_4_3_GA_CP02/core-cms/src/main/org/jboss/portal/core/cms/ui/admin.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2009-08-11 08:41:46 -0400 (Tue, 11 Aug 2009)
New Revision: 13736
Modified:
tags/Enterprise_Portal_Platform_4_3_GA_CP02/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
Log:
JBEPP-106: Uploading file in CMSAdminPortlet failed in Internet Explorer
Modified: tags/Enterprise_Portal_Platform_4_3_GA_CP02/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
===================================================================
--- tags/Enterprise_Portal_Platform_4_3_GA_CP02/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2009-08-11 12:38:18 UTC (rev 13735)
+++ tags/Enterprise_Portal_Platform_4_3_GA_CP02/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2009-08-11 12:41:46 UTC (rev 13736)
@@ -994,7 +994,6 @@
if (!item.isFormField())
{
String sFilename = item.getName();
- sFilename = ParameterValidation.sanitizeFromPattern(sFilename, CHECK_FOR_XSS_PATTERN, "");
if (!"".equals(sFilename))
{
@@ -1009,6 +1008,8 @@
sFilename = sFilename.substring(backslashIndex + 1);
}
+ sFilename = ParameterValidation.sanitizeFromPattern(sFilename, CHECK_FOR_XSS_PATTERN, "");
+
File file = new FileImpl();
Content content = new ContentImpl();
16 years, 8 months
JBoss Portal SVN: r13735 - branches/Enterprise_Portal_Platform_4_3/core-cms/src/main/org/jboss/portal/core/cms/ui/admin.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2009-08-11 08:38:18 -0400 (Tue, 11 Aug 2009)
New Revision: 13735
Modified:
branches/Enterprise_Portal_Platform_4_3/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
Log:
JBEPP-106: Uploading file in CMSAdminPortlet failed in Internet Explorer
Modified: branches/Enterprise_Portal_Platform_4_3/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2009-08-11 11:31:06 UTC (rev 13734)
+++ branches/Enterprise_Portal_Platform_4_3/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2009-08-11 12:38:18 UTC (rev 13735)
@@ -994,7 +994,6 @@
if (!item.isFormField())
{
String sFilename = item.getName();
- sFilename = ParameterValidation.sanitizeFromPattern(sFilename, CHECK_FOR_XSS_PATTERN, "");
if (!"".equals(sFilename))
{
@@ -1009,6 +1008,8 @@
sFilename = sFilename.substring(backslashIndex + 1);
}
+ sFilename = ParameterValidation.sanitizeFromPattern(sFilename, CHECK_FOR_XSS_PATTERN, "");
+
File file = new FileImpl();
Content content = new ContentImpl();
16 years, 8 months
JBoss Portal SVN: r13734 - in tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src: main/org/jboss/portal/widget/google and 5 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2009-08-11 07:31:06 -0400 (Tue, 11 Aug 2009)
New Revision: 13734
Modified:
tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/exceptions/WidgetFailure.java
tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/google/GGWidget.java
tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/google/provider/GGProvider.java
tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/google/provider/GGQuery.java
tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/google/provider/GGWidgetInfoBuilder.java
tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/netvibes/directory/NVEcosystemFactory.java
tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/netvibes/directory/NVQueryResultMetaData.java
tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/netvibes/provider/NetvibesJSONInfoBuilder.java
tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/netvibes/provider/NetvibesQueryResultEntry.java
tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/resources/portal-widget-netvibes-war/WEB-INF/jsp/edit_content.jsp
tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/resources/portal-widget-war/WEB-INF/jsp/edit_content.jsp
Log:
JBEPP-109: Improved support for Google and Netvibes widgets (Workaround remote API changes/issues :-/)
Modified: tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/exceptions/WidgetFailure.java
===================================================================
--- tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/exceptions/WidgetFailure.java 2009-08-11 11:23:49 UTC (rev 13733)
+++ tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/exceptions/WidgetFailure.java 2009-08-11 11:31:06 UTC (rev 13734)
@@ -81,7 +81,7 @@
{
if (cause instanceof WidgetNotSupportedException)
{
- return "This widget type is not supported: "+ urlString;
+ return "This widget is not supported: "+ urlString;
}
else
if (cause instanceof WidgetFetchException)
Modified: tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/google/GGWidget.java
===================================================================
--- tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/google/GGWidget.java 2009-08-11 11:23:49 UTC (rev 13733)
+++ tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/google/GGWidget.java 2009-08-11 11:31:06 UTC (rev 13734)
@@ -107,7 +107,7 @@
if (info != null)
{
// Generate base params
- tmp.append("&synd=jboss");
+ tmp.append("&synd=open");
tmp.append("&w=").append(info.getWidth());
tmp.append("&h=").append(info.getHeight());
//don's let to override the title param - proper one will be picked up with i18n support
@@ -141,24 +141,9 @@
tmp.append("&up_").append(encoder.encode(prefName)).append("=").append(encoder.encode(value));
}
}
-
- //
- String clipper = "" +
- "(function(){\n" +
- "var a = document.getElementById('" + id + "');\n" +
- "var b = a.childNodes.item(2);\n" + // table
- "var c = b.childNodes.item(0);\n" + // tbody
- "var d = c.childNodes.item(0);\n" + // tr
- "var e = c.childNodes.item(1);\n" + // tr
- "var f = c.childNodes.item(3);\n" + // tr
- "c.removeChild(d);\n" +
- "c.removeChild(e);\n" +
- "c.removeChild(f);\n" +
- "})();";
-
+
return "<div id=\"" + id + "\">\n" +
"<script src=\"" + tmp + "\"></script>\n" +
- "<script>" + clipper + "</script>\n" +
"</div>\n";
}
else
Modified: tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/google/provider/GGProvider.java
===================================================================
--- tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/google/provider/GGProvider.java 2009-08-11 11:23:49 UTC (rev 13733)
+++ tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/google/provider/GGProvider.java 2009-08-11 11:31:06 UTC (rev 13734)
@@ -39,7 +39,9 @@
{
/** The google categories */
private static final Collection CATEGORIES = Collections.unmodifiableList((List)CollectionBuilder.arrayList()
- .add(new GGWidgetCategoryInfo("all", "Popular"))
+ .add(new GGWidgetCategoryInfo("", "All"))
+ .add(new GGWidgetCategoryInfo("featured", "Editor's picks"))
+ .add(new GGWidgetCategoryInfo("celebpicks", "Celebrity picks"))
.add(new GGWidgetCategoryInfo("news", "News"))
.add(new GGWidgetCategoryInfo("tools", "Tools"))
.add(new GGWidgetCategoryInfo("communication", "Communication"))
@@ -49,7 +51,6 @@
.add(new GGWidgetCategoryInfo("lifestyle", "Lifestyle"))
.add(new GGWidgetCategoryInfo("technology", "Technology"))
.add(new GGWidgetCategoryInfo("politics", "Politics"))
- .add(new GGWidgetCategoryInfo("new", "New stuff"))
.get());
public Collection getCategories()
Modified: tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/google/provider/GGQuery.java
===================================================================
--- tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/google/provider/GGQuery.java 2009-08-11 11:23:49 UTC (rev 13733)
+++ tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/google/provider/GGQuery.java 2009-08-11 11:31:06 UTC (rev 13734)
@@ -148,7 +148,7 @@
{
buffer.append("&num=").append(num);
}
- if (cat != null)
+ if (cat != null && !"".equals(cat))
{
buffer.append("&cat=").append(cat);
}
Modified: tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/google/provider/GGWidgetInfoBuilder.java
===================================================================
--- tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/google/provider/GGWidgetInfoBuilder.java 2009-08-11 11:23:49 UTC (rev 13733)
+++ tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/google/provider/GGWidgetInfoBuilder.java 2009-08-11 11:31:06 UTC (rev 13734)
@@ -43,6 +43,8 @@
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
@@ -57,6 +59,9 @@
import java.util.Map;
import java.util.HashMap;
import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
/**
* Build widget meta data from its URL.
@@ -176,7 +181,16 @@
}
catch (Exception e)
{
- throw new WidgetMetaDataParseException("Could not parse bundles.");
+ log.warn("The XML file: " + url.toString() + " could not be parsed correctly with the provided encoding, trying with ISO-8859-1");
+ try
+ {
+ bundleDocBuilder = factory.newDocumentBuilder();
+ bundleDoc = bundleDocBuilder.parse(new InputSource(new InputStreamReader(new ByteArrayInputStream(bundleBytes), "ISO-8859-1")));
+ }
+ catch (Exception e1)
+ {
+ throw new WidgetMetaDataParseException("Could not parse " + url.toString());
+ }
}
Element messagebundleElt = bundleDoc.getDocumentElement();
Modified: tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/netvibes/directory/NVEcosystemFactory.java
===================================================================
--- tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/netvibes/directory/NVEcosystemFactory.java 2009-08-11 11:23:49 UTC (rev 13733)
+++ tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/netvibes/directory/NVEcosystemFactory.java 2009-08-11 11:31:06 UTC (rev 13734)
@@ -82,6 +82,10 @@
{
meta.setPubDate(value);
}
+ else if ("type".equals(localName))
+ {
+ meta.setType(value);
+ }
}
}
Modified: tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/netvibes/directory/NVQueryResultMetaData.java
===================================================================
--- tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/netvibes/directory/NVQueryResultMetaData.java 2009-08-11 11:23:49 UTC (rev 13733)
+++ tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/netvibes/directory/NVQueryResultMetaData.java 2009-08-11 11:31:06 UTC (rev 13734)
@@ -42,6 +42,9 @@
private String guid;
/** . */
+ private String type;
+
+ /** . */
private String pubDate;
public String getTitle()
@@ -64,6 +67,16 @@
this.description = description;
}
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
public String getLink()
{
return link;
Modified: tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/netvibes/provider/NetvibesJSONInfoBuilder.java
===================================================================
--- tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/netvibes/provider/NetvibesJSONInfoBuilder.java 2009-08-11 11:23:49 UTC (rev 13733)
+++ tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/netvibes/provider/NetvibesJSONInfoBuilder.java 2009-08-11 11:31:06 UTC (rev 13734)
@@ -149,7 +149,7 @@
int version = metadata.getInt("apiVersion");
if (version < 1)
{
- throw new WidgetNotSupportedException("Not supported widget version.");
+ throw new WidgetNotSupportedException("Not supported widget version: " + url.toString());
}
// Netvibes preferences
Modified: tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/netvibes/provider/NetvibesQueryResultEntry.java
===================================================================
--- tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/netvibes/provider/NetvibesQueryResultEntry.java 2009-08-11 11:23:49 UTC (rev 13733)
+++ tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/main/org/jboss/portal/widget/netvibes/provider/NetvibesQueryResultEntry.java 2009-08-11 11:31:06 UTC (rev 13734)
@@ -44,11 +44,15 @@
/** . */
private URL url;
+ /** . */
+ private String type;
+
public NetvibesQueryResultEntry(NVQueryResultMetaData meta) throws MalformedURLException
{
this.title = meta.getTitle();
this.description = meta.getDescription();
this.url = new URL(meta.getLink());
+ this.type = meta.getType();
}
public String getDescription()
@@ -66,5 +70,10 @@
return this.url;
}
+ public String getType()
+ {
+ return this.type;
+ }
+
}
Modified: tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/resources/portal-widget-netvibes-war/WEB-INF/jsp/edit_content.jsp
===================================================================
--- tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/resources/portal-widget-netvibes-war/WEB-INF/jsp/edit_content.jsp 2009-08-11 11:23:49 UTC (rev 13733)
+++ tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/resources/portal-widget-netvibes-war/WEB-INF/jsp/edit_content.jsp 2009-08-11 11:31:06 UTC (rev 13734)
@@ -20,7 +20,8 @@
<%@page import="org.jboss.portal.widget.DirectoryQueryResult"%>
<%@page import="org.jboss.portal.widget.netvibes.provider.NetvibesQueryResult"%>
<%@page import="org.jboss.portal.widget.exceptions.DirectoryResultFailure"%>
-<p:defineObjects/>
+
+<%@page import="org.jboss.portal.widget.netvibes.provider.NetvibesQueryResultEntry"%><p:defineObjects/>
<div>
<%
NetvibesProvider provider = (NetvibesProvider)request.getAttribute("provider");
@@ -200,6 +201,7 @@
</tr>
</thead>
<%
+ int j=0;
for (IteratorStatus i = new IteratorStatus(queryResults.entries()); i.hasNext();)
{
if ( (i.getIndex() + 1) >= numberOfResults)
@@ -208,6 +210,12 @@
}
DirectoryQueryResultEntry result = (DirectoryQueryResultEntry) i.next();
+ NetvibesQueryResultEntry nvResult = (NetvibesQueryResultEntry)result;
+
+ // Netvibes API is broken and despite filtering on uwa some non-uwa widget get through, last chance to filter them out
+ if ("uwa".equals(nvResult.getType()))
+ {
+ j++;
boolean selected = false;
if ( selWidget != null
&& selWidget instanceof NetvibesWidget
@@ -233,18 +241,19 @@
selectURL.setParameter("numberOfResults", String.valueOf(numberOfResults));
//
- String rowClass = selected ? "portlet-section-selected" : (i.getIndex() % 2 == 0 ? "portlet-section-body" : "portlet-section-alternate");
+ String rowClass = selected ? "portlet-section-selected" : (j % 2 == 0 ? "portlet-section-body" : "portlet-section-alternate");
%>
<tr class="<%= rowClass %>">
<td>
+
<a
href="<%= selectURL %>"><%= (result.getTitle() != null) ? result.getTitle() : "Untitled" %>
</a>
</td>
</tr>
<%
- }
+ }}
if ( queryResults.resultSize() == 0 )
{
%><tr>
Modified: tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/resources/portal-widget-war/WEB-INF/jsp/edit_content.jsp
===================================================================
--- tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/resources/portal-widget-war/WEB-INF/jsp/edit_content.jsp 2009-08-11 11:23:49 UTC (rev 13733)
+++ tags/Enterprise_Portal_Platform_4_3_GA_CP02/widget/src/resources/portal-widget-war/WEB-INF/jsp/edit_content.jsp 2009-08-11 11:31:06 UTC (rev 13734)
@@ -65,7 +65,7 @@
String catTerm = request.getParameter("cat");
if (catTerm == null)
{
- catTerm = "all";
+ catTerm = "";
}
// Compute query
16 years, 8 months
JBoss Portal SVN: r13733 - in branches/Enterprise_Portal_Platform_4_3/widget/src: main/org/jboss/portal/widget/google and 5 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2009-08-11 07:23:49 -0400 (Tue, 11 Aug 2009)
New Revision: 13733
Modified:
branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/exceptions/WidgetFailure.java
branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/google/GGWidget.java
branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/google/provider/GGProvider.java
branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/google/provider/GGQuery.java
branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/google/provider/GGWidgetInfoBuilder.java
branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/netvibes/directory/NVEcosystemFactory.java
branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/netvibes/directory/NVQueryResultMetaData.java
branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/netvibes/provider/NetvibesJSONInfoBuilder.java
branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/netvibes/provider/NetvibesQueryResultEntry.java
branches/Enterprise_Portal_Platform_4_3/widget/src/resources/portal-widget-netvibes-war/WEB-INF/jsp/edit_content.jsp
branches/Enterprise_Portal_Platform_4_3/widget/src/resources/portal-widget-war/WEB-INF/jsp/edit_content.jsp
Log:
JBEPP-109: Improved support for Google and Netvibes widgets (Workaround remote API changes/issues :-/)
Modified: branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/exceptions/WidgetFailure.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/exceptions/WidgetFailure.java 2009-08-11 08:50:25 UTC (rev 13732)
+++ branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/exceptions/WidgetFailure.java 2009-08-11 11:23:49 UTC (rev 13733)
@@ -81,7 +81,7 @@
{
if (cause instanceof WidgetNotSupportedException)
{
- return "This widget type is not supported: "+ urlString;
+ return "This widget is not supported: "+ urlString;
}
else
if (cause instanceof WidgetFetchException)
Modified: branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/google/GGWidget.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/google/GGWidget.java 2009-08-11 08:50:25 UTC (rev 13732)
+++ branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/google/GGWidget.java 2009-08-11 11:23:49 UTC (rev 13733)
@@ -107,7 +107,7 @@
if (info != null)
{
// Generate base params
- tmp.append("&synd=jboss");
+ tmp.append("&synd=open");
tmp.append("&w=").append(info.getWidth());
tmp.append("&h=").append(info.getHeight());
//don's let to override the title param - proper one will be picked up with i18n support
@@ -141,24 +141,9 @@
tmp.append("&up_").append(encoder.encode(prefName)).append("=").append(encoder.encode(value));
}
}
-
- //
- String clipper = "" +
- "(function(){\n" +
- "var a = document.getElementById('" + id + "');\n" +
- "var b = a.childNodes.item(2);\n" + // table
- "var c = b.childNodes.item(0);\n" + // tbody
- "var d = c.childNodes.item(0);\n" + // tr
- "var e = c.childNodes.item(1);\n" + // tr
- "var f = c.childNodes.item(3);\n" + // tr
- "c.removeChild(d);\n" +
- "c.removeChild(e);\n" +
- "c.removeChild(f);\n" +
- "})();";
-
+
return "<div id=\"" + id + "\">\n" +
"<script src=\"" + tmp + "\"></script>\n" +
- "<script>" + clipper + "</script>\n" +
"</div>\n";
}
else
Modified: branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/google/provider/GGProvider.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/google/provider/GGProvider.java 2009-08-11 08:50:25 UTC (rev 13732)
+++ branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/google/provider/GGProvider.java 2009-08-11 11:23:49 UTC (rev 13733)
@@ -39,7 +39,9 @@
{
/** The google categories */
private static final Collection CATEGORIES = Collections.unmodifiableList((List)CollectionBuilder.arrayList()
- .add(new GGWidgetCategoryInfo("all", "Popular"))
+ .add(new GGWidgetCategoryInfo("", "All"))
+ .add(new GGWidgetCategoryInfo("featured", "Editor's picks"))
+ .add(new GGWidgetCategoryInfo("celebpicks", "Celebrity picks"))
.add(new GGWidgetCategoryInfo("news", "News"))
.add(new GGWidgetCategoryInfo("tools", "Tools"))
.add(new GGWidgetCategoryInfo("communication", "Communication"))
@@ -49,7 +51,6 @@
.add(new GGWidgetCategoryInfo("lifestyle", "Lifestyle"))
.add(new GGWidgetCategoryInfo("technology", "Technology"))
.add(new GGWidgetCategoryInfo("politics", "Politics"))
- .add(new GGWidgetCategoryInfo("new", "New stuff"))
.get());
public Collection getCategories()
Modified: branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/google/provider/GGQuery.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/google/provider/GGQuery.java 2009-08-11 08:50:25 UTC (rev 13732)
+++ branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/google/provider/GGQuery.java 2009-08-11 11:23:49 UTC (rev 13733)
@@ -148,7 +148,7 @@
{
buffer.append("&num=").append(num);
}
- if (cat != null)
+ if (cat != null && !"".equals(cat))
{
buffer.append("&cat=").append(cat);
}
Modified: branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/google/provider/GGWidgetInfoBuilder.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/google/provider/GGWidgetInfoBuilder.java 2009-08-11 08:50:25 UTC (rev 13732)
+++ branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/google/provider/GGWidgetInfoBuilder.java 2009-08-11 11:23:49 UTC (rev 13733)
@@ -43,6 +43,8 @@
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
@@ -57,6 +59,9 @@
import java.util.Map;
import java.util.HashMap;
import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
/**
* Build widget meta data from its URL.
@@ -176,7 +181,16 @@
}
catch (Exception e)
{
- throw new WidgetMetaDataParseException("Could not parse bundles.");
+ log.warn("The XML file: " + url.toString() + " could not be parsed correctly with the provided encoding, trying with ISO-8859-1");
+ try
+ {
+ bundleDocBuilder = factory.newDocumentBuilder();
+ bundleDoc = bundleDocBuilder.parse(new InputSource(new InputStreamReader(new ByteArrayInputStream(bundleBytes), "ISO-8859-1")));
+ }
+ catch (Exception e1)
+ {
+ throw new WidgetMetaDataParseException("Could not parse " + url.toString());
+ }
}
Element messagebundleElt = bundleDoc.getDocumentElement();
Modified: branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/netvibes/directory/NVEcosystemFactory.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/netvibes/directory/NVEcosystemFactory.java 2009-08-11 08:50:25 UTC (rev 13732)
+++ branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/netvibes/directory/NVEcosystemFactory.java 2009-08-11 11:23:49 UTC (rev 13733)
@@ -82,6 +82,10 @@
{
meta.setPubDate(value);
}
+ else if ("type".equals(localName))
+ {
+ meta.setType(value);
+ }
}
}
Modified: branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/netvibes/directory/NVQueryResultMetaData.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/netvibes/directory/NVQueryResultMetaData.java 2009-08-11 08:50:25 UTC (rev 13732)
+++ branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/netvibes/directory/NVQueryResultMetaData.java 2009-08-11 11:23:49 UTC (rev 13733)
@@ -42,6 +42,9 @@
private String guid;
/** . */
+ private String type;
+
+ /** . */
private String pubDate;
public String getTitle()
@@ -64,6 +67,16 @@
this.description = description;
}
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
public String getLink()
{
return link;
Modified: branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/netvibes/provider/NetvibesJSONInfoBuilder.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/netvibes/provider/NetvibesJSONInfoBuilder.java 2009-08-11 08:50:25 UTC (rev 13732)
+++ branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/netvibes/provider/NetvibesJSONInfoBuilder.java 2009-08-11 11:23:49 UTC (rev 13733)
@@ -149,7 +149,7 @@
int version = metadata.getInt("apiVersion");
if (version < 1)
{
- throw new WidgetNotSupportedException("Not supported widget version.");
+ throw new WidgetNotSupportedException("Not supported widget version: " + url.toString());
}
// Netvibes preferences
Modified: branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/netvibes/provider/NetvibesQueryResultEntry.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/netvibes/provider/NetvibesQueryResultEntry.java 2009-08-11 08:50:25 UTC (rev 13732)
+++ branches/Enterprise_Portal_Platform_4_3/widget/src/main/org/jboss/portal/widget/netvibes/provider/NetvibesQueryResultEntry.java 2009-08-11 11:23:49 UTC (rev 13733)
@@ -44,11 +44,15 @@
/** . */
private URL url;
+ /** . */
+ private String type;
+
public NetvibesQueryResultEntry(NVQueryResultMetaData meta) throws MalformedURLException
{
this.title = meta.getTitle();
this.description = meta.getDescription();
this.url = new URL(meta.getLink());
+ this.type = meta.getType();
}
public String getDescription()
@@ -66,5 +70,10 @@
return this.url;
}
+ public String getType()
+ {
+ return this.type;
+ }
+
}
Modified: branches/Enterprise_Portal_Platform_4_3/widget/src/resources/portal-widget-netvibes-war/WEB-INF/jsp/edit_content.jsp
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/widget/src/resources/portal-widget-netvibes-war/WEB-INF/jsp/edit_content.jsp 2009-08-11 08:50:25 UTC (rev 13732)
+++ branches/Enterprise_Portal_Platform_4_3/widget/src/resources/portal-widget-netvibes-war/WEB-INF/jsp/edit_content.jsp 2009-08-11 11:23:49 UTC (rev 13733)
@@ -20,7 +20,8 @@
<%@page import="org.jboss.portal.widget.DirectoryQueryResult"%>
<%@page import="org.jboss.portal.widget.netvibes.provider.NetvibesQueryResult"%>
<%@page import="org.jboss.portal.widget.exceptions.DirectoryResultFailure"%>
-<p:defineObjects/>
+
+<%@page import="org.jboss.portal.widget.netvibes.provider.NetvibesQueryResultEntry"%><p:defineObjects/>
<div>
<%
NetvibesProvider provider = (NetvibesProvider)request.getAttribute("provider");
@@ -200,6 +201,7 @@
</tr>
</thead>
<%
+ int j=0;
for (IteratorStatus i = new IteratorStatus(queryResults.entries()); i.hasNext();)
{
if ( (i.getIndex() + 1) >= numberOfResults)
@@ -208,6 +210,12 @@
}
DirectoryQueryResultEntry result = (DirectoryQueryResultEntry) i.next();
+ NetvibesQueryResultEntry nvResult = (NetvibesQueryResultEntry)result;
+
+ // Netvibes API is broken and despite filtering on uwa some non-uwa widget get through, last chance to filter them out
+ if ("uwa".equals(nvResult.getType()))
+ {
+ j++;
boolean selected = false;
if ( selWidget != null
&& selWidget instanceof NetvibesWidget
@@ -233,18 +241,19 @@
selectURL.setParameter("numberOfResults", String.valueOf(numberOfResults));
//
- String rowClass = selected ? "portlet-section-selected" : (i.getIndex() % 2 == 0 ? "portlet-section-body" : "portlet-section-alternate");
+ String rowClass = selected ? "portlet-section-selected" : (j % 2 == 0 ? "portlet-section-body" : "portlet-section-alternate");
%>
<tr class="<%= rowClass %>">
<td>
+
<a
href="<%= selectURL %>"><%= (result.getTitle() != null) ? result.getTitle() : "Untitled" %>
</a>
</td>
</tr>
<%
- }
+ }}
if ( queryResults.resultSize() == 0 )
{
%><tr>
Modified: branches/Enterprise_Portal_Platform_4_3/widget/src/resources/portal-widget-war/WEB-INF/jsp/edit_content.jsp
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/widget/src/resources/portal-widget-war/WEB-INF/jsp/edit_content.jsp 2009-08-11 08:50:25 UTC (rev 13732)
+++ branches/Enterprise_Portal_Platform_4_3/widget/src/resources/portal-widget-war/WEB-INF/jsp/edit_content.jsp 2009-08-11 11:23:49 UTC (rev 13733)
@@ -65,7 +65,7 @@
String catTerm = request.getParameter("cat");
if (catTerm == null)
{
- catTerm = "all";
+ catTerm = "";
}
// Compute query
16 years, 8 months
JBoss Portal SVN: r13732 - tags/Enterprise_Portal_Platform_4_3_GA_CP02/testsuite/ui-tests/src/org/jboss/portal/test/selenium.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2009-08-11 04:50:25 -0400 (Tue, 11 Aug 2009)
New Revision: 13732
Modified:
tags/Enterprise_Portal_Platform_4_3_GA_CP02/testsuite/ui-tests/src/org/jboss/portal/test/selenium/assert.properties
Log:
[selenium] - longer timeout
Modified: tags/Enterprise_Portal_Platform_4_3_GA_CP02/testsuite/ui-tests/src/org/jboss/portal/test/selenium/assert.properties
===================================================================
--- tags/Enterprise_Portal_Platform_4_3_GA_CP02/testsuite/ui-tests/src/org/jboss/portal/test/selenium/assert.properties 2009-08-10 22:25:24 UTC (rev 13731)
+++ tags/Enterprise_Portal_Platform_4_3_GA_CP02/testsuite/ui-tests/src/org/jboss/portal/test/selenium/assert.properties 2009-08-11 08:50:25 UTC (rev 13732)
@@ -1,5 +1,5 @@
-selenium.timeout.page=320000
-selenium.timeout.ajax=10000
+selenium.timeout.page=420000
+selenium.timeout.ajax=15000
selenium.timeout.elem=320
portal.xxs.1=/Dave</option><script>alert(document.cookie);</script>
16 years, 8 months
JBoss Portal SVN: r13731 - in jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java: org/exoplatform/portal/config/jcr and 1 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2009-08-10 18:25:24 -0400 (Mon, 10 Aug 2009)
New Revision: 13731
Added:
jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/hibernate.cfg.xml
Modified:
jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/jcr/DataStorageImpl.java
jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/org/exoplatform/portal/jboss/security/components/ExoRoles.java
Log:
trying to make security framework integration completely seamless
* goal is to switch between framework vs non-framework mode with a simple true/false status in configuration
* switch should automagically also take care of Policy Repository State Integrity
Added: jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/hibernate.cfg.xml
===================================================================
--- jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/hibernate.cfg.xml (rev 0)
+++ jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/hibernate.cfg.xml 2009-08-10 22:25:24 UTC (rev 13731)
@@ -0,0 +1,59 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+ <session-factory>
+ <!-- Database connection settings -->
+ <property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
+ <property name="connection.url">jdbc:hsqldb:file:target/testdb</property>
+ <property name="connection.username">sa</property>
+ <property name="connection.password"></property>
+
+ <!-- JDBC connection pool (use the built-in) -->
+ <property name="connection.pool_size">1</property>
+
+ <!-- SQL dialect -->
+ <property name="dialect">org.hibernate.dialect.HSQLDialect</property>
+
+ <!-- Enable Hibernate's automatic session context management -->
+ <property name="current_session_context_class">thread</property>
+
+ <!-- Disable the second-level cache -->
+ <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
+
+ <!-- Echo all executed SQL to stdout -->
+ <property name="show_sql">false</property>
+
+ <!--
+ Drop and re-create the database schema on startup
+ -->
+ <property name="hbm2ddl.auto">create</property>
+
+ <mapping resource="policy.hbm.xml"/>
+ </session-factory>
+</hibernate-configuration>
\ No newline at end of file
Modified: jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/jcr/DataStorageImpl.java
===================================================================
--- jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/jcr/DataStorageImpl.java 2009-08-10 22:22:41 UTC (rev 13730)
+++ jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/jcr/DataStorageImpl.java 2009-08-10 22:25:24 UTC (rev 13731)
@@ -92,7 +92,7 @@
private ExoPolicyProvisioner getPolicyProvisioner()
{
- if(this.policyProvisioner == null)
+ if(ServiceContainer.isActive() && this.policyProvisioner == null)
{
this.policyProvisioner = (ExoPolicyProvisioner)ServiceContainer.lookup("/exo/jboss/PolicyProvisioner");
}
@@ -119,8 +119,11 @@
listenerService.broadcast(CREATE_PORTAL_EVENT,this,config);
}
finally {
- sessionProvider.close() ;
- this.getPolicyProvisioner().provision(config);
+ sessionProvider.close() ;
+ if(ServiceContainer.isActive())
+ {
+ this.getPolicyProvisioner().provision(config);
+ }
}
}
@@ -182,8 +185,11 @@
regService_.createEntry(sessionProvider, pageSetPath, pageEntry) ;
}
finally {
- sessionProvider.close() ;
- this.getPolicyProvisioner().provision(page);
+ sessionProvider.close() ;
+ if(ServiceContainer.isActive())
+ {
+ this.getPolicyProvisioner().provision(page);
+ }
}
}
@@ -248,8 +254,11 @@
regService_.createEntry(sessionProvider, appRegPath, NavigationEntry) ;
}
finally {
- sessionProvider.close() ;
- this.getPolicyProvisioner().provision(navigation);
+ sessionProvider.close() ;
+ if(ServiceContainer.isActive())
+ {
+ this.getPolicyProvisioner().provision(navigation);
+ }
}
}
Modified: jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/org/exoplatform/portal/jboss/security/components/ExoRoles.java
===================================================================
--- jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/org/exoplatform/portal/jboss/security/components/ExoRoles.java 2009-08-10 22:22:41 UTC (rev 13730)
+++ jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/org/exoplatform/portal/jboss/security/components/ExoRoles.java 2009-08-10 22:25:24 UTC (rev 13731)
@@ -111,7 +111,7 @@
try
{
reader = new BufferedReader(new InputStreamReader(Thread.currentThread()
- .getContextClassLoader().getSystemResourceAsStream(
+ .getContextClassLoader().getResourceAsStream(
"META-INF/exo-roles-component.properties")));
String buffer = null;
StringBuilder builder = new StringBuilder();
@@ -148,7 +148,7 @@
try
{
reader = new BufferedReader(new InputStreamReader(Thread.currentThread()
- .getContextClassLoader().getSystemResourceAsStream(
+ .getContextClassLoader().getResourceAsStream(
"META-INF/exo-roles-component-mustmatchall.properties")));
String buffer = null;
StringBuilder builder = new StringBuilder();
16 years, 8 months
JBoss Portal SVN: r13730 - modules/authorization/trunk/common-api/src/main/java/org/jboss/security/authz/bootstrap.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2009-08-10 18:22:41 -0400 (Mon, 10 Aug 2009)
New Revision: 13730
Modified:
modules/authorization/trunk/common-api/src/main/java/org/jboss/security/authz/bootstrap/ServiceContainer.java
Log:
ServiceContainer status check added
Modified: modules/authorization/trunk/common-api/src/main/java/org/jboss/security/authz/bootstrap/ServiceContainer.java
===================================================================
--- modules/authorization/trunk/common-api/src/main/java/org/jboss/security/authz/bootstrap/ServiceContainer.java 2009-08-10 20:57:48 UTC (rev 13729)
+++ modules/authorization/trunk/common-api/src/main/java/org/jboss/security/authz/bootstrap/ServiceContainer.java 2009-08-10 22:22:41 UTC (rev 13730)
@@ -90,4 +90,9 @@
{
bootstrap.deployer.shutdown();
}
+
+ public static boolean isActive()
+ {
+ return (kernel != null && bootstrap != null);
+ }
}
16 years, 8 months
JBoss Portal SVN: r13729 - jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2009-08-10 16:57:48 -0400 (Mon, 10 Aug 2009)
New Revision: 13729
Modified:
jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/pom.xml
Log:
turning off tests
Modified: jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/pom.xml
===================================================================
--- jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/pom.xml 2009-08-10 20:22:36 UTC (rev 13728)
+++ jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/pom.xml 2009-08-10 20:57:48 UTC (rev 13729)
@@ -195,7 +195,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <skip>false</skip>
+ <skip>true</skip>
</configuration>
</plugin>
</plugins>
16 years, 8 months
JBoss Portal SVN: r13728 - modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/plugin.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2009-08-10 16:22:36 -0400 (Mon, 10 Aug 2009)
New Revision: 13728
Modified:
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/plugin/DroolsRuleManager.java
Log:
adding Function Support to Drools Plugin
Modified: modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/plugin/DroolsRuleManager.java
===================================================================
--- modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/plugin/DroolsRuleManager.java 2009-08-10 20:21:18 UTC (rev 13727)
+++ modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/plugin/DroolsRuleManager.java 2009-08-10 20:22:36 UTC (rev 13728)
@@ -40,6 +40,7 @@
import org.jboss.security.authz.model.DroolsRuleExpression;
import org.jboss.security.authz.policy.server.tools.HibernateService;
+import org.jboss.security.authz.tools.GeneralTool;
/**
* This service provides management for Drools based authorization Rules/Logic
@@ -198,6 +199,13 @@
for (String drl : this.drls.values())
{
+ //Preprocess drl file before injecting into the RuleEngine
+ if(drl.contains("<function>"))
+ {
+ drl = drl.replaceAll("<function>", "evaluateFunctionBody"+Math.abs(GeneralTool.generateUniqueId().hashCode()));
+ }
+
+
buffer.append(drl + "\n");
}
16 years, 8 months
JBoss Portal SVN: r13727 - in jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java: org/exoplatform/portal/jboss/security/components and 1 other directory.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2009-08-10 16:21:18 -0400 (Mon, 10 Aug 2009)
New Revision: 13727
Modified:
jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/META-INF/exo-roles-component-mustmatchall.properties
jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/META-INF/exo-roles-component.properties
jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/org/exoplatform/portal/jboss/security/components/ExoRoles.java
Log:
Integrating the custom ExoRoles Security Component
Modified: jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/META-INF/exo-roles-component-mustmatchall.properties
===================================================================
--- jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/META-INF/exo-roles-component-mustmatchall.properties 2009-08-10 20:16:28 UTC (rev 13726)
+++ jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/META-INF/exo-roles-component-mustmatchall.properties 2009-08-10 20:21:18 UTC (rev 13727)
@@ -1,7 +1,7 @@
import java.util.Set
import java.util.HashSet
-function boolean <evaluateMembership>(Set userRoles)
+function boolean <function>(Set userRoles)
{
String[] allowedRoles = new String[]{<roleList>};
@@ -64,7 +64,7 @@
$ruleName: String()
$roles: HashSet()
eval($ruleName.contains("<ruleReference>"))
-eval(<evaluateMembership>($roles))
+eval(<function>($roles))
then
insert(Boolean.TRUE);
Modified: jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/META-INF/exo-roles-component.properties
===================================================================
--- jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/META-INF/exo-roles-component.properties 2009-08-10 20:16:28 UTC (rev 13726)
+++ jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/META-INF/exo-roles-component.properties 2009-08-10 20:21:18 UTC (rev 13727)
@@ -1,7 +1,7 @@
import java.util.Set
import java.util.HashSet
-function boolean <evaluateMembership>(Set userRoles)
+function boolean <function>(Set userRoles)
{
String[] allowedRoles = new String[]{<roleList>};
@@ -64,7 +64,7 @@
$ruleName: String()
$roles: HashSet()
eval($ruleName.contains("<ruleReference>"))
-eval(<evaluateMembership>($roles))
+eval(<function>($roles))
then
insert(Boolean.TRUE);
Modified: jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/org/exoplatform/portal/jboss/security/components/ExoRoles.java
===================================================================
--- jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/org/exoplatform/portal/jboss/security/components/ExoRoles.java 2009-08-10 20:16:28 UTC (rev 13726)
+++ jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/org/exoplatform/portal/jboss/security/components/ExoRoles.java 2009-08-10 20:21:18 UTC (rev 13727)
@@ -40,97 +40,142 @@
@Component(name = "exo-roles", type = ComponentType.LOGIC, category = ComponentCategory.SUBJECT)
public class ExoRoles extends Roles
{
- private String logicExpression;
- private String logicExpressionMustMatchAll;
-
+ private static String logicExpression;
+ private static String logicExpressionMustMatchAll;
+
+ static
+ {
+ ExoRoles.loadLogicExpression();
+ ExoRoles.loadLogicExpressionMustMatchAll();
+ }
+
public ExoRoles()
{
+ }
+
+ @LogicExpression
+ public String[] allowExpression()
+ {
+ String ruleReference = "roles://allowRule/"
+ + GeneralTool.generateUniqueId();
+
+ // Generate a Drools Rule Expression
+ String ruleLogic = this.generateRuleLogic();
+ ruleLogic = ruleLogic.replaceAll("<ruleReference>", ruleReference);
+
+ return new String[] { ruleReference, ruleLogic };
+ }
+
+ @LogicExpression
+ public String[] denyExpression()
+ {
+ String ruleReference = "roles://denyRule/"
+ + GeneralTool.generateUniqueId();
+
+ // Generate a Drools Rule Expression
+ String ruleLogic = this.generateRuleLogic();
+ ruleLogic = ruleLogic.replaceAll("<ruleReference>", ruleReference);
+
+ return new String[] { ruleReference, ruleLogic };
+ }
+
+ private String generateRuleLogic()
+ {
+ // Generate a Drools Rule Expression
+ StringBuilder buffer = new StringBuilder();
+ for (String role : this.getNames())
+ {
+ buffer.append("\"" + role.toLowerCase() + "\"");
+ buffer.append(",");
+ }
+ String roleList = buffer.toString().trim();
+ roleList = roleList.substring(0, roleList.lastIndexOf(','));
+
+ String ruleLogic = null;
+ if (!this.mustMatchAll)
+ {
+ ruleLogic = this.logicExpression.replaceAll("<roleList>", roleList);
+ }
+ else
+ {
+ ruleLogic = this.logicExpressionMustMatchAll.replaceAll("<roleList>",
+ roleList);
+ }
+ return ruleLogic;
+ }
+
+ // -------------------------------------------------------------------------------------------------------------------------------------------
+ private static void loadLogicExpression()
+ {
BufferedReader reader = null;
try
{
reader = new BufferedReader(new InputStreamReader(Thread.currentThread()
- .getContextClassLoader().getSystemResourceAsStream(
- "META-INF/exo-roles-component.properties")));
+ .getContextClassLoader().getSystemResourceAsStream(
+ "META-INF/exo-roles-component.properties")));
String buffer = null;
StringBuilder builder = new StringBuilder();
- while((buffer=reader.readLine()) != null)
+ while ((buffer = reader.readLine()) != null)
{
builder.append(buffer);
builder.append("\n");
}
-
- this.logicExpression = builder.toString().trim();
+
+ logicExpression = builder.toString().trim();
}
- catch(IOException ioe)
+ catch (IOException ioe)
{
throw new RuntimeException(ioe);
}
finally
{
- if(reader != null)
+ if (reader != null)
{
- try{reader.close();}catch(IOException ioe){}
+ try
+ {
+ reader.close();
+ }
+ catch (IOException ioe)
+ {
+ }
}
}
-
+ }
+
+ private static void loadLogicExpressionMustMatchAll()
+ {
+ BufferedReader reader = null;
try
{
reader = new BufferedReader(new InputStreamReader(Thread.currentThread()
- .getContextClassLoader().getSystemResourceAsStream(
- "META-INF/exo-roles-component-mustmatchall.properties")));
+ .getContextClassLoader().getSystemResourceAsStream(
+ "META-INF/exo-roles-component-mustmatchall.properties")));
String buffer = null;
StringBuilder builder = new StringBuilder();
- while((buffer=reader.readLine()) != null)
+ while ((buffer = reader.readLine()) != null)
{
builder.append(buffer);
builder.append("\n");
}
-
- this.logicExpressionMustMatchAll = builder.toString().trim();
+
+ logicExpressionMustMatchAll = builder.toString().trim();
}
- catch(IOException ioe)
+ catch (IOException ioe)
{
throw new RuntimeException(ioe);
}
finally
{
- if(reader != null)
+ if (reader != null)
{
- try{reader.close();}catch(IOException ioe){}
+ try
+ {
+ reader.close();
+ }
+ catch (IOException ioe)
+ {
+ }
}
}
}
-
- @LogicExpression
- public String[] allowExpression()
- {
- String ruleReference = "roles://allowRule/"
- + GeneralTool.generateUniqueId();
-
- // Generate a Drools Rule Expression
- StringBuilder buffer = new StringBuilder();
- for (String role : this.getNames())
- {
- buffer.append("\""+role.toLowerCase()+"\"");
- buffer.append(",");
- }
- String roleList = buffer.toString().trim();
- roleList = roleList.substring(0, roleList.lastIndexOf(','));
-
- try{Thread.currentThread().sleep(10);}catch(Exception e){}
-
- String ruleLogic = null;
- if(!this.mustMatchAll)
- {
- ruleLogic = this.logicExpression.replaceAll("<roleList>", roleList);
- }
- else
- {
- ruleLogic = this.logicExpressionMustMatchAll.replaceAll("<roleList>", roleList);
- }
- ruleLogic = ruleLogic.replaceAll("<ruleReference>", ruleReference);
- ruleLogic = ruleLogic.replaceAll("<evaluateMembership>", "evaluateMembership"+System.currentTimeMillis());
-
- return new String[] { ruleReference, ruleLogic };
- }
}
16 years, 8 months