cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r153633 - in cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl: AuthenticationFWUserInfoProvider.java UserInfo.java
Date Sun, 13 Feb 2005 15:26:35 GMT
Author: cziegeler
Date: Sun Feb 13 07:26:33 2005
New Revision: 153633

URL: http://svn.apache.org/viewcvs?view=rev&rev=153633
Log:
Add role support

Modified:
    cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AuthenticationFWUserInfoProvider.java
    cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/UserInfo.java

Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AuthenticationFWUserInfoProvider.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AuthenticationFWUserInfoProvider.java?view=diff&r1=153632&r2=153633
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AuthenticationFWUserInfoProvider.java
(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AuthenticationFWUserInfoProvider.java
Sun Feb 13 07:26:33 2005
@@ -56,11 +56,12 @@
         AuthenticationManager authManager = null;
         try {
             authManager = (AuthenticationManager)this.manager.lookup(AuthenticationManager.ROLE);
-            final UserInfo info = new UserInfo(portalName, layoutKey);
-
             final RequestState state = authManager.getState();
             final UserHandler handler = state.getHandler();
 
+            final UserInfo info = new AFWUserInfo(portalName, layoutKey, handler);
+
+
             info.setUserName(handler.getUserId());
             try {
                 info.setGroup((String)handler.getContext().getContextInfo().get("group"));
@@ -88,6 +89,26 @@
             return info;    
         } finally {
             this.manager.release( authManager );
+        }
+    }
+    
+    public static final class AFWUserInfo extends UserInfo {
+        
+        protected final UserHandler handler;
+        /**
+         * @param portalName
+         * @param layoutKey
+         */
+        public AFWUserInfo(String portalName, String layoutKey, UserHandler handler) {
+            super(portalName, layoutKey);
+            this.handler = handler;
+        }
+    
+        /* (non-Javadoc)
+         * @see org.apache.cocoon.portal.profile.PortalUser#isUserInRole(java.lang.String)
+         */
+        public boolean isUserInRole(String role) {
+            return this.isUserInRole(role);
         }
     }
 }

Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/UserInfo.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/UserInfo.java?view=diff&r1=153632&r2=153633
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/UserInfo.java
(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/UserInfo.java
Sun Feb 13 07:26:33 2005
@@ -27,7 +27,7 @@
  * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
  * @version CVS $Id: MapProfileLS.java 30941 2004-07-29 19:56:58Z vgritsenko $
  */
-public class UserInfo implements PortalUser {
+public abstract class UserInfo implements PortalUser {
     
     protected String userName;
     
@@ -103,8 +103,5 @@
     /* (non-Javadoc)
      * @see org.apache.cocoon.portal.profile.PortalUser#isUserInRole(java.lang.String)
      */
-    public boolean isUserInRole(String role) {
-        // TODO Auto-generated method stub
-        return false;
-    }
+    public abstract boolean isUserInRole(String role);
 }



Mime
View raw message