Scarab commit: svn commit: r11064 - trunk/src/java/org/tigris/scarab/om/ScarabUserImpl.java

[email protected] Wed, 21 Dec 2011 20:21:40 -0800 (PST)
Newsgroups gmane.comp.java.scarab.cvs
Message-ID <[email protected]>
Author: dabbous
Date: 2011-12-21 20:21:40-0800
New Revision: 11064

Modified:
   trunk/src/java/org/tigris/scarab/om/ScarabUserImpl.java

Log:
Catch situation where the role has already been granted, but the current request gets back here in a loop.

This happens when this method is called repeatedly during the operation of the current request. Maybe something wrong with the cache.
need more investigation.

Modified: trunk/src/java/org/tigris/scarab/om/ScarabUserImpl.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/om/ScarabUserImpl.java?view=diff&pathrev=11064&r1=11063&r2=11064
==============================================================================
--- trunk/src/java/org/tigris/scarab/om/ScarabUserImpl.java	(original)
+++ trunk/src/java/org/tigris/scarab/om/ScarabUserImpl.java	2011-12-21 20:21:40-0800
@@ -438,8 +438,26 @@
                             if(role != null)
                             {
                                 ScarabUser su = (ScarabUser)this;
-                                TurbineSecurity.grant(su, module, role);
-                                hasRoles = true;
+                                try
+                                {
+                                    TurbineSecurity.grant(su, module, role);
+                                    hasRoles = true;
+                                }
+                                catch (DataBackendException e)
+                                {
+                                    // maybe the role request was approved 
+                                    // by another admin?
+                                    AccessControlList acl = su.getACL();
+                                    if (acl.hasRole( role, (Group) module ) )
+                                    {
+                                        hasRoles = true;
+                                    }
+                                    else
+                                    {
+                                        // Something went wrong, ignore for now.
+                                    }
+                                }
+                                
         
                                 // TODO: Needs to be refactored into the Users system?
                                 ScarabUserManager.getMethodResult().remove(this, ScarabUserManager.GET_ACL);

------------------------------------------------------
http://scarab.tigris.org/ds/viewMessage.do?dsForumId=3577&dsMessageId=2898977