Skip to content

Commit

Permalink
COCOON-2243: Handle case in ApplicationUtil.isUserInRole(..) when Use…
Browse files Browse the repository at this point in the history
…r is null.

git-svn-id: https://svn.apache.org/repos/asf/cocoon/trunk@693535 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Joerg Heinick committed Sep 9, 2008
1 parent 88754cb commit 8d09120
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
24 changes: 14 additions & 10 deletions blocks/cocoon-auth/cocoon-auth-api/src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -76,7 +76,10 @@ public static Object getData(final Map objectModel) {
* @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);
Expand Down

0 comments on commit 8d09120

Please sign in to comment.