You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jo...@apache.org on 2008/09/09 20:01:32 UTC

svn commit: r693535 - in /cocoon/trunk/blocks/cocoon-auth/cocoon-auth-api/src: changes/changes.xml main/java/org/apache/cocoon/auth/ApplicationUtil.java

Author: joerg
Date: Tue Sep  9 11:01:31 2008
New Revision: 693535

URL: http://svn.apache.org/viewvc?rev=693535&view=rev
Log:
COCOON-2243: Handle case in ApplicationUtil.isUserInRole(..) when User is null.

Modified:
    cocoon/trunk/blocks/cocoon-auth/cocoon-auth-api/src/changes/changes.xml
    cocoon/trunk/blocks/cocoon-auth/cocoon-auth-api/src/main/java/org/apache/cocoon/auth/ApplicationUtil.java

Modified: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-api/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-auth/cocoon-auth-api/src/changes/changes.xml?rev=693535&r1=693534&r2=693535&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-auth/cocoon-auth-api/src/changes/changes.xml (original)
+++ cocoon/trunk/blocks/cocoon-auth/cocoon-auth-api/src/changes/changes.xml Tue Sep  9 11:01:31 2008
@@ -22,13 +22,17 @@
     |
     | @version $Id$
     +-->
-    <document>
-      <body>
-        <release version="1.0.0-M1" date="2007-??-??" description="unreleased">    
-          <action dev="reinhard" type="add">
-            Initial creation.
-          </action>      
-        </release>
-      </body>
-    </document>
-    
+<document>
+  <body>
+    <release version="1.0.1" date="TBD" description="unreleased">
+      <action dev="joerg" type="add" issue="COCOON-2243" due-to="Benjamin Boksa" due-to-email="benjamin@boksa.de">
+        Handle case in ApplicationUtil.isUserInRole(..) when User is null.
+      </action>
+    </release>
+    <release version="1.0.0" date="2008-03-26" description="released">
+      <action dev="reinhard" type="add">
+        Initial creation.
+      </action>
+    </release>
+  </body>
+</document>

Modified: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-api/src/main/java/org/apache/cocoon/auth/ApplicationUtil.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-auth/cocoon-auth-api/src/main/java/org/apache/cocoon/auth/ApplicationUtil.java?rev=693535&r1=693534&r2=693535&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-auth/cocoon-auth-api/src/main/java/org/apache/cocoon/auth/ApplicationUtil.java (original)
+++ cocoon/trunk/blocks/cocoon-auth/cocoon-auth-api/src/main/java/org/apache/cocoon/auth/ApplicationUtil.java Tue Sep  9 11:01:31 2008
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -76,7 +76,10 @@
      * @return This returns true, if the user has the role; otherwise false is returned.
      */
     public static boolean isUserInRole(final User user, final String role, final Map objectModel) {
-        boolean result = user.isUserInRole(role);
+        boolean result = false;
+        if (user != null) {
+            result = user.isUserInRole(role);
+        }
         if ( !result ) {
             final Request req = ObjectModelHelper.getRequest(objectModel);
             result = req.isUserInRole(role);