[jboss-svn-commits] JBL Code SVN: r18713 - in labs/jbosslabs/labs-3.0-build: core/core-model/src/main/java/org/jboss/labs/core/model/auth and 5 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Mar 6 03:41:05 EST 2008
Author: szimano
Date: 2008-03-06 03:41:05 -0500 (Thu, 06 Mar 2008)
New Revision: 18713
Added:
labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/ServiceDescriptor.java
labs/jbosslabs/labs-3.0-build/views/auth/
Modified:
labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/AuthenticationService.java
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-model/src/main/java/org/jboss/labs/core/model/auth/Service.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/services/credential/src/main/java/org/jboss/labs/auth/impl/AuthenticationServiceImpl.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/foo-service/src/main/java/org/jboss/labs/FooRoleList.java
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/pom.xml
Log:
description for roles and service
Modified: labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/AuthenticationService.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/AuthenticationService.java 2008-03-06 07:39:25 UTC (rev 18712)
+++ labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/AuthenticationService.java 2008-03-06 08:41:05 UTC (rev 18713)
@@ -49,7 +49,7 @@
* @return True if a user is authorized. False otherwise.
* @throws NoSuchUserException
*/
- public <E extends Enum<E>> boolean isAllowedProject(Principal user,
+ public <E extends Enum<E> & ServiceDescriptor> boolean isAllowedProject(Principal user,
E serviceRole, String projectId) throws NoSuchUserException;
/**
@@ -73,7 +73,7 @@
* @see org.jboss.labs.core.model.auth.CustomID
* @see org.jboss.labs.auth.custom.CustomIDProvider
*/
- public <E extends Enum<E>> boolean isAllowedCustom(Principal user,
+ public <E extends Enum<E> & ServiceDescriptor> boolean isAllowedCustom(Principal user,
E serviceRole, CustomID customId) throws NoSuchUserException,
NoSuchCustomIDException;
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-06 07:39:25 UTC (rev 18712)
+++ labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/RoleBinderService.java 2008-03-06 08:41:05 UTC (rev 18713)
@@ -56,7 +56,7 @@
* @param serviceRoleList
* List of service roles
*/
- public <E extends Enum<E>> void exposeServiceRoles(E[] serviceRoleList);
+ public <E extends Enum<E> & ServiceDescriptor> void exposeServiceRoles(E[] serviceRoleList);
/**
* Exposes service roles to authentication service and registers custom id
@@ -70,7 +70,7 @@
* Provider to register
* @see org.jboss.labs.auth.custom.CustomIDProvider
*/
- public <E extends Enum<E>> void exposeServiceRolesAndRegisterCustomIDProvider(
+ public <E extends Enum<E> & ServiceDescriptor> void exposeServiceRolesAndRegisterCustomIDProvider(
E[] serviceRoleList, CustomIDProvider provider);
/**
@@ -87,7 +87,7 @@
* @throws NoSuchUserRoleException
* @throws BindingAlreadyExistsException
*/
- public <E extends Enum<E>> void bindRolesWithProject(E serviceRole,
+ public <E extends Enum<E> & ServiceDescriptor> void bindRolesWithProject(E serviceRole,
UserRole role, String projectId) throws NoSuchUserRoleException,
BindingAlreadyExistsException;
@@ -111,7 +111,7 @@
* @see org.jboss.labs.core.model.auth.CustomID
* @see org.jboss.labs.auth.custom.CustomIDProvider
*/
- public <E extends Enum<E>> void bindRolesWithId(E serviceRole,
+ public <E extends Enum<E> & ServiceDescriptor> void bindRolesWithId(E serviceRole,
UserRole role, CustomID customId) throws NoSuchUserRoleException,
BindingAlreadyExistsException, NoSuchCustomIDException;
@@ -127,7 +127,7 @@
* @param role
* User role
*/
- public <E extends Enum<E>> void bindRolesGlobal(E serviceRole, UserRole role)
+ public <E extends Enum<E> & ServiceDescriptor> void bindRolesGlobal(E serviceRole, UserRole role)
throws NoSuchUserRoleException;
/**
@@ -192,7 +192,7 @@
* Service role
* @return Service role object
*/
- public <E extends Enum<E>> ServiceRole getServiceRole(E serviceRole);
+ public <E extends Enum<E> & ServiceDescriptor> ServiceRole getServiceRole(E serviceRole);
/**
* Returns entity of project id. Creates new one if it's not in the
@@ -222,7 +222,7 @@
* Project id
* @throws NoSuchUserRoleException
*/
- public <E extends Enum<E>> void removeBindingWithProject(E serviceRole,
+ public <E extends Enum<E> & ServiceDescriptor> void removeBindingWithProject(E serviceRole,
UserRole role, String projectId) throws NoSuchUserRoleException;
/**
@@ -239,7 +239,7 @@
* @throws NoSuchCustomIDException
* If custom id doesn't exist
*/
- public <E extends Enum<E>> void removeBindingWithId(E serviceRole,
+ public <E extends Enum<E> & ServiceDescriptor> void removeBindingWithId(E serviceRole,
UserRole role, CustomID customId) throws NoSuchUserRoleException,
NoSuchCustomIDException;
@@ -252,7 +252,7 @@
* User role
* @throws NoSuchUserRoleException
*/
- public <E extends Enum<E>> void removeBindingGlobal(E serviceRole,
+ public <E extends Enum<E> & ServiceDescriptor> void removeBindingGlobal(E serviceRole,
UserRole role) throws NoSuchUserRoleException;
/**
@@ -280,5 +280,5 @@
* Service role
* @return Service object
*/
- public <E extends Enum<E>> Service getService(E... serviceRoleList);
+ public <E extends Enum<E> & ServiceDescriptor> Service getService(E... serviceRoleList);
}
Added: 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 (rev 0)
+++ labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/ServiceDescriptor.java 2008-03-06 08:41:05 UTC (rev 18713)
@@ -0,0 +1,50 @@
+/**
+ *
+ */
+package org.jboss.labs.auth;
+
+/*
+ * 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
+ */
+
+/**
+ * @author tomaszszymanski
+ *
+ */
+public interface ServiceDescriptor {
+
+ /**
+ * Gets description for role
+ *
+ * @param <E>
+ * Role from Enum.
+ * @param role
+ * Role to get description for
+ * @return Description for role
+ */
+ public <E extends Enum<E> & ServiceDescriptor> String getDescription(E role);
+
+ /**
+ * @return Returns description for this service
+ */
+ public String getServiceDescription();
+}
Modified: labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/core/model/auth/Service.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/core/model/auth/Service.java 2008-03-06 07:39:25 UTC (rev 18712)
+++ labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/core/model/auth/Service.java 2008-03-06 08:41:05 UTC (rev 18713)
@@ -63,6 +63,8 @@
@Transient
private Map<String, ServiceRole> rolesMap;
+
+ private String description;
@PostLoad
public void refreshRoleMap() {
@@ -99,7 +101,7 @@
public Service() {
}
- public Service(String id) {
+ public Service(String id, String description) {
this.id = id;
}
@@ -164,4 +166,12 @@
return false;
}
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
}
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-06 07:39:25 UTC (rev 18712)
+++ labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/core/model/auth/ServiceRole.java 2008-03-06 08:41:05 UTC (rev 18713)
@@ -47,6 +47,8 @@
private String id;
private Boolean available;
+
+ private String description;
@ManyToOne
private Service service;
@@ -69,7 +71,7 @@
public ServiceRole() {
}
- public ServiceRole(String id, Service service) {
+ public ServiceRole(String id, Service service, String description) {
this.id = id;
available = true;
this.service = service;
@@ -137,4 +139,12 @@
globalRoles.remove(roleEn);
}
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
}
Modified: labs/jbosslabs/labs-3.0-build/services/credential/src/main/java/org/jboss/labs/auth/impl/AuthenticationServiceImpl.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/services/credential/src/main/java/org/jboss/labs/auth/impl/AuthenticationServiceImpl.java 2008-03-06 07:39:25 UTC (rev 18712)
+++ labs/jbosslabs/labs-3.0-build/services/credential/src/main/java/org/jboss/labs/auth/impl/AuthenticationServiceImpl.java 2008-03-06 08:41:05 UTC (rev 18713)
@@ -33,6 +33,7 @@
import org.jboss.labs.auth.AuthenticationService;
import org.jboss.labs.auth.RoleBinderService;
+import org.jboss.labs.auth.ServiceDescriptor;
import org.jboss.labs.auth.UserService;
import org.jboss.labs.auth.custom.CustomIDService;
import org.jboss.labs.core.model.auth.AuthID;
@@ -60,7 +61,7 @@
@PersistenceContext(name = "auth_model")
private EntityManager manager;
- public <E extends Enum<E>> boolean isAllowedProject(Principal user,
+ public <E extends Enum<E> & ServiceDescriptor> boolean isAllowedProject(Principal user,
E serviceRole, String projectId) throws NoSuchUserException {
User userEn = userService.getUserByLogin(user.getName());
ServiceRole sRole = binderService.getServiceRole(serviceRole);
@@ -69,7 +70,7 @@
return isAllowed(userEn, sRole, pid);
}
- public <E extends Enum<E>> boolean isAllowedCustom(Principal user,
+ public <E extends Enum<E> & ServiceDescriptor> boolean isAllowedCustom(Principal user,
E serviceRole, CustomID customId) throws NoSuchUserException, NoSuchCustomIDException {
// refresh list of custom ids
customIDService.getCustomIDs(binderService.getService(serviceRole));
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-06 07:39:25 UTC (rev 18712)
+++ labs/jbosslabs/labs-3.0-build/services/credential/src/main/java/org/jboss/labs/auth/impl/RoleBinderServiceImpl.java 2008-03-06 08:41:05 UTC (rev 18713)
@@ -35,6 +35,7 @@
import org.apache.log4j.Logger;
import org.jboss.labs.auth.AuthHelper;
import org.jboss.labs.auth.RoleBinderService;
+import org.jboss.labs.auth.ServiceDescriptor;
import org.jboss.labs.auth.UserService;
import org.jboss.labs.auth.custom.CustomIDProvider;
import org.jboss.labs.auth.custom.CustomIDService;
@@ -72,7 +73,7 @@
private final static Logger log = Logger
.getLogger(RoleBinderServiceImpl.class);
- public <E extends Enum<E>> void bindRolesWithId(E serviceRole,
+ public <E extends Enum<E> & ServiceDescriptor> void bindRolesWithId(E serviceRole,
UserRole role, CustomID customId) throws NoSuchUserRoleException,
BindingAlreadyExistsException, NoSuchCustomIDException {
@@ -90,7 +91,7 @@
}
- public <E extends Enum<E>> void bindRolesWithProject(E serviceRole,
+ public <E extends Enum<E> & ServiceDescriptor> void bindRolesWithProject(E serviceRole,
UserRole role, String projectId) throws NoSuchUserRoleException,
BindingAlreadyExistsException {
@@ -100,7 +101,7 @@
}
- private <E extends Enum<E>> void bindRolesWith(E serviceRole,
+ private <E extends Enum<E> & ServiceDescriptor> void bindRolesWith(E serviceRole,
UserRole role, AuthID authID) throws NoSuchUserRoleException,
BindingAlreadyExistsException {
ServiceRole srEn = getServiceRole(serviceRole);
@@ -147,7 +148,7 @@
}
}
- public <E extends Enum<E>> void exposeServiceRoles(E[] serviceRoleList) {
+ public <E extends Enum<E> & ServiceDescriptor> void exposeServiceRoles(E[] serviceRoleList) {
Service service = getService(serviceRoleList);
// get all current roles
@@ -158,11 +159,15 @@
ServiceRole sr = service.getServiceRole(role);
if (sr == null) {
- sr = new ServiceRole(AuthHelper.getServiceRoleID(role), service);
+ sr = new ServiceRole(AuthHelper.getServiceRoleID(role), service, role.getDescription(role));
manager.persist(sr);
service.addServiceRole(sr);
}
+ else {
+ sr.setDescription(role.getDescription(role));
+ manager.merge(sr);
+ }
// this role is still available - remove it from the previous list
existingRoles.remove(sr);
@@ -178,7 +183,7 @@
manager.merge(service);
}
- public <E extends Enum<E>> void exposeServiceRolesAndRegisterCustomIDProvider(
+ public <E extends Enum<E> & ServiceDescriptor> void exposeServiceRolesAndRegisterCustomIDProvider(
E[] serviceRoleList, CustomIDProvider provider) {
exposeServiceRoles(serviceRoleList);
@@ -189,7 +194,7 @@
customIDService.getCustomIDs(getService(serviceRoleList));
}
- public <E extends Enum<E>> void bindRolesGlobal(E serviceRole, UserRole role)
+ public <E extends Enum<E> & ServiceDescriptor> void bindRolesGlobal(E serviceRole, UserRole role)
throws NoSuchUserRoleException {
ServiceRole serviceRoleEn = getServiceRole(serviceRole);
UserRole userRoleEn = userService.getUserRole(role);
@@ -215,7 +220,7 @@
grantUserProjectSuperrole(user, AuthHelper.GLOBAL_PROJECT);
}
- public <E extends Enum<E>> ServiceRole getServiceRole(E serviceRole)
+ public <E extends Enum<E> & ServiceDescriptor> ServiceRole getServiceRole(E serviceRole)
throws NoSuchServiceRoleException {
ServiceRole serviceRoleEn = manager.find(ServiceRole.class, AuthHelper
.getServiceRoleID(serviceRole));
@@ -230,7 +235,7 @@
return serviceRoleEn;
}
- public <E extends Enum<E>> Service getService(E... serviceRoleList) {
+ public <E extends Enum<E> & ServiceDescriptor> Service getService(E... serviceRoleList) {
if (serviceRoleList.length == 0) {
throw new RuntimeException(
"Service role list has to have at least one role");
@@ -240,7 +245,7 @@
.getServiceID(serviceRoleList[0]));
if (service == null) {
- service = new Service(AuthHelper.getServiceID(serviceRoleList[0]));
+ service = new Service(AuthHelper.getServiceID(serviceRoleList[0]), serviceRoleList[0].getServiceDescription());
service.init();
}
@@ -300,7 +305,7 @@
* @see org.jboss.labs.auth.RoleBinderService#removeBindingGlobal(java.lang.Enum,
* org.jboss.labs.core.model.auth.UserRole)
*/
- public <E extends Enum<E>> void removeBindingGlobal(E serviceRole,
+ public <E extends Enum<E> & ServiceDescriptor> void removeBindingGlobal(E serviceRole,
UserRole role) throws NoSuchUserRoleException {
ServiceRole srEn = getServiceRole(serviceRole);
UserRole roleEn = userService.getUserRole(role);
@@ -319,7 +324,7 @@
* org.jboss.labs.core.model.auth.UserRole,
* org.jboss.labs.core.model.auth.CustomID)
*/
- public <E extends Enum<E>> void removeBindingWithId(E serviceRole,
+ public <E extends Enum<E> & ServiceDescriptor> void removeBindingWithId(E serviceRole,
UserRole role, CustomID customId) throws NoSuchUserRoleException,
NoSuchCustomIDException {
// get custom IDs - this will persist new ones
@@ -341,12 +346,12 @@
* @see org.jboss.labs.auth.RoleBinderService#removeBindingWithProject(java.lang.Enum,
* org.jboss.labs.core.model.auth.UserRole, java.lang.String)
*/
- public <E extends Enum<E>> void removeBindingWithProject(E serviceRole,
+ public <E extends Enum<E> & ServiceDescriptor> void removeBindingWithProject(E serviceRole,
UserRole role, String projectId) throws NoSuchUserRoleException {
removeBindingWith(serviceRole, role, getProjectID(projectId));
}
- private <E extends Enum<E>> void removeBindingWith(E serviceRole,
+ private <E extends Enum<E> & ServiceDescriptor> void removeBindingWith(E serviceRole,
UserRole role, AuthID authID) throws NoSuchUserRoleException {
ServiceRole srEn = getServiceRole(serviceRole);
UserRole roleEn = userService.getUserRole(role);
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-06 07:39:25 UTC (rev 18712)
+++ labs/jbosslabs/labs-3.0-build/services/foo-service/src/main/java/org/jboss/labs/FooRoleList.java 2008-03-06 08:41:05 UTC (rev 18713)
@@ -22,7 +22,32 @@
*/
package org.jboss.labs;
-public enum FooRoleList {
- KALAFIOR,
- KAPUSTA
+import org.jboss.labs.auth.ServiceDescriptor;
+
+public enum FooRoleList implements ServiceDescriptor {
+ KALAFIOR, KAPUSTA;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.labs.auth.ServiceDescriptor#getDescription(java.lang.Enum)
+ */
+ public <E extends Enum<E> & ServiceDescriptor> String getDescription(E role) {
+ if (role == KALAFIOR) {
+ return "Role for all kaliflowers";
+ } else if (role == KAPUSTA) {
+ return "Role for kapusta makers";
+ }
+
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.labs.auth.ServiceDescriptor#getServiceDescription()
+ */
+ public String getServiceDescription() {
+ return "Foo service beeing the most important one";
+ }
}
Property changes on: labs/jbosslabs/labs-3.0-build/views/auth
___________________________________________________________________
Name: svn:ignore
+ target
.classpath
.project
.settings
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-06 07:39:25 UTC (rev 18712)
+++ labs/jbosslabs/labs-3.0-build/views/labs-test/src/main/java/org/jboss/labs/test/credential/TestRoles.java 2008-03-06 08:41:05 UTC (rev 18713)
@@ -3,36 +3,59 @@
*/
package org.jboss.labs.test.credential;
+import org.jboss.labs.auth.ServiceDescriptor;
+
/*
* JBoss Labs. http://labs.jboss.com/jbosslabs
*
- * Copyright © 2008 Red Hat Middleware, LLC. All rights reserved.
+ * 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 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.
+ * 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.
+ * 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
+ * Red Hat Author(s): Bob McWhirter, Przemyslaw Dej, Ryszard Kozmik, Tomasz
+ * Szymanski, Adam Warski, Pawel Wrzeszcz
*/
/**
* @author tomaszszymanski
- *
+ *
*/
-public enum TestRoles {
- ADMIN,
- USER,
- KALAFIOR,
- KOPYTKO
+public enum TestRoles implements ServiceDescriptor {
+ ADMIN, KOPYTKO;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.labs.auth.ServiceDescriptor#getDescription(java.lang.Enum)
+ */
+ public <E extends Enum<E> & ServiceDescriptor> String getDescription(E role) {
+ if (role == ADMIN) {
+ return "Role for all admins";
+ } else if (role == KOPYTKO) {
+ return "Role for kopytko makers";
+ }
+
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.labs.auth.ServiceDescriptor#getServiceDescription()
+ */
+ public String getServiceDescription() {
+ return "Test service user for testing.";
+ }
}
Modified: labs/jbosslabs/labs-3.0-build/views/pom.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/pom.xml 2008-03-06 07:39:25 UTC (rev 18712)
+++ labs/jbosslabs/labs-3.0-build/views/pom.xml 2008-03-06 08:41:05 UTC (rev 18713)
@@ -56,5 +56,6 @@
<module>login</module>
<module>admin</module>
<module>labs-test</module>
+ <module>auth</module>
</modules>
</project>
\ No newline at end of file
More information about the jboss-svn-commits
mailing list