svnno****@sourc*****
svnno****@sourc*****
2007年 5月 7日 (月) 18:01:12 JST
Revision: 94 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=94 Author: shinsuke Date: 2007-05-07 18:01:12 +0900 (Mon, 07 May 2007) Log Message: ----------- changed version name. supported paging for user list. Modified Paths: -------------- pal-portal/trunk/build.properties Added Paths: ----------- pal-portal/trunk/portal/patches/components/ pal-portal/trunk/portal/patches/components/security/ pal-portal/trunk/portal/patches/components/security/src/ pal-portal/trunk/portal/patches/components/security/src/java/ pal-portal/trunk/portal/patches/components/security/src/java/org/ pal-portal/trunk/portal/patches/components/security/src/java/org/apache/ pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/ pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/ pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/impl/ pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/impl/AuthenticationProviderProxyImpl.java pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/spi/ pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/spi/impl/ pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultUserSecurityHandler.java pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapUserSecurityHandler.java pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/spi/impl/SecurityAccessImpl.java pal-portal/trunk/portal/patches/jetspeed-api/ pal-portal/trunk/portal/patches/jetspeed-api/src/ pal-portal/trunk/portal/patches/jetspeed-api/src/java/ pal-portal/trunk/portal/patches/jetspeed-api/src/java/org/ pal-portal/trunk/portal/patches/jetspeed-api/src/java/org/apache/ pal-portal/trunk/portal/patches/jetspeed-api/src/java/org/apache/jetspeed/ pal-portal/trunk/portal/patches/jetspeed-api/src/java/org/apache/jetspeed/security/ pal-portal/trunk/portal/patches/jetspeed-api/src/java/org/apache/jetspeed/security/AuthenticationProviderProxy.java pal-portal/trunk/portal/patches/jetspeed-api/src/java/org/apache/jetspeed/security/spi/ pal-portal/trunk/portal/patches/jetspeed-api/src/java/org/apache/jetspeed/security/spi/SecurityAccess.java pal-portal/trunk/portal/patches/jetspeed-api/src/java/org/apache/jetspeed/security/spi/UserSecurityHandler.java -------------- next part -------------- Modified: pal-portal/trunk/build.properties =================================================================== --- pal-portal/trunk/build.properties 2007-05-04 22:30:23 UTC (rev 93) +++ pal-portal/trunk/build.properties 2007-05-07 09:01:12 UTC (rev 94) @@ -4,7 +4,7 @@ container.name=PAL Portal container.separator=/ container.version.major=1 -container.version.minor=0-beta5-SNAPSHOT +container.version.minor=0-beta5-dev container.info.file=commons/src/java/org/apache/jetspeed/container/resources/ContainerInfo.properties portlets.home=${basedir}/portlets portlets.build.dir=${portlets.home}/build @@ -66,7 +66,7 @@ jetspeed2.revision=534972 # Dependencies for Jetspeed -jetspeed.version=2.2-dev +jetspeed.version=2.2-dev_pal-${portal.version} pluto.version=1.0.1 portlet.api.version=1.0 servlet.api.version=2.3 @@ -92,6 +92,7 @@ jetspeed2.build.options=\ +-Djetspeed.version="${jetspeed.version}" \ -Dpluto.version=${pluto.version} \ -Dmaven.test.skip=true \ -Dorg.apache.jetspeed.portal.home="${org.apache.jetspeed.portal.home}" \ @@ -119,6 +120,7 @@ -Dspring.modules.version="${spring.modules.version}" \ jetspeed2.deploy.options=\ +-Djetspeed.version="${jetspeed.version}" \ -Dorg.apache.jetspeed.catalina.version.major=${org.apache.jetspeed.catalina.version.major} \ -Dorg.apache.jetspeed.server.home=${org.apache.jetspeed.server.home} \ -Dorg.apache.jetspeed.server.shared=${org.apache.jetspeed.server.shared} \ @@ -133,6 +135,7 @@ -Dorg.apache.jetspeed.production.jdbc.drivers.path=${org.apache.jetspeed.production.jdbc.drivers.path} \ jetspeed2.dist.deploy.options=\ +-Djetspeed.version="${jetspeed.version}" \ -Dorg.apache.jetspeed.catalina.version.major=${org.apache.jetspeed.catalina.version.major} \ -Dorg.apache.jetspeed.server.home=${dist.server.home} \ -Dorg.apache.jetspeed.server.shared=${dist.server.shared} \ @@ -158,6 +161,10 @@ -Dportal.psml.name="${portal.psml.name}" \ portal.patch.files=\ +components/security/src/java/org/apache/jetspeed/security/impl/AuthenticationProviderProxyImpl.java,\ +components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapUserSecurityHandler.java,\ +components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultUserSecurityHandler.java,\ +components/security/src/java/org/apache/jetspeed/security/spi/impl/SecurityAccessImpl.java,\ applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/UserRegistrationPortlet.java,\ applications/j2-admin/src/webapp/WEB-INF/portlet.xml,\ layout-portlets/src/webapp/WEB-INF/portlet.xml,\ @@ -167,6 +174,9 @@ src/webapp/WEB-INF/templates/layout/html/maximized/layout.vm,\ src/webapp/decorations/portlet/decorator.vm,\ project.properties,\ +jetspeed-api/src/java/org/apache/jetspeed/security/spi/UserSecurityHandler.java,\ +jetspeed-api/src/java/org/apache/jetspeed/security/spi/SecurityAccess.java,\ +jetspeed-api/src/java/org/apache/jetspeed/security/AuthenticationProviderProxy.java,\ commons/src/java/org/apache/jetspeed/container/resources/ContainerInfo.properties,\ etc/sql/min/j2-seed.xml,\ etc/sql/j2-seed.xml,\ Added: pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/impl/AuthenticationProviderProxyImpl.java =================================================================== --- pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/impl/AuthenticationProviderProxyImpl.java 2007-05-04 22:30:23 UTC (rev 93) +++ pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/impl/AuthenticationProviderProxyImpl.java 2007-05-07 09:01:12 UTC (rev 94) @@ -0,0 +1,65 @@ +Index: components/security/src/java/org/apache/jetspeed/security/impl/AuthenticationProviderProxyImpl.java +=================================================================== +--- components/security/src/java/org/apache/jetspeed/security/impl/AuthenticationProviderProxyImpl.java (リビジョン 534972) ++++ components/security/src/java/org/apache/jetspeed/security/impl/AuthenticationProviderProxyImpl.java (作業コピー) +@@ -157,6 +157,53 @@ + } + + /** ++ * @see org.apache.jetspeed.security.spi.UserSecurityHandler#getUserPrincipals(java.lang.String, java.lang.String) ++ */ ++ public List getUserPrincipals(String filter, String authenticationProvider) throws SecurityException ++ { ++ AuthenticationProvider provider = getAuthenticationProviderByName(authenticationProvider); ++ if ( provider != null ) ++ { ++ List userPrincipals = new LinkedList(); ++ userPrincipals.addAll(provider.getUserSecurityHandler().getUserPrincipals(filter)); ++ return userPrincipals; ++ } ++ else ++ { ++ throw new SecurityException(SecurityException.INVALID_AUTHENTICATION_PROVIDER.create(authenticationProvider)); ++ } ++ } ++ ++ /** ++ * @see org.apache.jetspeed.security.spi.UserSecurityHandler#getUserCount(java.lang.String) ++ */ ++ public int getUserCount(String filter) ++ { ++ int count = 0; ++ for (int i = 0; i < authenticationProviders.size(); i++) ++ { ++ count += ((AuthenticationProvider)authenticationProviders.get(i)).getUserSecurityHandler().getUserCount(filter); ++ } ++ return count; ++ } ++ ++ /** ++ * @see org.apache.jetspeed.security.spi.UserSecurityHandler#getUserCount(java.lang.String, java.lang.String) ++ */ ++ public int getUserCount(String filter, String authenticationProvider) throws SecurityException ++ { ++ AuthenticationProvider provider = getAuthenticationProviderByName(authenticationProvider); ++ if ( provider != null ) ++ { ++ return provider.getUserSecurityHandler().getUserCount(filter); ++ } ++ else ++ { ++ throw new SecurityException(SecurityException.INVALID_AUTHENTICATION_PROVIDER.create(authenticationProvider)); ++ } ++ } ++ ++ /** + * @see org.apache.jetspeed.security.AuthenticationProviderProxy#addUserPrincipal(org.apache.jetspeed.security.UserPrincipal, + * java.lang.String) + */ +@@ -476,4 +523,4 @@ + throw new SecurityException(SecurityException.USER_DOES_NOT_EXIST.create(userName)); + } + } +-} +\ ファイルの末尾に改行がありません ++} Property changes on: pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/impl/AuthenticationProviderProxyImpl.java ___________________________________________________________________ Name: svn:eol-style + native Added: pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultUserSecurityHandler.java =================================================================== --- pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultUserSecurityHandler.java 2007-05-04 22:30:23 UTC (rev 93) +++ pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultUserSecurityHandler.java 2007-05-07 09:01:12 UTC (rev 94) @@ -0,0 +1,19 @@ +Index: components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultUserSecurityHandler.java +=================================================================== +--- components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultUserSecurityHandler.java (リビジョン 534972) ++++ components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultUserSecurityHandler.java (作業コピー) +@@ -89,6 +89,14 @@ + } + + /** ++ * @see org.apache.jetspeed.security.spi.UserSecurityHandler#getUserCount(java.lang.String) ++ */ ++ public int getUserCount(String filter) ++ { ++ return securityAccess.getInternalUserCount(filter); ++ } ++ ++ /** + * @see org.apache.jetspeed.security.spi.UserSecurityHandler#addUserPrincipal(org.apache.jetspeed.security.UserPrincipal) + */ + public void addUserPrincipal(UserPrincipal userPrincipal) throws SecurityException Property changes on: pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultUserSecurityHandler.java ___________________________________________________________________ Name: svn:eol-style + native Added: pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapUserSecurityHandler.java =================================================================== --- pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapUserSecurityHandler.java 2007-05-04 22:30:23 UTC (rev 93) +++ pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapUserSecurityHandler.java 2007-05-07 09:01:12 UTC (rev 94) @@ -0,0 +1,35 @@ +Index: components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapUserSecurityHandler.java +=================================================================== +--- components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapUserSecurityHandler.java (リビジョン 534972) ++++ components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapUserSecurityHandler.java (作業コピー) +@@ -146,6 +146,23 @@ + } + + /** ++ * @see org.apache.jetspeed.security.spi.UserSecurityHandler#getUserCount(java.lang.String) ++ */ ++ public int getUserCount(String filter) ++ { ++ try ++ { ++ return ldap.find(filter, UserPrincipal.PREFS_USER_ROOT).length; ++ } ++ catch (SecurityException e) ++ { ++ logSecurityException(e, filter); ++ } ++ ++ return 0; ++ } ++ ++ /** + * @see org.apache.jetspeed.security.spi.UserSecurityHandler#addUserPrincipal(org.apache.jetspeed.security.UserPrincipal) + */ + public void addUserPrincipal(UserPrincipal userPrincipal) throws SecurityException +@@ -195,4 +212,4 @@ + + ldap.delete(uid); + } +-} +\ ファイルの末尾に改行がありません ++} Property changes on: pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapUserSecurityHandler.java ___________________________________________________________________ Name: svn:eol-style + native Added: pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/spi/impl/SecurityAccessImpl.java =================================================================== --- pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/spi/impl/SecurityAccessImpl.java 2007-05-04 22:30:23 UTC (rev 93) +++ pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/spi/impl/SecurityAccessImpl.java 2007-05-07 09:01:12 UTC (rev 94) @@ -0,0 +1,109 @@ +Index: components/security/src/java/org/apache/jetspeed/security/spi/impl/SecurityAccessImpl.java +=================================================================== +--- components/security/src/java/org/apache/jetspeed/security/spi/impl/SecurityAccessImpl.java (リビジョン 534972) ++++ components/security/src/java/org/apache/jetspeed/security/spi/impl/SecurityAccessImpl.java (作業コピー) +@@ -19,6 +19,7 @@ + import java.security.Principal; + import java.util.Collection; + import java.util.Iterator; ++import java.util.StringTokenizer; + + import org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport; + import org.apache.jetspeed.i18n.KeyedMessage; +@@ -134,14 +135,85 @@ + { + Criteria queryCriteria = new Criteria(); + queryCriteria.addEqualTo("isMappingOnly", new Boolean(false)); +- queryCriteria.addLike("fullPath", UserPrincipal.PREFS_USER_ROOT + filter + "%"); +- Query query = QueryFactory.newQuery(InternalUserPrincipalImpl.class, queryCriteria); +- Iterator result = getPersistenceBrokerTemplate().getIteratorByQuery(query); +- return result; ++ if (filter != null && filter.startsWith("AdvanceFilter:")) ++ { ++ String f = filter.substring("AdvanceFilter:".length()); ++ String username = getFilterParameter(f, "username", ""); ++ queryCriteria.addLike("fullPath", UserPrincipal.PREFS_USER_ROOT ++ + username + "%"); ++ Query query = QueryFactory.newQuery( ++ InternalUserPrincipalImpl.class, queryCriteria); ++ String startAtIndex = getFilterParameter(f, "startAtIndex", "0"); ++ query.setStartAtIndex(Integer.parseInt(startAtIndex)); ++ String endAtIndex = getFilterParameter(f, "endAtIndex", "0"); ++ query.setEndAtIndex(Integer.parseInt(endAtIndex)); ++ Iterator result = getPersistenceBrokerTemplate() ++ .getIteratorByQuery(query); ++ return result; ++ } ++ else ++ { ++ queryCriteria.addLike("fullPath", UserPrincipal.PREFS_USER_ROOT ++ + filter + "%"); ++ Query query = QueryFactory.newQuery(InternalUserPrincipalImpl.class, queryCriteria); ++ Iterator result = getPersistenceBrokerTemplate().getIteratorByQuery(query); ++ return result; ++ } + } + + /** + * <p> ++ * Returns the number of {@link Principal} given the filter. ++ * </p> ++ * ++ * @param filter The filter. ++ * @return The number of {@link InternalUserPrincipal}. ++ */ ++ public int getInternalUserCount(String filter) ++ { ++ Criteria queryCriteria = new Criteria(); ++ queryCriteria.addEqualTo("isMappingOnly", new Boolean(false)); ++ if (filter != null && filter.startsWith("AdvanceFilter:")) ++ { ++ String f = filter.substring("AdvanceFilter:".length()); ++ String username = getFilterParameter(f, "username", ""); ++ queryCriteria.addLike("fullPath", UserPrincipal.PREFS_USER_ROOT ++ + username + "%"); ++ Query query = QueryFactory.newQuery( ++ InternalUserPrincipalImpl.class, queryCriteria); ++ String startAtIndex = getFilterParameter(f, "startAtIndex", "0"); ++ query.setStartAtIndex(Integer.parseInt(startAtIndex)); ++ String endAtIndex = getFilterParameter(f, "endAtIndex", "0"); ++ query.setEndAtIndex(Integer.parseInt(endAtIndex)); ++ int count = getPersistenceBrokerTemplate().getCount(query); ++ return count; ++ } ++ else ++ { ++ queryCriteria.addLike("fullPath", UserPrincipal.PREFS_USER_ROOT ++ + filter + "%"); ++ Query query = QueryFactory.newQuery(InternalUserPrincipalImpl.class, queryCriteria); ++ int count = getPersistenceBrokerTemplate().getCount(query); ++ return count; ++ } ++ } ++ ++ private String getFilterParameter(String filter, String key,String defaultValue) ++ { ++ StringTokenizer st = new StringTokenizer(filter, ", "); ++ while (st.hasMoreTokens()) ++ { ++ String pair = st.nextToken(); ++ if (pair.startsWith(key + "=")) ++ { ++ return pair.substring(key.length() + 1); ++ } ++ } ++ return defaultValue; ++ } ++ ++ /** ++ * <p> + * Sets the given {@link InternalUserPrincipal}. + * </p> + * +@@ -377,4 +449,4 @@ + return c.iterator(); + } + +-} +\ ファイルの末尾に改行がありません ++} Property changes on: pal-portal/trunk/portal/patches/components/security/src/java/org/apache/jetspeed/security/spi/impl/SecurityAccessImpl.java ___________________________________________________________________ Name: svn:eol-style + native Added: pal-portal/trunk/portal/patches/jetspeed-api/src/java/org/apache/jetspeed/security/AuthenticationProviderProxy.java =================================================================== --- pal-portal/trunk/portal/patches/jetspeed-api/src/java/org/apache/jetspeed/security/AuthenticationProviderProxy.java 2007-05-04 22:30:23 UTC (rev 93) +++ pal-portal/trunk/portal/patches/jetspeed-api/src/java/org/apache/jetspeed/security/AuthenticationProviderProxy.java 2007-05-07 09:01:12 UTC (rev 94) @@ -0,0 +1,42 @@ +Index: jetspeed-api/src/java/org/apache/jetspeed/security/AuthenticationProviderProxy.java +=================================================================== +--- jetspeed-api/src/java/org/apache/jetspeed/security/AuthenticationProviderProxy.java (リビジョン 534972) ++++ jetspeed-api/src/java/org/apache/jetspeed/security/AuthenticationProviderProxy.java (作業コピー) +@@ -16,6 +16,7 @@ + */ + package org.apache.jetspeed.security; + ++import java.util.List; + import java.sql.Date; + + import org.apache.jetspeed.security.spi.CredentialHandler; +@@ -46,6 +47,29 @@ + * @return The authentication provider or null if user is unknown. + */ + String getAuthenticationProvider(String userName); ++ ++ /** ++ * <p> ++ * Gets the iterator of user principals for a given filter. ++ * </p> ++ * ++ * @param filter The filter. ++ * @param authenticationProvider The authentication provider name. ++ * @return The list of <code>Principal</code> ++ */ ++ List getUserPrincipals(String filter, String authenticationProvider) throws SecurityException; ++ ++ /** ++ * <p> ++ * Gets the number of user principals for a given filter. ++ * </p> ++ * ++ * @param filter The filter. ++ * @param authenticationProvider The authentication provider name. ++ * @return The number of <code>Principal</code> ++ */ ++ int getUserCount(String filter, String authenticationProvider) throws SecurityException; ++ + + /** + * <p> Added: pal-portal/trunk/portal/patches/jetspeed-api/src/java/org/apache/jetspeed/security/spi/SecurityAccess.java =================================================================== --- pal-portal/trunk/portal/patches/jetspeed-api/src/java/org/apache/jetspeed/security/spi/SecurityAccess.java 2007-05-04 22:30:23 UTC (rev 93) +++ pal-portal/trunk/portal/patches/jetspeed-api/src/java/org/apache/jetspeed/security/spi/SecurityAccess.java 2007-05-07 09:01:12 UTC (rev 94) @@ -0,0 +1,21 @@ +Index: jetspeed-api/src/java/org/apache/jetspeed/security/spi/SecurityAccess.java +=================================================================== +--- jetspeed-api/src/java/org/apache/jetspeed/security/spi/SecurityAccess.java (リビジョン 534972) ++++ jetspeed-api/src/java/org/apache/jetspeed/security/spi/SecurityAccess.java (作業コピー) +@@ -79,6 +79,16 @@ + + /** + * <p> ++ * Returns a {@link InternalUserPrincipal} collection given the filter. ++ * </p> ++ * ++ * @param filter The filter. ++ * @return The number of {@link InternalUserPrincipal}. ++ */ ++ int getInternalUserCount( String filter ); ++ ++ /** ++ * <p> + * Sets the given {@link InternalUserPrincipal}. + * </p> + * Added: pal-portal/trunk/portal/patches/jetspeed-api/src/java/org/apache/jetspeed/security/spi/UserSecurityHandler.java =================================================================== --- pal-portal/trunk/portal/patches/jetspeed-api/src/java/org/apache/jetspeed/security/spi/UserSecurityHandler.java 2007-05-04 22:30:23 UTC (rev 93) +++ pal-portal/trunk/portal/patches/jetspeed-api/src/java/org/apache/jetspeed/security/spi/UserSecurityHandler.java 2007-05-07 09:01:12 UTC (rev 94) @@ -0,0 +1,21 @@ +Index: jetspeed-api/src/java/org/apache/jetspeed/security/spi/UserSecurityHandler.java +=================================================================== +--- jetspeed-api/src/java/org/apache/jetspeed/security/spi/UserSecurityHandler.java (リビジョン 534972) ++++ jetspeed-api/src/java/org/apache/jetspeed/security/spi/UserSecurityHandler.java (作業コピー) +@@ -70,6 +70,16 @@ + + /** + * <p> ++ * Gets the number of user principals for a given filter. ++ * </p> ++ * ++ * @param filter The filter. ++ * @return The number of <code>Principal</code> ++ */ ++ int getUserCount(String filter); ++ ++ /** ++ * <p> + * Adds a new user principal in the backing store. + * </p> + *