[Yanel-commits] rev 25902 -
public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources
michi at wyona.com
michi at wyona.com
Tue Jul 10 23:54:50 CEST 2007
Author: michi
Date: 2007-07-10 23:54:49 +0200 (Tue, 10 Jul 2007)
New Revision: 25902
Modified:
public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/WikiResource.java
Log:
set username and realm name
Modified: public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/WikiResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/WikiResource.java 2007-07-10 21:54:20 UTC (rev 25901)
+++ public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/WikiResource.java 2007-07-10 21:54:49 UTC (rev 25902)
@@ -61,6 +61,10 @@
import org.wyona.yarep.core.RepositoryException;
import org.wyona.yarep.core.Repository;
import org.wyona.yarep.util.RepoPath;
+
+import org.wyona.security.core.api.Identity;
+import org.wyona.security.core.api.IdentityMap;
+
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
@@ -75,6 +79,8 @@
private DocumentBuilderFactory dbf = null;
private HashMap properties = new HashMap();
private final String DEFAULT_WIKI_PARSER_BEAN_ID = "jspWikiParser";
+
+ private static String IDENTITY_MAP_KEY = "identity-map";
/**
*
@@ -165,7 +171,13 @@
transformer.setParameter("yanel.back2context", PathUtil.backToContext(realm, getPath()));
transformer.setParameter("yarep.back2realm", PathUtil.backToRealm(getPath()));
transformer.setParameter("yanel.last.modified", new java.util.Date(getLastModified()));
- transformer.setParameter("yanel.username", "hugo");
+
+ IdentityMap identityMap = (IdentityMap) getRequest().getSession(true).getAttribute(IDENTITY_MAP_KEY);
+ if (identityMap != null) {
+ Identity identity = (Identity) identityMap.get(getRealm().getID());
+ if (identity != null) transformer.setParameter("yanel.username", identity.getUsername());
+ }
+ transformer.setParameter("yanel.realm.name", getRealm().getName());
}
// create xinclude transformer:
More information about the Yanel-commits
mailing list