[jboss-svn-commits] JBL Code SVN: r19247 - in labs/jbosslabs/labs-3.0-build: core/core-model/src/main/java/org/jboss/labs/core/model/auth and 8 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Mar 26 12:22:17 EDT 2008


Author: szimano
Date: 2008-03-26 12:22:17 -0400 (Wed, 26 Mar 2008)
New Revision: 19247

Added:
   labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/PrivDescriptionBuilder.java
   labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/ReviewPrivilegesAction.java
   labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/grant_superroles.xhtml
   labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/choose_user.xhtml
   labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/review_privileges.xhtml
Modified:
   labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/RoleBinderService.java
   labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/ServiceDescriptor.java
   labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/UserService.java
   labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/core/model/auth/ServiceRole.java
   labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/core/model/auth/UserRole.java
   labs/jbosslabs/labs-3.0-build/services/credential/src/main/java/org/jboss/labs/auth/impl/RoleBinderServiceImpl.java
   labs/jbosslabs/labs-3.0-build/services/credential/src/main/java/org/jboss/labs/auth/impl/UserServiceImpl.java
   labs/jbosslabs/labs-3.0-build/services/foo-service/src/main/java/org/jboss/labs/FooRoleList.java
   labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/auth/ProjectAdminRoles.java
   labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/auth/AuthViewRoles.java
   labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/GlobalBinderAction.java
   labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/ProjectBinderAction.java
   labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/UserManager.java
   labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/home.xhtml
   labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/choose_project.xhtml
   labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/choose_service_role.xhtml
   labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/choose_user_role.xhtml
   labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/show_userrole.xhtml
   labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/manage_global.xhtml
   labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/manage_project.xhtml
   labs/jbosslabs/labs-3.0-build/views/labs-test/src/main/java/org/jboss/labs/test/credential/TestRoles.java
Log:
more views in auth JBLAB-901

Added: labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/PrivDescriptionBuilder.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/PrivDescriptionBuilder.java	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/PrivDescriptionBuilder.java	2008-03-26 16:22:17 UTC (rev 19247)
@@ -0,0 +1,60 @@
+/*
+ * JBoss Labs. http://labs.jboss.com/jbosslabs
+ * 
+ * Copyright (C) 2008  Red Hat Middleware, LLC. All rights reserved.
+ * 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT A WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License, v.2.1 along with this distribution; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ * 
+ * Red Hat Author(s): Bob McWhirter, Przemyslaw Dej, Ryszard Kozmik, 
+ * 	Tomasz Szymanski, Adam Warski, Pawel Wrzeszcz
+ */
+package org.jboss.labs.auth;
+
+import org.jboss.labs.core.model.Project;
+import org.jboss.labs.core.model.auth.ProjectID;
+import org.jboss.labs.core.model.auth.UserRole;
+import org.jboss.labs.core.model.auth.AuthID;
+
+/**
+ * @author tomaszszymanski
+ * 
+ */
+public class PrivDescriptionBuilder {
+	public static String getDescription(String privilageDescription,
+			UserRole userRole, Project project) {
+		return getDescription(privilageDescription, userRole.getId(), project.getName());
+	}
+
+	public static String getDescription(String privilageDescription,
+			UserRole userRole, ProjectID project) {
+		return getDescription(privilageDescription, userRole.getId(), project.getAuthId());
+	}
+
+	public static String getDescription(String privilageDescription,
+			UserRole userRole, AuthID authId) {
+		return getDescription(privilageDescription, userRole.getId(), authId.getAuthId());
+	}
+
+	public static String getDescriptionGlobal(String privilageDescription,
+			UserRole userRole) {
+		return getDescription(privilageDescription, userRole.getId(), "ALL PROJECTS");
+	}
+
+	private static String getDescription(String privilageDescription,
+			String userRole, String id) {
+		return privilageDescription.replaceAll("\\$\\{userRole\\}", userRole)
+				.replaceAll("\\$\\{id\\}", id);
+	}
+}

Modified: labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/RoleBinderService.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/RoleBinderService.java	2008-03-26 15:49:05 UTC (rev 19246)
+++ labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/RoleBinderService.java	2008-03-26 16:22:17 UTC (rev 19247)
@@ -418,4 +418,13 @@
 	 * @returns Map of bindings AuthID -> Set of user roles
 	 */
 	public Map<AuthID, Set<UserRole>> getBindingsForServiceRole(ServiceRole sr);
+
+	/**
+	 * Gets bindings for given user role
+	 * 
+	 * @param ur
+	 *            User role
+	 * @return Map of bindings AuthID -> Set of service roles
+	 */
+	public Map<AuthID, Set<ServiceRole>> getBindingsForUserRole(UserRole ur);
 }

