From 37f469f651d8d85a8fb9882d0711dfcdb4b75bdd Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 3 Jan 2013 22:36:52 +0000 Subject: [PATCH] no need to use toString on a String git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1428649 13f79535-47bb-0310-9956-ffa450edef68 --- .../rbac/evaluator/DefaultPermissionEvaluator.java | 8 ++++---- .../authorization/rbac/evaluator/PermissionEvaluator.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/redback-rbac/redback-authorization-rbac/src/main/java/org/apache/archiva/redback/authorization/rbac/evaluator/DefaultPermissionEvaluator.java b/redback-rbac/redback-authorization-rbac/src/main/java/org/apache/archiva/redback/authorization/rbac/evaluator/DefaultPermissionEvaluator.java index 0db1f4f8b..c3d033d83 100644 --- a/redback-rbac/redback-authorization-rbac/src/main/java/org/apache/archiva/redback/authorization/rbac/evaluator/DefaultPermissionEvaluator.java +++ b/redback-rbac/redback-authorization-rbac/src/main/java/org/apache/archiva/redback/authorization/rbac/evaluator/DefaultPermissionEvaluator.java @@ -45,7 +45,7 @@ public class DefaultPermissionEvaluator @Named(value = "userManager#configurable") private UserManager userManager; - public boolean evaluate( Permission permission, Object operation, Object resource, Object principal ) + public boolean evaluate( Permission permission, String operation, String resource, String principal ) throws PermissionEvaluationException { String permissionResource = permission.getResource().getIdentifier(); @@ -59,7 +59,7 @@ public class DefaultPermissionEvaluator { try { - permissionResource = userManager.findUser( principal.toString() ).getUsername(); + permissionResource = userManager.findUser( principal ).getUsername(); } catch ( UserNotFoundException e ) { @@ -73,7 +73,7 @@ public class DefaultPermissionEvaluator } // check if this permission applies to the operation at all - if ( permission.getOperation().getName().equals( operation.toString() ) ) + if ( permission.getOperation().getName().equals( operation ) ) { // check if it is a global resource, if it is then since the operations match we return true if ( Resource.GLOBAL.equals( permission.getResource().getIdentifier() ) ) @@ -89,7 +89,7 @@ public class DefaultPermissionEvaluator // check if the resource identifier of the permission matches the resource we are checking against // if it does then return true - if ( permissionResource.equals( resource.toString() ) ) + if ( permissionResource.equals( resource ) ) { return true; } diff --git a/redback-rbac/redback-authorization-rbac/src/main/java/org/apache/archiva/redback/authorization/rbac/evaluator/PermissionEvaluator.java b/redback-rbac/redback-authorization-rbac/src/main/java/org/apache/archiva/redback/authorization/rbac/evaluator/PermissionEvaluator.java index 8b7d4a2c9..8dc0014a5 100644 --- a/redback-rbac/redback-authorization-rbac/src/main/java/org/apache/archiva/redback/authorization/rbac/evaluator/PermissionEvaluator.java +++ b/redback-rbac/redback-authorization-rbac/src/main/java/org/apache/archiva/redback/authorization/rbac/evaluator/PermissionEvaluator.java @@ -30,6 +30,6 @@ import org.apache.archiva.redback.rbac.Permission; */ public interface PermissionEvaluator { - boolean evaluate( Permission permission, Object operation, Object resource, Object principal ) + boolean evaluate( Permission permission, String operation, String resource, String principal ) throws PermissionEvaluationException; } -- 2.39.5