From 997a1988c07fdc1deb545dd1a8a4c6dcc02c6beb Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Thu, 14 Sep 2006 06:05:59 +0000 Subject: [PATCH] fixed up the user manglement page to work with the multiple entry points to it, as well as the granting of roles from the forms git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@443254 13f79535-47bb-0310-9956-ffa450edef68 --- .../action/admin/UserManagementAction.java | 44 +++++++++++-------- archiva-webapp/src/main/resources/xwork.xml | 14 +++--- .../webapp/WEB-INF/jsp/decorators/default.jsp | 2 +- 3 files changed, 34 insertions(+), 26 deletions(-) diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/UserManagementAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/UserManagementAction.java index f6834fed8..d2f2b0e48 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/UserManagementAction.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/UserManagementAction.java @@ -73,26 +73,33 @@ public class UserManagementAction public void prepare() throws Exception { - - if ( username != null ) + if ( username == null || "".equals( username ) ) + { + user = userManager.findUser( (String) session.get( "MANAGED_USERNAME" ) ); + username = user.getUsername(); + } + else { user = userManager.findUser( username ); - - principal = user.getPrincipal().toString(); - fullName = user.getFullName(); - email = user.getEmail(); - - if ( principal != null && rbacManager.userAssignmentExists( principal ) ) - { - assignedRoles = new ArrayList( rbacManager.getAssignedRoles( principal ) ); - availableRoles = new ArrayList( rbacManager.getUnassignedRoles( principal ) ); - } - else - { - assignedRoles = new ArrayList(); - availableRoles = rbacManager.getAllAssignableRoles(); - } } + + session.put( "MANAGED_USERNAME", username ); + + principal = user.getPrincipal().toString(); + fullName = user.getFullName(); + email = user.getEmail(); + + if ( principal != null && rbacManager.userAssignmentExists( principal ) ) + { + assignedRoles = new ArrayList( rbacManager.getAssignedRoles( principal ) ); + availableRoles = new ArrayList( rbacManager.getUnassignedRoles( principal ) ); + } + else + { + assignedRoles = new ArrayList(); + availableRoles = rbacManager.getAllAssignableRoles(); + } + } /** @@ -100,13 +107,14 @@ public class UserManagementAction * * @return */ - public String input() + public String findUser() { try { if ( username != null ) { user = userManager.findUser( username ); + session.put( "MANAGED_USERNAME", username ); return SUCCESS; } else diff --git a/archiva-webapp/src/main/resources/xwork.xml b/archiva-webapp/src/main/resources/xwork.xml index d102f8e2e..e43734cf4 100644 --- a/archiva-webapp/src/main/resources/xwork.xml +++ b/archiva-webapp/src/main/resources/xwork.xml @@ -255,29 +255,29 @@ /WEB-INF/jsp/admin/user.jsp - userManagement + userManagement - + + /WEB-INF/jsp/admin/findUser.jsp - user + user - user + user - user + user diff --git a/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp b/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp index b792d0493..87273e064 100644 --- a/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp +++ b/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp @@ -124,7 +124,7 @@
  • - User Management + User Management