[seam-commits] Seam SVN: r7443 - in trunk/examples/wiki: src/main/org/jboss/seam/wiki/util and 2 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Tue Feb 19 08:42:58 EST 2008
Author: christian.bauer at jboss.com
Date: 2008-02-19 08:42:58 -0500 (Tue, 19 Feb 2008)
New Revision: 7443
Modified:
trunk/examples/wiki/src/etc/i18n/messages_en.properties
trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java
trunk/examples/wiki/view/includes/ownerSelector.xhtml
trunk/examples/wiki/view/userList_d.xhtml
Log:
Do not show supersecret e-mail addresses to non-admins
Modified: trunk/examples/wiki/src/etc/i18n/messages_en.properties
===================================================================
--- trunk/examples/wiki/src/etc/i18n/messages_en.properties 2008-02-19 13:42:29 UTC (rev 7442)
+++ trunk/examples/wiki/src/etc/i18n/messages_en.properties 2008-02-19 13:42:58 UTC (rev 7443)
@@ -689,7 +689,7 @@
lacewiki.preferences.wiki.FeedTitlePrefix=Feed title prefix
lacewiki.preferences.wiki.PurgeFeedEntriesAfterDays=Feed entries are purged after days
lacewiki.preferences.wiki.AtSymbolReplacement=Replace @ symbol in e-mail addresses with
-lacewiki.preferences.wiki.ShowEmailToLoggedInOnly=Show e-mail addresses only to logged-in users
+lacewiki.preferences.wiki.ShowEmailToLoggedInOnly=Show e-mail addresses only to logged-in admins
lacewiki.preferences.wiki.MainMenuLevels=Main menu is flattened to levels (0 for unlimited visible levels)
lacewiki.preferences.wiki.MainMenuDepth=Main menu maximum depth of directories
lacewiki.preferences.wiki.MainMenuShowAdminOnly=Main menu includes only directories owned by system administrator
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java 2008-02-19 13:42:29 UTC (rev 7442)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java 2008-02-19 13:42:58 UTC (rev 7443)
@@ -23,6 +23,7 @@
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.net.URLDecoder;
+import java.net.URI;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Collections;
@@ -119,7 +120,10 @@
}
public static boolean showEmailAddress() {
- if (Preferences.getInstance(WikiPreferences.class).isShowEmailToLoggedInOnly() && Identity.instance().isLoggedIn()) {
+ Integer accessLevel = (Integer)Component.getInstance("currentAccessLevel");
+ if (Preferences.getInstance(WikiPreferences.class).isShowEmailToLoggedInOnly()
+ && Identity.instance().isLoggedIn()
+ && accessLevel == Role.ADMINROLE_ACCESSLEVEL) {
return true;
} else if (!Preferences.getInstance(WikiPreferences.class).isShowEmailToLoggedInOnly()) {
return true;
@@ -313,4 +317,24 @@
return FacesContext.getCurrentInstance().getMessages(namingContainer.replaceAll("\\\\", "") + ":" + componentId).hasNext();
}
+ /**
+ * Calculate an RFC 2822 compliant message identifier from a numeric + string identifier. Given
+ * the same numeric and string identifier, the same message id will be generated.
+ */
+ public static String calculateMessageId(Long id, String s) {
+
+ WikiPreferences prefs = Preferences.getInstance(WikiPreferences.class);
+ Hash hash = (Hash)Component.getInstance(Hash.class);
+ String domain;
+ try {
+ URI uri = new URI(prefs.getBaseUrl());
+ domain = uri.getHost();
+ } catch (Exception ex) {
+ throw new RuntimeException("Could not parse preferences value baseUrl into a host name", ex);
+ }
+ StringBuilder msgId = new StringBuilder();
+ msgId.append("<").append(hash.hash(id+s)).append("@").append(domain).append(">");
+ return msgId.toString();
+ }
+
}
Modified: trunk/examples/wiki/view/includes/ownerSelector.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/ownerSelector.xhtml 2008-02-19 13:42:29 UTC (rev 7442)
+++ trunk/examples/wiki/view/includes/ownerSelector.xhtml 2008-02-19 13:42:58 UTC (rev 7443)
@@ -50,8 +50,10 @@
</h:panelGroup>
<h:panelGroup>
- <h:outputText styleClass="label" value="#{messages['lacewiki.label.userList.Email']}:"/> 
- <h:inputText id="email" value="#{userSearch.exampleUser.email}" maxlength="35" size="10" tabindex="20"/>
+ <s:fragment rendered="#{wiki:showEmailAddress()}">
+ <h:outputText styleClass="label" value="#{messages['lacewiki.label.userList.Email']}:"/> 
+ <h:inputText id="email" value="#{userSearch.exampleUser.email}" maxlength="35" size="10" tabindex="20"/>
+ </s:fragment>
</h:panelGroup>
<a:commandLink id="find" styleClass="buttonNonpersistent sessionEventTrigger" reRender="dialogOwnerSelectionContent"
Modified: trunk/examples/wiki/view/userList_d.xhtml
===================================================================
--- trunk/examples/wiki/view/userList_d.xhtml 2008-02-19 13:42:29 UTC (rev 7442)
+++ trunk/examples/wiki/view/userList_d.xhtml 2008-02-19 13:42:58 UTC (rev 7443)
@@ -64,8 +64,10 @@
</h:panelGroup>
<h:panelGroup>
- <h:outputText styleClass="label" value="#{messages['lacewiki.label.userList.Email']}:"/> 
- <h:inputText id="email" value="#{userSearch.exampleUser.email}" maxlength="35" size="8" tabindex="1"/>
+ <s:fragment rendered="#{wiki:showEmailAddress()}">
+ <h:outputText styleClass="label" value="#{messages['lacewiki.label.userList.Email']}:"/> 
+ <h:inputText id="email" value="#{userSearch.exampleUser.email}" maxlength="35" size="8" tabindex="1"/>
+ </s:fragment>
</h:panelGroup>
<h:panelGroup>
More information about the seam-commits
mailing list