[jboss-svn-commits] JBL Code SVN: r18879 - in labs/jbosslabs/labs-3.0-build: services/credential/src/main/java/org/jboss/labs/auth/impl and 13 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Mar 12 07:30:29 EDT 2008
Author: szimano
Date: 2008-03-12 07:30:29 -0400 (Wed, 12 Mar 2008)
New Revision: 18879
Added:
labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/auth/jsf/
labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/auth/jsf/AuthEntityConverter.java
labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/ProjectsManager.java
labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/ServiceManager.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/java/org/jboss/labs/view/auth/action/org/
labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/org/jboss/
labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/org/jboss/labs/
labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/org/jboss/labs/view/
labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/org/jboss/labs/view/auth/
labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/org/jboss/labs/view/auth/action/
labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/META-INF/persistence.xml
labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/views/manage_project.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/services/credential/src/main/java/org/jboss/labs/auth/impl/RoleBinderServiceImpl.java
labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/PermissionCheckerBean.java
labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/WEB-INF/components.xml
labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/WEB-INF/faces-config.xml
labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/home.xhtml
labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/layout/menu.xhtml
labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/layout/template.xhtml
labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/views/manage_global.xhtml
Log:
little change to role binder service, global manager in auth JBLAB-901
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-12 09:14:44 UTC (rev 18878)
+++ labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/RoleBinderService.java 2008-03-12 11:30:29 UTC (rev 18879)
@@ -289,9 +289,27 @@
E... serviceRoleList);
/**
+ * Returns service by it's ID.
+ *
+ * @param serviceId
+ * Service id.
+ * @return Service or null if it doesn't exist
+ */
+ public Service getService(String serviceId);
+
+ /**
* Returns a list of all registered services
*
* @return List of services
*/
public Set<Service> getAllServices();
+
+ /**
+ * Returns service role with given id
+ *
+ * @param serviceRoleId
+ * Service role id
+ * @return Service Role or null if it doesn't exist
+ */
+ public ServiceRole getServiceRole(String serviceRoleId);
}
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-12 09:14:44 UTC (rev 18878)
+++ labs/jbosslabs/labs-3.0-build/services/credential/src/main/java/org/jboss/labs/auth/impl/RoleBinderServiceImpl.java 2008-03-12 11:30:29 UTC (rev 18879)
@@ -418,4 +418,20 @@
return new TreeSet<Service>(sr);
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.labs.auth.RoleBinderService#getService(java.lang.String)
+ */
+ public Service getService(String serviceId) {
+ return manager.find(Service.class, serviceId);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.labs.auth.RoleBinderService#getServiceRole(java.lang.String)
+ */
+ public ServiceRole getServiceRole(String serviceRoleId) {
+ return manager.find(ServiceRole.class, serviceRoleId);
+ }
+
}
Added: labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/auth/jsf/AuthEntityConverter.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/auth/jsf/AuthEntityConverter.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/auth/jsf/AuthEntityConverter.java 2008-03-12 11:30:29 UTC (rev 18879)
@@ -0,0 +1,94 @@
+/*
+ * 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.jsf;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+
+import org.jboss.labs.auth.RoleBinderService;
+import org.jboss.labs.core.model.auth.Service;
+import org.jboss.labs.core.model.auth.ServiceRole;
+import org.jboss.labs.injection.LabsInjection;
+
+import com.google.inject.Inject;
+
+/**
+ * @author tomaszszymanski
+ *
+ */
+public class AuthEntityConverter implements Converter {
+
+ private final static String SERVICE = "service:";
+ private final static String SERVICE_ROLE = "service_role:";
+
+ @Inject
+ private RoleBinderService binderService;
+
+ public AuthEntityConverter() {
+ super();
+
+ // inject google guice stuff
+ LabsInjection.getInjector().injectMembers(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.convert.Converter#getAsObject(javax.faces.context.FacesContext,
+ * javax.faces.component.UIComponent, java.lang.String)
+ */
+ @SuppressWarnings("unchecked")
+ public Object getAsObject(FacesContext ctx, UIComponent component,
+ String objStr) {
+ if (objStr.startsWith(SERVICE)) {
+ return binderService.getService(objStr.substring(SERVICE.length()));
+ }
+ else if (objStr.startsWith(SERVICE_ROLE)) {
+ return binderService.getServiceRole(objStr.substring(SERVICE.length()));
+ }
+ else {
+ return null;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.convert.Converter#getAsString(javax.faces.context.FacesContext,
+ * javax.faces.component.UIComponent, java.lang.Object)
+ */
+ public String getAsString(FacesContext ctx, UIComponent component,
+ Object objInstance) {
+ if (objInstance instanceof Service) {
+ return SERVICE + ((Service) objInstance).getId();
+ }
+ else if (objInstance instanceof ServiceRole) {
+ return SERVICE_ROLE + ((ServiceRole) objInstance).getId();
+ }
+ else {
+ return null;
+ }
+ }
+
+}
Modified: labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/PermissionCheckerBean.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/PermissionCheckerBean.java 2008-03-12 09:14:44 UTC (rev 18878)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/PermissionCheckerBean.java 2008-03-12 11:30:29 UTC (rev 18879)
@@ -22,9 +22,7 @@
*/
package org.jboss.labs.view.auth.action;
-import javax.annotation.PostConstruct;
import javax.ejb.Remove;
-import javax.ejb.Stateful;
import javax.faces.context.FacesContext;
import org.jboss.labs.auth.AuthViewRoles;
@@ -36,8 +34,8 @@
import org.jboss.labs.injection.seam.Guice;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Observer;
import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.security.Restrict;
import com.google.inject.Inject;
@@ -46,13 +44,13 @@
*
*/
- at Stateful
@Scope(ScopeType.APPLICATION)
@Name("permission")
- at Restrict("#{identity.loggedIn}")
@Guice
-public class PermissionCheckerBean implements PermissionChecker {
+public class PermissionCheckerBean {
+ public static boolean rolesExposed = false;
+
@Inject
private AuthenticationService authService;
@@ -62,9 +60,13 @@
@Inject
private RoleBinderService binderService;
- @PostConstruct
- public void init() {
- binderService.exposeServiceRoles(AuthViewRoles.values());
+ @Observer("org.jboss.seam.postInitialization")
+ public void exposeRoles() {
+ if (!rolesExposed)
+ synchronized (this) {
+ binderService.exposeServiceRoles(AuthViewRoles.values());
+ rolesExposed = false;
+ }
}
/*
@@ -72,7 +74,7 @@
*
* @see org.jboss.labs.view.auth.action.PermissionChecker#checkGlobal()
*/
- public boolean checkGlobal() {
+ public boolean isAllowedGlobal() {
try {
return authService.isAllowedProject(FacesContext
.getCurrentInstance().getExternalContext()
Added: labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/ProjectsManager.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/ProjectsManager.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/ProjectsManager.java 2008-03-12 11:30:29 UTC (rev 18879)
@@ -0,0 +1,59 @@
+/*
+ * 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.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.jboss.labs.core.model.Project;
+import org.jboss.labs.core.service.ProjectService;
+import org.jboss.labs.injection.seam.Guice;
+import org.jboss.seam.annotations.Name;
+
+import com.google.inject.Inject;
+
+/**
+ * @author tomaszszymanski
+ *
+ */
+ at Name("projects")
+ at Guice
+public class ProjectsManager {
+ @Inject
+ private ProjectService projectsManager;
+
+ public List<Project> getAllProjects() {
+ List<Project> prjs = projectsManager.getProjects();
+
+ Collections.sort(prjs, new Comparator<Project>(){
+
+ public int compare(Project o1, Project o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+
+ });
+
+ return prjs;
+ }
+}
Added: labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/ServiceManager.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/ServiceManager.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/ServiceManager.java 2008-03-12 11:30:29 UTC (rev 18879)
@@ -0,0 +1,92 @@
+/*
+ * 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.HashSet;
+import java.util.Set;
+
+import org.jboss.labs.auth.RoleBinderService;
+import org.jboss.labs.core.model.auth.Service;
+import org.jboss.labs.core.model.auth.ServiceRole;
+import org.jboss.labs.injection.seam.Guice;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Logger;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.log.Log;
+
+import com.google.inject.Inject;
+
+/**
+ * @author tomaszszymanski
+ *
+ */
+ at Name("services")
+ at Scope(ScopeType.PAGE)
+ at Guice
+public class ServiceManager {
+ @Inject
+ private RoleBinderService binderService;
+
+ private Service currentService;
+
+ private ServiceRole currentServiceRole;
+
+ private Set<Service> services;
+
+ @Logger
+ private Log log;
+
+ public Service getCurrentService() {
+ return currentService;
+ }
+
+ public void setCurrentService(Service currentService) {
+ this.currentService = currentService;
+ }
+
+ public Set<Service> getAllServices() {
+ if (services == null) {
+ services = binderService.getAllServices();
+ }
+
+ return services;
+ }
+
+ public Set<ServiceRole> getServiceRoles() {
+ if (currentService != null) {
+ return currentService.getServiceRoles();
+ } else {
+ log.info("empty: #{service.currentService}");
+ return new HashSet<ServiceRole>();
+ }
+ }
+
+ public ServiceRole getCurrentServiceRole() {
+ return currentServiceRole;
+ }
+
+ public void setCurrentServiceRole(ServiceRole currentServiceRole) {
+ this.currentServiceRole = currentServiceRole;
+ }
+}
Added: 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 (rev 0)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/UserManager.java 2008-03-12 11:30:29 UTC (rev 18879)
@@ -0,0 +1,50 @@
+/*
+ * 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.List;
+import java.util.Vector;
+
+import org.jboss.seam.annotations.Name;
+
+import org.jboss.labs.auth.UserService;
+import org.jboss.labs.core.model.auth.UserRole;
+import org.jboss.labs.injection.seam.Guice;
+
+import com.google.inject.Inject;
+
+/**
+ * @author tomaszszymanski
+ *
+ */
+ at Name("users")
+ at Guice
+public class UserManager {
+
+ @Inject
+ private UserService userService;
+
+ public List<UserRole> getAllRoles() {
+ return new Vector<UserRole>(userService.getAllUserRoles());
+ }
+}
Added: labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/META-INF/persistence.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/META-INF/persistence.xml (rev 0)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/META-INF/persistence.xml 2008-03-12 11:30:29 UTC (rev 18879)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence>
+ <persistence-unit name="auth_view" transaction-type="JTA">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <jta-data-source>java:/LabsDS</jta-data-source>
+ <properties>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
+ <property name="hibernate.hbm2ddl.auto" value="update" />
+ <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
+ <property name="hibernate.transaction.manager_lookup_class"
+ value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
+ </properties>
+ </persistence-unit>
+</persistence>
+
Modified: labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/WEB-INF/components.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/WEB-INF/components.xml 2008-03-12 09:14:44 UTC (rev 18878)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/WEB-INF/components.xml 2008-03-12 11:30:29 UTC (rev 18879)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<components xmlns="http://jboss.com/products/seam/components"
+<components
xmlns:core="http://jboss.com/products/seam/core"
xmlns:persistence="http://jboss.com/products/seam/persistence"
xmlns:drools="http://jboss.com/products/seam/drools"
@@ -17,40 +17,12 @@
http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.0.xsd
http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd
http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.0.xsd">
+
+ <core:init jndi-pattern="@jndiPattern@" />
- <core:init debug="true" jndi-pattern="@jndiPattern@"/>
-
- <core:manager concurrent-request-timeout="500"
- conversation-timeout="120000"
- conversation-id-parameter="cid"/>
+ <persistence:entity-manager-factory name="auth_view" />
- <core:resource-loader>
- <core:bundle-names>
- <value>messages</value>
- </core:bundle-names>
- </core:resource-loader>
-
- <!-- <transaction:entity-transaction entity-manager="#{entityManager}"/>-->
-
- <!--<persistence:entity-manager-factory persistence-unit-name="admin" name="entityManagerFactory"/>
-
- <persistence:managed-persistence-context name="entityManager" auto-create="true"
- entity-manager-factory="#{entityManagerFactory}"/>-->
-
- <event type="org.jboss.seam.security.notLoggedIn">
- <action execute="#{redirect.captureCurrentView}"/>
- </event>
- <event type="org.jboss.seam.security.loginSuccessful">
- <action execute="#{redirect.returnToCapturedView}"/>
- </event>
-
- <mail:mail-session host="poczta.o2.pl" port="25" username="jboss" password="jboss" />
-
- <!--<security:identity authenticate-method="#{authenticator.authenticate}"/> -->
-
- <!-- email addresses -->
- <factory name="emailFrom" value="jboss at o2.pl" scope="APPLICATION"/>
- <factory name="emailIT" value="jboss at o2.pl" scope="APPLICATION"/>
- <factory name="emailReplyTo" value="jboss at o2.pl" scope="APPLICATION"/>
-
-</components>
+ <persistence:managed-persistence-context name="entityManager"
+ auto-create="true" entity-manager-factory="#{auth_view}" />
+
+</components>
\ No newline at end of file
Modified: labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/WEB-INF/faces-config.xml 2008-03-12 09:14:44 UTC (rev 18878)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/WEB-INF/faces-config.xml 2008-03-12 11:30:29 UTC (rev 18879)
@@ -1,15 +1,16 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<faces-config version="1.2"
- xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
-
- <application>
- <locale-config>
- <default-locale>en</default-locale>
- </locale-config>
- <variable-resolver>org.jboss.labs.injection.faces.LabsInjectionResolver</variable-resolver>
- <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
- </application>
-
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+ <converter>
+ <converter-id>serviceEntity</converter-id>
+ <converter-class>org.jboss.labs.auth.jsf.AuthEntityConverter</converter-class>
+ </converter>
+ <application>
+ <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+ <locale-config>
+ <default-locale>en</default-locale>
+ </locale-config>
+ <variable-resolver>org.jboss.labs.injection.faces.LabsInjectionResolver</variable-resolver>
+ </application>
</faces-config>
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-12 09:14:44 UTC (rev 18878)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/home.xhtml 2008-03-12 11:30:29 UTC (rev 18879)
@@ -1,17 +1,33 @@
<!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"
- template="layout/template.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" template="layout/template.xhtml">
-<ui:define name="body">
- <h2>What would you like to do ?</h2>
- <h:form id="mainForm">
- <h:outputLink value="/views/manage_global.xhtml" rendered="#{permission.checkGlobal}">Manage global roles</h:outputLink>
- </h:form>
-</ui:define>
+ <ui:define name="body">
+ <h2>What would you like to do ?</h2>
+ <h:form id="mainForm">
+ <h:outputLink value="views/manage_global.seam"
+ rendered="#{permission.allowedGlobal}">Manage global roles</h:outputLink>
+ <rich:simpleTogglePanel width="100" opened="false" label="What is this ?"
+ switchType="client">
+ <rich:effect event="onclick" type="BlindDown"/>
+
+ 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.
+ </rich:simpleTogglePanel>
+
+ <h:outputLink value="views/manage_project.seam"
+ rendered="#{permission.allowedGlobal}">Manage project roles</h:outputLink>
+ <rich:simpleTogglePanel width="100" opened="false" label="What is this ?"
+ switchType="client">
+ <rich:effect event="onclick" type="BlindDown"/>
+
+ This allows you assign roles to service roles for projects
+ </rich:simpleTogglePanel>
+ </h:form>
+ </ui:define>
</ui:composition>
Modified: labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/layout/menu.xhtml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/layout/menu.xhtml 2008-03-12 09:14:44 UTC (rev 18878)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/layout/menu.xhtml 2008-03-12 11:30:29 UTC (rev 18879)
@@ -14,6 +14,6 @@
<!-- @newMenuItem@ -->
<rich:toolBarGroup location="right">
<h:outputText value="Welcome, #{actor.id}!" />
- <s:link action="#{authenticator.logout()}" value="Logout"/>
+ <h:outputLink value="/auth/josso_logout/">Logout</h:outputLink>
</rich:toolBarGroup>
</rich:toolBar>
Modified: labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/layout/template.xhtml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/layout/template.xhtml 2008-03-12 09:14:44 UTC (rev 18878)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/layout/template.xhtml 2008-03-12 11:30:29 UTC (rev 18879)
@@ -4,7 +4,8 @@
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
- xmlns:s="http://jboss.com/products/seam/taglib">
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:rich="http://richfaces.org/rich">
<head>
<ui:insert name="head">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@@ -15,14 +16,13 @@
<body>
<!-- <h:outputText value="#{authenticator.autoLogin()}" rendered="#{empty actor.id}"/> -->
- <h:messages/>
<ui:include src="menu.xhtml">
- <ui:param name="projectName" value="admin"/>
+ <ui:param name="projectName" value="Global"/>
</ui:include>
<div class="body">
<ui:include src="breadcrumbs.xhtml"/>
- <h:messages globalOnly="true" styleClass="message"/>
+ <rich:messages styleClass="message" id="msgs" />
<ui:insert name="body"/>
</div>
Modified: labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/views/manage_global.xhtml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/views/manage_global.xhtml 2008-03-12 09:14:44 UTC (rev 18878)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/views/manage_global.xhtml 2008-03-12 11:30:29 UTC (rev 18879)
@@ -1,14 +1,57 @@
<!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"
- template="../layout/template.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">
-
-</ui:define>
+ <ui:define name="body">
+
+ <a4j:form>
+ <h:outputText value="Choose service"></h:outputText>
+
+ <h:selectOneRadio id="serviceList" value="#{services.currentService}">
+ <a4j:support event="onchange" reRender="serviceRoleList,msgs"/>
+ <s:selectItems value="#{services.allServices}" var="service" label="#{service.description}" />
+ <f:converter converterId="serviceEntity" />
+ </h:selectOneRadio>
+
+ <h:outputText value="Choose Service Role"></h:outputText>
+
+ <h:selectOneRadio id="serviceRoleList" value="#{services.currentServiceRole}">
+ <s:selectItems value="#{services.serviceRoles}" var="serviceRole" label="#{serviceRole.description}" />
+ <f:converter converterId="serviceEntity" />
+ </h:selectOneRadio>
+
+ <rich:dataTable width="483" id="roleList" rows="10" columnClasses="col"
+ value="#{users.allRoles}" var="role">
+
+ <f:facet name="header">
+ <rich:columnGroup>
+ <h:column>
+ <h:outputText styleClass="headerText" value="Id" />
+ </h:column>
+ <h:column>
+ <h:outputText styleClass="headerText" value="Description" />
+ </h:column>
+ </rich:columnGroup>
+ </f:facet>
+
+ <h:column>
+ <h:outputText value="#{role.id}" />
+ </h:column>
+
+ <h:column>
+ <h:outputText value="#{role.description}" />
+ </h:column>
+ </rich:dataTable>
+ <rich:spacer height="30" />
+ <rich:datascroller id="listScroller" align="left" for="roleList" maxPages="20" />
+ <a4j:commandButton value="Set" reRender="msgs"/>
+ </a4j:form>
+ </ui:define>
</ui:composition>
Added: labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/views/manage_project.xhtml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/views/manage_project.xhtml (rev 0)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/views/manage_project.xhtml 2008-03-12 11:30:29 UTC (rev 18879)
@@ -0,0 +1,16 @@
+<!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"
+ template="../layout/template.xhtml">
+
+ <ui:define name="body">
+ <h:selectOneRadio>
+ <s:selectItems value="#{projects.allProjects}" var="project" label="#{project.name}" itemValue="#{project.projectId}"/>
+ </h:selectOneRadio>
+ </ui:define>
+</ui:composition>
More information about the jboss-svn-commits
mailing list