Modified: labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/ServiceDescriptor.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/ServiceDescriptor.java	2008-03-26 15:49:05 UTC (rev 19246)
+++ labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/ServiceDescriptor.java	2008-03-26 16:22:17 UTC (rev 19247)
@@ -47,4 +47,21 @@
 	 * @return Returns description for this service
 	 */
 	public String getServiceDescription();
+
+	/**
+	 * Generates string that describes privileges that user get when bound to
+	 * this role. You can use ${userRole} and ${id} inside. ${user} will be changed
+	 * to user role and ${id} will be changed to either project id in form of
+	 * "project <project id/name>" or custom id "<custom id>", or "ALL PROJECTS"
+	 * if binding is done globally.
+	 * 
+	 * @param <E>
+	 *            Role from Enum
+	 * @param role
+	 *            Role to get description for
+	 * @return Description of privileges that user gets when is bound to this
+	 *         role.
+	 */
+	public <E extends Enum<E> & ServiceDescriptor> String getPrivilageInformation(
+			E role);
 }

Modified: labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/UserService.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/UserService.java	2008-03-26 15:49:05 UTC (rev 19246)
+++ labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/UserService.java	2008-03-26 16:22:17 UTC (rev 19247)
@@ -23,6 +23,7 @@
 package org.jboss.labs.auth;
 
 import java.security.Principal;
+import java.util.Collection;
 import java.util.Set;
 
 import javax.ejb.Local;
@@ -239,4 +240,11 @@
 	 * @return All user roles
 	 */
 	public Set<UserRole> getAllUserRoles();
+
+	/**
+	 * Gets all users
+	 * 
+	 * @return All users
+	 */
+	public Set<User> getAllUsers();
 }

Modified: labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/core/model/auth/ServiceRole.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/core/model/auth/ServiceRole.java	2008-03-26 15:49:05 UTC (rev 19246)
+++ labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/core/model/auth/ServiceRole.java	2008-03-26 16:22:17 UTC (rev 19247)
@@ -50,6 +50,8 @@
 	private Boolean available;
 
 	private String description;
+	
+	private String privilageInformation;
 
 	@ManyToOne
 	private Service service;
@@ -72,10 +74,11 @@
 	public ServiceRole() {
 	}
 
-	public ServiceRole(String id, Service service, String description) {
+	public ServiceRole(String id, Service service, String description, String privilageInformation) {
 		this.id = id;
 		available = true;
 		this.service = service;
+		this.privilageInformation = privilageInformation;
 	}
 
 	public Boolean getAvailable() {
@@ -152,4 +155,12 @@
 		return id.substring(id.lastIndexOf('.') + 1);
 	}
 
+	public String getPrivilageInformation() {
+		return privilageInformation;
+	}
+
+	public void setPrivilageInformation(String privilageInformation) {
+		this.privilageInformation = privilageInformation;
+	}
+
 }

Modified: labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/core/model/auth/UserRole.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/core/model/auth/UserRole.java	2008-03-26 15:49:05 UTC (rev 19246)
+++ labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/core/model/auth/UserRole.java	2008-03-26 16:22:17 UTC (rev 19247)
@@ -27,6 +27,7 @@
 import java.util.Set;
 
 import javax.persistence.Entity;
+import javax.persistence.FetchType;
 import javax.persistence.Id;
 import javax.persistence.ManyToMany;
 
@@ -45,7 +46,7 @@
 	@ManyToMany(mappedBy = "userRoles")
 	private Set<User> users;
 
-	@ManyToMany(mappedBy = "globalRoles")
+	@ManyToMany(mappedBy = "globalRoles", fetch = FetchType.EAGER)
 	private Set<ServiceRole> serviceRoles;
 
 	public UserRole() {

Modified: labs/jbosslabs/labs-3.0-build/services/credential/src/main/java/org/jboss/labs/auth/impl/RoleBinderServiceImpl.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/services/credential/src/main/java/org/jboss/labs/auth/impl/RoleBinderServiceImpl.java	2008-03-26 15:49:05 UTC (rev 19246)
+++ labs/jbosslabs/labs-3.0-build/services/credential/src/main/java/org/jboss/labs/auth/impl/RoleBinderServiceImpl.java	2008-03-26 16:22:17 UTC (rev 19247)
@@ -152,12 +152,14 @@
 
 			if (sr == null) {
 				sr = new ServiceRole(AuthHelper.getServiceRoleID(role),
-						service, role.getDescription(role));
+						service, role.getDescription(role), role
+								.getPrivilageInformation(role));
 				manager.persist(sr);
 
 				service.addServiceRole(sr);
 			} else {
 				sr.setDescription(role.getDescription(role));
+				sr.setPrivilageInformation(role.getPrivilageInformation(role));
 				manager.merge(sr);
 			}
 
