]> source.dussan.org Git - archiva.git/commitdiff
simplify code
authorOlivier Lamy <olamy@apache.org>
Mon, 15 Oct 2012 07:25:40 +0000 (07:25 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 15 Oct 2012 07:25:40 +0000 (07:25 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1398203 13f79535-47bb-0310-9956-ffa450edef68

redback-configuration/src/main/java/org/apache/archiva/redback/configuration/UserConfiguration.java
redback-rbac/redback-authorization-rbac/src/main/java/org/apache/archiva/redback/authorization/rbac/RbacAuthorizer.java

index 63e6fcbe9eb683a4434ebcdb51c7aacb999df91f..f6fd486516dd2a1cda35888033a62d37eda89d4b 100644 (file)
@@ -94,10 +94,8 @@ public class UserConfiguration
 
         lookupRegistry = registry.getSubset( PREFIX );
 
-        if ( log.isDebugEnabled() )
-        {
-            log.debug( lookupRegistry.dump() );
-        }
+        log.debug("User configuration {}", lookupRegistry.dump() );
+
     }
 
     private void performLegacyInitialization()
index 5a3c0026db1735edceb21523e5a20e09fed01645..d00eb56d4540052e9f762aabd74590b0c3af94b9 100644 (file)
@@ -19,10 +19,6 @@ package org.apache.archiva.redback.authorization.rbac;
  * under the License.
  */
 
-import org.apache.archiva.redback.rbac.Permission;
-import org.apache.archiva.redback.rbac.RBACManager;
-import org.apache.archiva.redback.rbac.RbacManagerException;
-import org.apache.archiva.redback.users.UserNotFoundException;
 import org.apache.archiva.redback.authorization.AuthorizationDataSource;
 import org.apache.archiva.redback.authorization.AuthorizationException;
 import org.apache.archiva.redback.authorization.AuthorizationResult;
@@ -30,16 +26,19 @@ import org.apache.archiva.redback.authorization.Authorizer;
 import org.apache.archiva.redback.authorization.NotAuthorizedException;
 import org.apache.archiva.redback.authorization.rbac.evaluator.PermissionEvaluationException;
 import org.apache.archiva.redback.authorization.rbac.evaluator.PermissionEvaluator;
+import org.apache.archiva.redback.rbac.Permission;
+import org.apache.archiva.redback.rbac.RBACManager;
+import org.apache.archiva.redback.rbac.RbacManagerException;
 import org.apache.archiva.redback.rbac.RbacObjectNotFoundException;
 import org.apache.archiva.redback.users.User;
 import org.apache.archiva.redback.users.UserManager;
+import org.apache.archiva.redback.users.UserNotFoundException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import javax.inject.Inject;
 import javax.inject.Named;
-import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 
@@ -47,20 +46,19 @@ import java.util.Map;
  * RbacAuthorizer:
  *
  * @author Jesse McConnell <jmcconnell@apache.org>
- *
  */
-@Service( "authorizer#rbac" )
+@Service ( "authorizer#rbac" )
 public class RbacAuthorizer
     implements Authorizer
 {
     private Logger log = LoggerFactory.getLogger( getClass() );
 
     @Inject
-    @Named( value = "rBACManager#cached" )
+    @Named ( value = "rBACManager#cached" )
     private RBACManager manager;
 
     @Inject
-    @Named( value = "userManager#configurable" )
+    @Named ( value = "userManager#configurable" )
     private UserManager userManager;
 
     @Inject
@@ -94,12 +92,10 @@ public class RbacAuthorizer
                 {
                     for ( Permission permission : permissionMap.get( operation.toString() ) )
                     {
-                        if ( log.isDebugEnabled() )
-                        {
-                            log.debug( "checking permission {} for operation {} resource {}",
-                                       Arrays.asList( permission != null ? permission.getName() : "null", operation,
-                                                      resource ).toArray() );
-                        }
+
+                        log.debug( "checking permission {} for operation {} resource {}",
+                                   ( permission != null ? permission.getName() : "null" ), operation, resource );
+
                         if ( evaluator.evaluate( permission, operation, resource, principal ) )
                         {
                             return new AuthorizationResult( true, permission, null );