incubator-lokahi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tob...@apache.org
Subject svn commit: r605283 - /incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/api/user/User.java
Date Tue, 18 Dec 2007 18:29:02 GMT
Author: toback
Date: Tue Dec 18 10:29:00 2007
New Revision: 605283

URL: http://svn.apache.org/viewvc?rev=605283&view=rev
Log:
Changed to prevent looking up the project object if we already have it to limit calls to the
database due to auth requests.

Modified:
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/api/user/User.java

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/api/user/User.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/api/user/User.java?rev=605283&r1=605282&r2=605283&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/api/user/User.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/api/user/User.java Tue Dec
18 10:29:00 2007
@@ -562,9 +562,14 @@
   }
 
   public boolean isAllowed(Function f, Project p) {
-    int pid = -1;
-    if (p != null) pid = p.getPk();
-    return this.isAllowed(f, pid);
+      boolean ret = false;
+    if (p != null) {
+      AuthorizationManager authManager = this.getAuthManager();
+      ret = authManager.hasPermission(this, f, p);
+    } else {
+        ret = this.isAllowed(f, -1);
+    }
+    return ret;
   }
 
   public boolean isAllowed(Function f, String projectId) {
@@ -601,7 +606,8 @@
         ret = authManager.hasPermission(this, f);
       } else {
         try {
-          ret = authManager.hasPermission(this, f, Project.getProject(projectId));
+            logger.debug("BAD Call to isAllowed(f, int)");
+          ret = this.isAllowed(f, Project.getProject(projectId));
         } catch (SQLException e) {
           if (logger.isInfoEnabled()) {
             logger.info("Exception: " + e.getMessage());



Mime
View raw message