@@ -535,4 +537,28 @@
 		return m;
 	}
 
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.jboss.labs.auth.RoleBinderService#getBindingsForUserRole(org.jboss.labs.core.model.auth.UserRole)
+	 */
+	@SuppressWarnings("unchecked")
+	public Map<AuthID, Set<ServiceRole>> getBindingsForUserRole(UserRole ur) {
+		List<Binding> bindings = manager.createQuery(
+				"SELECT b FROM Binding b where b.userRole = :userRole")
+				.setParameter("userRole", ur).getResultList();
+
+		Map<AuthID, Set<ServiceRole>> m = new HashMap<AuthID, Set<ServiceRole>>();
+
+		for (Binding b : bindings) {
+			if (!m.containsKey(b.getAuthId())) {
+				m.put(b.getAuthId(), new TreeSet<ServiceRole>());
+			}
+
+			m.get(b.getAuthId()).add(b.getServiceRole());
+		}
+
+		return m;
+	}
+
 }

Modified: labs/jbosslabs/labs-3.0-build/services/credential/src/main/java/org/jboss/labs/auth/impl/UserServiceImpl.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/services/credential/src/main/java/org/jboss/labs/auth/impl/UserServiceImpl.java	2008-03-26 15:49:05 UTC (rev 19246)
+++ labs/jbosslabs/labs-3.0-build/services/credential/src/main/java/org/jboss/labs/auth/impl/UserServiceImpl.java	2008-03-26 16:22:17 UTC (rev 19247)
@@ -438,4 +438,13 @@
 		return new TreeSet(manager.createQuery("SELECT r from UserRole r")
 				.getResultList());
 	}
+
+	/* (non-Javadoc)
+	 * @see org.jboss.labs.auth.UserService#getAllUsers()
+	 */
+	@SuppressWarnings("unchecked")
+	public Set<User> getAllUsers() {
+		return new TreeSet(manager.createQuery("SELECT u from User u")
+				.getResultList());
+	}
 }

Modified: labs/jbosslabs/labs-3.0-build/services/foo-service/src/main/java/org/jboss/labs/FooRoleList.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/services/foo-service/src/main/java/org/jboss/labs/FooRoleList.java	2008-03-26 15:49:05 UTC (rev 19246)
+++ labs/jbosslabs/labs-3.0-build/services/foo-service/src/main/java/org/jboss/labs/FooRoleList.java	2008-03-26 16:22:17 UTC (rev 19247)
@@ -50,4 +50,18 @@
 	public String getServiceDescription() {
 		return "Foo service beeing the most important one";
 	}
+
+	/* (non-Javadoc)
+	 * @see org.jboss.labs.auth.ServiceDescriptor#getPrivilageInformation(java.lang.Enum)
+	 */
+	public <E extends Enum<E> & ServiceDescriptor> String getPrivilageInformation(
+			E role) {
+		if (role.equals(KALAFIOR)) {
+			return "Mambers of ${userRole} can boil kalafiors for ${id}";
+		} else if (role.equals(KAPUSTA)) {
+			return "Members of ${userRole} can boil kapusta for ${id}";
+		}
+
+		return null;
+	}
 }

Modified: labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/auth/ProjectAdminRoles.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/auth/ProjectAdminRoles.java	2008-03-26 15:49:05 UTC (rev 19246)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/auth/ProjectAdminRoles.java	2008-03-26 16:22:17 UTC (rev 19247)
@@ -1,25 +1,25 @@
 /*
-* JBoss Labs. http://labs.jboss.com/jbosslabs
-*
-* Copyright © 2008  Red Hat Middleware, LLC. All rights reserved.
-*
-* This copyrighted material is made available to anyone wishing to use,
-* modify, copy, or redistribute it subject to the terms and conditions
-* of the GNU Lesser General Public License, v. 2.1.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT A WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License, v.2.1 along with this distribution; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-* 02110-1301, USA.
-*
-* Red Hat Author(s): Bob McWhirter, Przemyslaw Dej, Ryszard Kozmik,
-*     Tomasz Szymanski, Adam Warski, Pawel Wrzeszcz
-*/
+ * JBoss Labs. http://labs.jboss.com/jbosslabs
+ *
+ * Copyright © 2008  Red Hat Middleware, LLC. All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT A WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License, v.2.1 along with this distribution; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ * Red Hat Author(s): Bob McWhirter, Przemyslaw Dej, Ryszard Kozmik,
+ *     Tomasz Szymanski, Adam Warski, Pawel Wrzeszcz
+ */
 
 package org.jboss.labs.admin.auth;
 
