]> source.dussan.org Git - archiva.git/commitdiff
this return a String so no need to do toString on Object
authorOlivier Lamy <olamy@apache.org>
Thu, 3 Jan 2013 00:15:37 +0000 (00:15 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 3 Jan 2013 00:15:37 +0000 (00:15 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1428124 13f79535-47bb-0310-9956-ffa450edef68

redback-rbac/redback-authorization-rbac/src/main/java/org/apache/archiva/redback/authorization/rbac/RbacAuthorizer.java
redback-rbac/redback-rbac-providers/redback-rbac-memory/src/main/java/org/apache/archiva/redback/rbac/memory/MemoryAuthorizer.java

index 6b1f8042d96bf714a6a69e1b2ef1d0cdd096a3ff..0b37c299ad1c162096207ec7acd775e1a2c7336e 100644 (file)
@@ -78,20 +78,20 @@ public class RbacAuthorizer
     public AuthorizationResult isAuthorized( AuthorizationDataSource source )
         throws AuthorizationException
     {
-        Object principal = source.getPrincipal();
-        Object operation = source.getPermission();
-        Object resource = source.getResource();
+        String principal = source.getPrincipal();
+        String operation = source.getPermission();
+        String resource = source.getResource();
 
         try
         {
             if ( principal != null )
             {
                 // Set permissions = manager.getAssignedPermissions( principal.toString(), operation );
-                Map<String, List<Permission>> permissionMap = manager.getAssignedPermissionMap( principal.toString() );
+                Map<String, List<Permission>> permissionMap = manager.getAssignedPermissionMap( principal );
 
-                if ( permissionMap.keySet().contains( operation.toString() ) )
+                if ( permissionMap.keySet().contains( operation ) )
                 {
-                    for ( Permission permission : permissionMap.get( operation.toString() ) )
+                    for ( Permission permission : permissionMap.get( operation ) )
                     {
 
                         log.debug( "checking permission {} for operation {} resource {}",
@@ -103,11 +103,11 @@ public class RbacAuthorizer
                         }
                     }
 
-                    log.debug( "no permission found for operation {} resource {}", operation.toString(), resource );
+                    log.debug( "no permission found for operation {} resource {}", operation, resource );
                 }
                 else
                 {
-                    log.debug( "permission map does not contain operation: {}", operation.toString() );
+                    log.debug( "permission map does not contain operation: {}", operation );
                 }
             }
             // check if guest user is enabled, if so check the global permissions
@@ -118,9 +118,9 @@ public class RbacAuthorizer
                 // Set permissions = manager.getAssignedPermissions( principal.toString(), operation );
                 Map<String, List<Permission>> permissionMap = manager.getAssignedPermissionMap( guest.getUsername() );
 
-                if ( permissionMap.keySet().contains( operation.toString() ) )
+                if ( permissionMap.keySet().contains( operation ) )
                 {
-                    for ( Permission permission : permissionMap.get( operation.toString() ) )
+                    for ( Permission permission : permissionMap.get( operation ) )
                     {
                         log.debug( "checking permission {}", permission.getName() );
 
index ed1935d9a05a53c15652df67fc5deddc11165045..0c24fbaecfd51d99d05e46428d7ef1b02ca81330 100644 (file)
@@ -40,9 +40,9 @@ public class MemoryAuthorizer
     public AuthorizationResult isAuthorized( AuthorizationDataSource source )
         throws AuthorizationException
     {
-        Object principal = source.getPrincipal();
+        String principal = source.getPrincipal();
 
-        Object permission = source.getPermission();
+        String permission = source.getPermission();
 
         // TODO: Actually use a real permission!
         if ( "foo".equals( permission.toString() ) )