@@ -27,18 +27,32 @@
 
 public enum ProjectAdminRoles implements ServiceDescriptor {
 
-    PROJECT_ADMIN;
+	PROJECT_ADMIN;
 
-    public <E extends Enum<E> & ServiceDescriptor> String getDescription(E role) {
+	public <E extends Enum<E> & ServiceDescriptor> String getDescription(E role) {
 
-       if (role.equals(PROJECT_ADMIN)) {
-           return "Project lead";
-       }
+		if (role.equals(PROJECT_ADMIN)) {
+			return "Project lead";
+		}
 
-       return null;
-    }
+		return null;
+	}
 
-    public String getServiceDescription() {
-        return "Project Administration";
-    }
+	public String getServiceDescription() {
+		return "Project Administration";
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.jboss.labs.auth.ServiceDescriptor#getPrivilageInformation()
+	 */
+	public <E extends Enum<E> & ServiceDescriptor> String getPrivilageInformation(
+			E role) {
+		if (role.equals(PROJECT_ADMIN)) {
+			return "Members of ${userRole} are allowed to administer ${id}";
+		}
+
+		return null;
+	}
 }
\ No newline at end of file

Modified: labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/auth/AuthViewRoles.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/auth/AuthViewRoles.java	2008-03-26 15:49:05 UTC (rev 19246)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/auth/AuthViewRoles.java	2008-03-26 16:22:17 UTC (rev 19247)
@@ -51,4 +51,16 @@
 		return "Role-binding authentication service";
 	}
 
+	/* (non-Javadoc)
+	 * @see org.jboss.labs.auth.ServiceDescriptor#getPrivilageInformation(java.lang.Enum)
+	 */
+	public <E extends Enum<E> & ServiceDescriptor> String getPrivilageInformation(
+			E role) {
+		if (role.equals(PRJ_BINDER)) {
+			return "Members of ${userRole} are allowed to bind roles in ${id}";
+		} else {
+			return null;
+		}
+	}
+
 }

Modified: labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/GlobalBinderAction.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/GlobalBinderAction.java	2008-03-26 15:49:05 UTC (rev 19246)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/GlobalBinderAction.java	2008-03-26 16:22:17 UTC (rev 19247)
@@ -26,6 +26,7 @@
 
 import javax.faces.event.ValueChangeEvent;
 
+import org.jboss.labs.auth.PrivDescriptionBuilder;
 import org.jboss.labs.auth.RoleBinderService;
 import org.jboss.labs.auth.ViewHelper;
 import org.jboss.labs.core.model.auth.ServiceRole;
@@ -75,7 +76,7 @@
 			try {
 				binderService.bindRolesGlobal(currentServiceRole, currentRole);
 				ViewHelper.addMessage("Role bound");
-				
+
 				Events.instance().raiseEvent(CLEAR_GLOBAL_ROLES);
 			} catch (NoSuchUserRoleException e) {
 				ViewHelper.addErrorMessage(e);
@@ -88,11 +89,12 @@
 		Events.instance().raiseEvent(CLEAR_USERROLE, event);
 		Events.instance().raiseEvent(CLEAR_GLOBAL_ROLES);
 	}
-	
+
 	public void deleteBinding() {
 		if (currentRole != null && currentServiceRole != null) {
 			try {
-				binderService.removeBindingGlobal(currentServiceRole, currentRole);
+				binderService.removeBindingGlobal(currentServiceRole,
+						currentRole);
 				Events.instance().raiseEvent(CLEAR_GLOBAL_ROLES);
 				ViewHelper.addMessage("Binding deleted");
 			} catch (NoSuchUserRoleException e) {
@@ -101,4 +103,13 @@
 		}
 	}
 
+	public String getPrivilageDescription() {
+		if (currentServiceRole != null && currentRole != null) {
+			return PrivDescriptionBuilder.getDescriptionGlobal(
+					currentServiceRole.getPrivilageInformation(), currentRole);
+		}
+
+		return "Please choose service role and user role";
+	}
+
 }

Modified: labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/ProjectBinderAction.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/ProjectBinderAction.java	2008-03-26 15:49:05 UTC (rev 19246)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/ProjectBinderAction.java	2008-03-26 16:22:17 UTC (rev 19247)
@@ -24,6 +24,7 @@
 
 import static org.jboss.labs.auth.AuthViewEvents.CLEAR_GLOBAL_ROLES;
 
+import org.jboss.labs.auth.PrivDescriptionBuilder;
 import org.jboss.labs.auth.RoleBinderService;
 import org.jboss.labs.auth.ViewHelper;
 import org.jboss.labs.core.model.Project;
@@ -34,6 +35,7 @@
 import org.jboss.seam.annotations.In;
 import org.jboss.seam.annotations.Name;
 import org.jboss.seam.core.Events;
+import org.jboss.seam.faces.FacesContext;
 
 import com.google.inject.Inject;
 
@@ -62,7 +64,7 @@
 			try {
 				binderService.bindRolesWithProject(currentServiceRole,
 						currentRole, currentProject.getProjectId());
-				
+
 				ViewHelper.addMessage("Role bound");
 
 				Events.instance().raiseEvent(CLEAR_GLOBAL_ROLES);
@@ -71,4 +73,14 @@
 			}
 		}
 	}
+
+	public String getPrivilageDescription() {
+		if (currentServiceRole != null && currentProject != null
+				&& currentRole != null) {
+			return PrivDescriptionBuilder.getDescription(currentServiceRole
+					.getPrivilageInformation(), currentRole, currentProject);
+		}
+
+		return "Please choose service role, project and user role";
+	}
 }

Added: labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/ReviewPrivilegesAction.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/ReviewPrivilegesAction.java	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/ReviewPrivilegesAction.java	2008-03-26 16:22:17 UTC (rev 19247)
@@ -0,0 +1,83 @@
+/*
+ * JBoss Labs. http://labs.jboss.com/jbosslabs
+ * 
+ * Copyright (C) 2008  Red Hat Middleware, LLC. All rights reserved.
+ * 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT A WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License, v.2.1 along with this distribution; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ * 
+ * Red Hat Author(s): Bob McWhirter, Przemyslaw Dej, Ryszard Kozmik, 
+ * 	Tomasz Szymanski, Adam Warski, Pawel Wrzeszcz
+ */
+package org.jboss.labs.view.auth.action;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.labs.auth.PrivDescriptionBuilder;
+import org.jboss.labs.auth.RoleBinderService;
+import org.jboss.labs.core.model.auth.AuthID;
+import org.jboss.labs.core.model.auth.ServiceRole;
+import org.jboss.labs.core.model.auth.UserRole;
+import org.jboss.labs.injection.seam.Guice;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+
+import com.google.inject.Inject;
+
+/**
+ * @author tomaszszymanski
+ * 
+ */
+ at Name("reviewPrivs")
+ at Guice
+public class ReviewPrivilegesAction {
+
+	@Inject
+	private RoleBinderService binderService;
+
+	@In(value = "#{users.currentRole}", required = false)
+	private UserRole currentRole;
+
+	public ReviewPrivilegesAction() {
+
+	}
+
+	public List<String> getRolePrivList() {
+		List<String> privs = new ArrayList<String>();
+
+		if (currentRole != null) {
+			// add global roles
+			for (ServiceRole sr : currentRole.getServiceRoles()) {
+				privs.add(PrivDescriptionBuilder.getDescriptionGlobal(sr
+						.getPrivilageInformation(), currentRole));
+			}
+
+			// add authid bindings (project and customid)
+			Map<AuthID, Set<ServiceRole>> bindings = binderService
+					.getBindingsForUserRole(currentRole);
+
+			for (AuthID authId : bindings.keySet()) {
+				for (ServiceRole sr : bindings.get(authId)) {
+					privs.add(PrivDescriptionBuilder.getDescription(sr
+							.getPrivilageInformation(), currentRole, authId));
+				}
+			}
+		}
+
+		return privs;
+	}
+}

Modified: labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/UserManager.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/UserManager.java	2008-03-26 15:49:05 UTC (rev 19246)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/UserManager.java	2008-03-26 16:22:17 UTC (rev 19247)
@@ -66,12 +66,18 @@
 	@Inject
 	private UserService userService;
 
-	@DataModelSelection
+	@DataModelSelection(value = "allRoles")
 	private UserRole currentRole;
 
 	@DataModel
 	private List<UserRole> allRoles;
 
+	@DataModelSelection(value = "allUsers")
+	private User currentUser;
+
+	@DataModel
+	private List<User> allUsers;
+
 	private List<User> usersInRole;
 
 	@In(required = false)
@@ -85,6 +91,11 @@
 		allRoles = new Vector<UserRole>(userService.getAllUserRoles());
 	}
 
+	@Factory("allUsers")
+	public void findUsers() {
+		allUsers = new Vector<User>(userService.getAllUsers());
+	}
+
 	public void setRole() {
 	}
 

Added: labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/grant_superroles.xhtml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/grant_superroles.xhtml	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/grant_superroles.xhtml	2008-03-26 16:22:17 UTC (rev 19247)
@@ -0,0 +1,31 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:s="http://jboss.com/products/seam/taglib"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:f="http://java.sun.com/jsf/core"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:rich="http://richfaces.org/rich"
+	xmlns:a4j="http://richfaces.org/a4j" template="/layout/template.xhtml">
+
+	<ui:define name="body">
+
+		<a4j:form>
+			<h:panelGroup>
+				<h:panelGroup id="buttons">
+					<h:outputText value="Privileges list:"></h:outputText>
+					<rich:dataList value="#{reviewPrivs.rolePrivList}" var="priv">
+						<h:outputText value="#{priv}" />
+					</rich:dataList>
+				</h:panelGroup>
+
+				<ui:include src="include/choose_user.xhtml" />
+
+				<!-- ui:include src="include/choose_project.xhtml" />
+				<ui:include src="include/show_userrole.xhtml" /> -->
+
+			</h:panelGroup>
+		</a4j:form>
+
+	</ui:define>
+</ui:composition>

Modified: labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/home.xhtml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/home.xhtml	2008-03-26 15:49:05 UTC (rev 19246)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/home.xhtml	2008-03-26 16:22:17 UTC (rev 19247)
@@ -16,7 +16,7 @@
 				<rich:simpleTogglePanel width="100" opened="false"
 					label="What is this ?" switchType="client">
 	    		This allows you assign global roles (user with a user role can do a specified action for given Service Role in *every* project). 
-	    		For example - we want to make possible that user JohnFoo can edit pages in every project.
+	    		For example - we want to make possible that users from role Foo edit pages in every project.
     		</rich:simpleTogglePanel>
 			</h:panelGroup>
 
@@ -25,9 +25,27 @@
 					rendered="#{permission.allowedGlobal}">Manage project roles</h:outputLink>
 				<rich:simpleTogglePanel width="100" opened="false"
 					label="What is this ?" switchType="client">
-	    		This allows you assign roles to service roles for projects
+	    		This allows you assign roles to service roles for projects. For example you can make users from role Bar edit pages in project FooProject.
     		</rich:simpleTogglePanel>
 			</h:panelGroup>
+
+			<h:panelGroup layout="horizontal">
+				<h:outputLink value="review_privileges.seam"
+					rendered="#{permission.allowedGlobal}">Review privileges</h:outputLink>
+				<rich:simpleTogglePanel width="100" opened="false"
+					label="What is this ?" switchType="client">
+	    		Here you can view all privileges that members of a role have.
+    		</rich:simpleTogglePanel>
+			</h:panelGroup>
+			
+			<h:panelGroup layout="horizontal">
+				<h:outputLink value="grant_superroles.seam"
+					rendered="#{permission.allowedGlobal}">Grant super roles</h:outputLink>
+				<rich:simpleTogglePanel width="100" opened="false"
+					label="What is this ?" switchType="client">
+	    		Here you can grant users super roles.
+    		</rich:simpleTogglePanel>
+			</h:panelGroup>
 		</h:form>
 	</ui:define>
 </ui:composition>

Modified: labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/choose_project.xhtml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/choose_project.xhtml	2008-03-26 15:49:05 UTC (rev 19246)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/choose_project.xhtml	2008-03-26 16:22:17 UTC (rev 19247)
@@ -4,12 +4,12 @@
 	xmlns:f="http://java.sun.com/jsf/core"
 	xmlns:h="http://java.sun.com/jsf/html"
 	xmlns:rich="http://richfaces.org/rich"
-	xmlns:a4j="http://richfaces.org/a4j" template="/layout/template.xhtml">
+	xmlns:a4j="http://richfaces.org/a4j">
 
 	<h:outputText value="Choose project"></h:outputText>
 
 	<h:selectOneRadio id="projectList" value="#{projects.currentProject}">
-		<a4j:support event="onchange" reRender="buttons" />
+		<a4j:support event="onchange" reRender="buttons,privDesc" />
 		<s:selectItems value="#{projects.allProjects}" var="project"
 			label="#{project.name}" itemValue="#{project}" />
 		<f:converter converterId="serviceEntity" />

Modified: labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/choose_service_role.xhtml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/choose_service_role.xhtml	2008-03-26 15:49:05 UTC (rev 19246)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/choose_service_role.xhtml	2008-03-26 16:22:17 UTC (rev 19247)
@@ -4,12 +4,12 @@
 	xmlns:f="http://java.sun.com/jsf/core"
 	xmlns:h="http://java.sun.com/jsf/html"
 	xmlns:rich="http://richfaces.org/rich"
-	xmlns:a4j="http://richfaces.org/a4j" template="/layout/template.xhtml">
+	xmlns:a4j="http://richfaces.org/a4j">
 	
 	<h:outputText value="Choose service"></h:outputText>
 
 	<h:selectOneRadio id="serviceList" value="#{services.currentService}">
-		<a4j:support event="onchange" reRender="serviceRoleList,buttons" />
+		<a4j:support event="onchange" reRender="serviceRoleList,buttons,privDesc" />
 		<s:selectItems value="#{services.allServices}" var="service"
 			label="[#{service.name}] #{service.description}" />
 		<f:converter converterId="serviceEntity" />
@@ -19,7 +19,7 @@
 
 	<h:selectOneRadio id="serviceRoleList"
 		value="#{services.currentServiceRole}" >
-		<a4j:support event="onchange" reRender="buttons" />
+		<a4j:support event="onchange" reRender="buttons,privDesc" />
 		<s:selectItems value="#{services.serviceRoles}" var="serviceRole"
 			label="[#{serviceRole.name}] #{serviceRole.description}"/>
 		<f:converter converterId="serviceEntity" />

Added: labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/choose_user.xhtml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/choose_user.xhtml	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/choose_user.xhtml	2008-03-26 16:22:17 UTC (rev 19247)
@@ -0,0 +1,40 @@
+<h:panelGroup xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:s="http://jboss.com/products/seam/taglib"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:f="http://java.sun.com/jsf/core"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:rich="http://richfaces.org/rich"
+	xmlns:a4j="http://richfaces.org/a4j">
+	
+	<rich:dataTable width="483" id="userList" rows="10" columnClasses="col"
+		value="#{allUsers}" var="user" >
+
+		<f:facet name="header">
+			<rich:columnGroup>
+				<h:column>
+					<h:outputText styleClass="headerText" value="Name" />
+				</h:column>
+				<h:column>
+					<h:outputText styleClass="headerText" value="Name and Lastname" />
+				</h:column>
+				<h:column></h:column>
+			</rich:columnGroup>
+		</f:facet>
+
+		<h:column>
+			<h:outputText value="#{user.name}" />
+		</h:column>
+
+		<h:column>
+			<h:outputText value="#{user.firstName} #{user.lastName}" />
+		</h:column>
+		
+		<h:column>
+			<a4j:commandButton value="Choose" reRender="buttons,privDesc,roleList" action="#{users.setRole}" />
+		</h:column>
+	</rich:dataTable>
+	
+	<rich:spacer height="30" />
+	<rich:datascroller id="listScroller" align="left" for="userList"
+		maxPages="20" />
+</h:panelGroup>
\ No newline at end of file

Modified: labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/choose_user_role.xhtml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/choose_user_role.xhtml	2008-03-26 15:49:05 UTC (rev 19246)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/choose_user_role.xhtml	2008-03-26 16:22:17 UTC (rev 19247)
@@ -4,7 +4,7 @@
 	xmlns:f="http://java.sun.com/jsf/core"
 	xmlns:h="http://java.sun.com/jsf/html"
 	xmlns:rich="http://richfaces.org/rich"
-	xmlns:a4j="http://richfaces.org/a4j" template="/layout/template.xhtml">
+	xmlns:a4j="http://richfaces.org/a4j">
 	
 	<rich:dataTable width="483" id="roleList" rows="10" columnClasses="col"
 		value="#{allRoles}" var="role" rowClasses="#{users.rowClasses}">
@@ -30,7 +30,7 @@
 		</h:column>
 		
 		<h:column>
-			<a4j:commandButton value="Choose" reRender="buttons" action="#{users.setRole}" />
+			<a4j:commandButton value="Choose" reRender="buttons,privDesc,roleList" action="#{users.setRole}" />
 		</h:column>
 	</rich:dataTable>
 	

Modified: labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/show_userrole.xhtml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/show_userrole.xhtml	2008-03-26 15:49:05 UTC (rev 19246)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/show_userrole.xhtml	2008-03-26 16:22:17 UTC (rev 19247)
@@ -4,7 +4,7 @@
 	xmlns:f="http://java.sun.com/jsf/core"
 	xmlns:h="http://java.sun.com/jsf/html"
 	xmlns:rich="http://richfaces.org/rich"
-	xmlns:a4j="http://richfaces.org/a4j" template="/layout/template.xhtml">
+	xmlns:a4j="http://richfaces.org/a4j">
 
 	<a4j:outputPanel id="selectedRole">
 		<h:panelGroup layout="vertical"

Modified: labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/manage_global.xhtml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/manage_global.xhtml	2008-03-26 15:49:05 UTC (rev 19246)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/manage_global.xhtml	2008-03-26 16:22:17 UTC (rev 19247)
@@ -13,17 +13,24 @@
 			valueChangeListener="#{globalBinder.changePanel}">
 			<rich:tab label="Add" name="add" id="addtab">
 				<a4j:form>
+					<h:panelGroup>
+						<rich:panel id="privDesc">
+							<f:facet name="header">
+							What will happen when you bind this role ?
+							</f:facet>
+							#{globalBinder.privilageDescription}
+						</rich:panel>
 
-					<ui:include src="include/choose_service_role.xhtml" />
+						<ui:include src="include/choose_service_role.xhtml" />
 
-					<ui:include src="include/choose_user_role.xhtml" />
+						<ui:include src="include/choose_user_role.xhtml" />
 
-					<h:panelGroup id="buttons">
-						<a4j:commandButton action="#{globalBinder.add}" value="Bind"
-							reRender="viewtab"
-							disabled="#{services.currentServiceRole == null or users.currentRole == null}" />
+						<h:panelGroup id="buttons">
+							<a4j:commandButton action="#{globalBinder.add}" value="Bind"
+								reRender="viewtab"
+								disabled="#{services.currentServiceRole == null or users.currentRole == null}" />
+						</h:panelGroup>
 					</h:panelGroup>
-
 				</a4j:form>
 			</rich:tab>
 			<rich:tab label="View/Edit" name="view" id="viewtab">
@@ -59,9 +66,9 @@
 								reRender="globalRolesTree,buttons" />
 						</h:panelGroup>
 					</a4j:form>
-					
+
 					<ui:include src="include/show_userrole.xhtml" />
-					
+
 				</h:panelGrid>
 			</rich:tab>
 		</rich:tabPanel>

Modified: labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/manage_project.xhtml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/manage_project.xhtml	2008-03-26 15:49:05 UTC (rev 19246)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/manage_project.xhtml	2008-03-26 16:22:17 UTC (rev 19247)
@@ -13,19 +13,26 @@
 			valueChangeListener="#{globalBinder.changePanel}">
 			<rich:tab label="Add" name="add" id="addtab">
 				<a4j:form>
+					<h:panelGroup>
+						<rich:panel id="privDesc">
+							<f:facet name="header">
+								What will happen when you bind this role ?
+							</f:facet>
+							#{projectBinder.privilageDescription}
+						</rich:panel>
 
-					<ui:include src="include/choose_service_role.xhtml" />
+						<ui:include src="include/choose_service_role.xhtml" />
 
-					<ui:include src="include/choose_project.xhtml" />
+						<ui:include src="include/choose_project.xhtml" />
 
-					<ui:include src="include/choose_user_role.xhtml" />
+						<ui:include src="include/choose_user_role.xhtml" />
 
-					<h:panelGroup id="buttons">
-						<a4j:commandButton action="#{projectBinder.add}" value="Bind"
-							reRender="viewtab"
-							disabled="#{services.currentServiceRole == null or users.currentRole == null or projects.currentProject == null}" />
+						<h:panelGroup id="buttons">
+							<a4j:commandButton action="#{projectBinder.add}" value="Bind"
+								reRender="viewtab"
+								disabled="#{services.currentServiceRole == null or users.currentRole == null or projects.currentProject == null}" />
+						</h:panelGroup>
 					</h:panelGroup>
-
 				</a4j:form>
 			</rich:tab>
 			<rich:tab label="View/Edit" name="view" id="viewtab">
@@ -33,7 +40,8 @@
 					<a4j:form>
 						<rich:tree switchType="ajax" value="#{services.projectRolesTree}"
 							var="item" id="projectRolesTree" ajaxSubmitSelection="true"
-							reRender="selectedRole,buttons" nodeSelectListener="#{users.selectUserRoleNode}"
+							reRender="selectedRole,buttons"
+							nodeSelectListener="#{users.selectUserRoleNode}"
 							nodeFace="#{item.class.name}">
 
 							<rich:treeNode type="org.jboss.labs.core.model.auth.Service">
@@ -47,7 +55,7 @@
 							<rich:treeNode type="org.jboss.labs.core.model.auth.UserRole">
 								<h:outputText value="[UserRole] #{item.id}" />
 							</rich:treeNode>
-							
+
 							<rich:treeNode type="org.jboss.labs.core.model.auth.ProjectID">
 								<h:outputText value="[Project] #{item.authId}" />
 							</rich:treeNode>
@@ -65,9 +73,9 @@
 								reRender="globalRolesTree,buttons" />
 						</h:panelGroup>
 					</a4j:form>
-					
+
 					<ui:include src="include/show_userrole.xhtml" />
-					
+
 				</h:panelGrid>
 			</rich:tab>
 		</rich:tabPanel>

Added: labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/review_privileges.xhtml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/review_privileges.xhtml	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/review_privileges.xhtml	2008-03-26 16:22:17 UTC (rev 19247)
@@ -0,0 +1,30 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:s="http://jboss.com/products/seam/taglib"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:f="http://java.sun.com/jsf/core"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:rich="http://richfaces.org/rich"
+	xmlns:a4j="http://richfaces.org/a4j" template="/layout/template.xhtml">
+
+	<ui:define name="body">
+
+		<a4j:form>
+			<h:panelGroup>
+				<h:panelGroup id="buttons">
+					<h:outputText value="Privileges list:"></h:outputText>
+					<rich:dataList value="#{reviewPrivs.rolePrivList}" var="priv">
+						<h:outputText value="#{priv}" />
+					</rich:dataList>
+				</h:panelGroup>
+
+				<ui:include src="include/choose_user_role.xhtml" />
+
+				<ui:include src="include/show_userrole.xhtml" />
+
+			</h:panelGroup>
+		</a4j:form>
+
+	</ui:define>
+</ui:composition>

Modified: labs/jbosslabs/labs-3.0-build/views/labs-test/src/main/java/org/jboss/labs/test/credential/TestRoles.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/labs-test/src/main/java/org/jboss/labs/test/credential/TestRoles.java	2008-03-26 15:49:05 UTC (rev 19246)
+++ labs/jbosslabs/labs-3.0-build/views/labs-test/src/main/java/org/jboss/labs/test/credential/TestRoles.java	2008-03-26 16:22:17 UTC (rev 19247)
@@ -58,4 +58,18 @@
 	public String getServiceDescription() {
 		return "Test service user for testing.";
 	}
+
+	/* (non-Javadoc)
+	 * @see org.jboss.labs.auth.ServiceDescriptor#getPrivilageInformation(java.lang.Enum)
+	 */
+	public <E extends Enum<E> & ServiceDescriptor> String getPrivilageInformation(
+			E role) {
+		if (role.equals(ADMIN)) {
+			return "Memebers of ${userRole} can test-admin in ${id}";
+		} else if (role.equals(KOPYTKO)) {
+			return "Memebers of ${userRole} can make kopytkos in ${id}";
+		}
+		
+		return null;
+	}
 }




More information about the jboss-svn-commits mailing list