[jboss-svn-commits] JBL Code SVN: r19040 - in labs/jbosslabs/labs-3.0-build: core/core-model/src/main/java/org/jboss/labs/core/model/auth and 6 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Mar 17 15:56:20 EDT 2008
Author: szimano
Date: 2008-03-17 15:56:19 -0400 (Mon, 17 Mar 2008)
New Revision: 19040
Added:
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/webapp/include/choose_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/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/RoleBinderServiceImpl.java
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/GlobalBinderAction.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/UserManager.java
labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/auth_view.css
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/layout/template.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
Log:
auth global and project binding view 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-17 18:59:57 UTC (rev 19039)
+++ labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/auth/RoleBinderService.java 2008-03-17 19:56:19 UTC (rev 19040)
@@ -282,6 +282,20 @@
throws NoSuchUserRoleException;
/**
+ * Removes project-type binding
+ *
+ * @param serviceRole
+ * Service role
+ * @param role
+ * User role
+ * @param projectId
+ * Project id
+ * @throws NoSuchUserRoleException
+ */
+ public void removeBindingWithProject(ServiceRole serviceRole,
+ UserRole role, String projectId) throws NoSuchUserRoleException;
+
+ /**
* Removes id-type binding
*
* @param serviceRole
@@ -300,6 +314,24 @@
throws NoSuchUserRoleException, NoSuchCustomIDException;
/**
+ * Removes id-type binding
+ *
+ * @param serviceRole
+ * Service role
+ * @param role
+ * User role
+ * @param customId
+ * custom id
+ * @throws NoSuchUserRoleException
+ * If user role doesn't exist
+ * @throws NoSuchCustomIDException
+ * If custom id doesn't exist
+ */
+ public void removeBindingWithId(ServiceRole serviceRole, UserRole role,
+ CustomID customId) throws NoSuchUserRoleException,
+ NoSuchCustomIDException;
+
+ /**
* Removes global binding
*
* @param serviceRole
@@ -312,6 +344,18 @@
E serviceRole, UserRole role) throws NoSuchUserRoleException;
/**
+ * Removes global binding
+ *
+ * @param serviceRole
+ * Service role
+ * @param role
+ * User role
+ * @throws NoSuchUserRoleException
+ */
+ public void removeBindingGlobal(ServiceRole serviceRole, UserRole role)
+ throws NoSuchUserRoleException;
+
+ /**
* Removes all bindings bound to giver user role
*
* @param role
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-17 18:59:57 UTC (rev 19039)
+++ labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/core/model/auth/Service.java 2008-03-17 19:56:19 UTC (rev 19040)
@@ -63,7 +63,7 @@
@Transient
private Map<String, ServiceRole> rolesMap;
-
+
private String description;
@PostLoad
@@ -174,4 +174,8 @@
public void setDescription(String description) {
this.description = description;
}
+
+ public String getName() {
+ return id.substring(id.lastIndexOf('.') + 1);
+ }
}
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-17 18:59:57 UTC (rev 19039)
+++ labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/core/model/auth/ServiceRole.java 2008-03-17 19:56:19 UTC (rev 19040)
@@ -48,13 +48,13 @@
private String id;
private Boolean available;
-
+
private String description;
@ManyToOne
private Service service;
- @ManyToMany(fetch=FetchType.EAGER)
+ @ManyToMany(fetch = FetchType.EAGER)
private Set<UserRole> globalRoles;
public String getId() {
@@ -148,4 +148,8 @@
this.description = description;
}
+ public String getName() {
+ return id.substring(id.lastIndexOf('.') + 1);
+ }
+
}
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-17 18:59:57 UTC (rev 19039)
+++ labs/jbosslabs/labs-3.0-build/services/credential/src/main/java/org/jboss/labs/auth/impl/RoleBinderServiceImpl.java 2008-03-17 19:56:19 UTC (rev 19040)
@@ -296,13 +296,7 @@
public <E extends Enum<E> & ServiceDescriptor> void removeBindingGlobal(
E serviceRole, UserRole role) throws NoSuchUserRoleException {
ServiceRole srEn = getServiceRole(serviceRole);
- UserRole roleEn = userService.getUserRole(role);
-
- srEn.removeGlobalRole(roleEn);
- roleEn.removeServiceRole(srEn);
-
- manager.merge(srEn);
- manager.merge(roleEn);
+ removeBindingGlobal(srEn, role);
}
/*
@@ -315,17 +309,9 @@
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
- customIDService.getCustomIDs(getService(serviceRole));
- CustomID cidEn = manager.find(CustomID.class, customId.getAuthId());
-
- if (cidEn == null) {
- throw new NoSuchCustomIDException("CustomID with an id: "
- + customId.getAuthId() + " doesn't exist");
- }
-
- removeBindingWith(serviceRole, role, customId);
+ ServiceRole srEn = getServiceRole(serviceRole);
+ removeBindingWithId(srEn, role, customId);
}
/*
@@ -337,17 +323,16 @@
public <E extends Enum<E> & ServiceDescriptor> void removeBindingWithProject(
E serviceRole, UserRole role, String projectId)
throws NoSuchUserRoleException {
- removeBindingWith(serviceRole, role, getProjectID(projectId));
+ ServiceRole srEn = getServiceRole(serviceRole);
+ removeBindingWith(srEn, role, getProjectID(projectId));
}
- private <E extends Enum<E> & ServiceDescriptor> void removeBindingWith(
- E serviceRole, UserRole role, AuthID authID)
- throws NoSuchUserRoleException {
- ServiceRole srEn = getServiceRole(serviceRole);
+ private void removeBindingWith(ServiceRole serviceRole, UserRole role,
+ AuthID authID) throws NoSuchUserRoleException {
UserRole roleEn = userService.getUserRole(role);
- Service service = getService(serviceRole);
+ Service service = serviceRole.getService();
- manager.remove(getBinding(srEn, roleEn, authID, service));
+ manager.remove(getBinding(serviceRole, roleEn, authID, service));
}
/*
@@ -471,4 +456,56 @@
bindRolesWith(serviceRole, role, pid);
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.labs.auth.RoleBinderService#removeBindingGlobal(org.jboss.labs.core.model.auth.ServiceRole,
+ * org.jboss.labs.core.model.auth.UserRole)
+ */
+ public void removeBindingGlobal(ServiceRole serviceRole, UserRole role)
+ throws NoSuchUserRoleException {
+
+ UserRole roleEn = userService.getUserRole(role);
+
+ serviceRole.removeGlobalRole(roleEn);
+ roleEn.removeServiceRole(serviceRole);
+
+ manager.merge(serviceRole);
+ manager.merge(roleEn);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.labs.auth.RoleBinderService#removeBindingWithId(org.jboss.labs.core.model.auth.ServiceRole,
+ * org.jboss.labs.core.model.auth.UserRole,
+ * org.jboss.labs.core.model.auth.CustomID)
+ */
+ public void removeBindingWithId(ServiceRole serviceRole, UserRole role,
+ CustomID customId) throws NoSuchUserRoleException,
+ NoSuchCustomIDException {
+ // get custom IDs - this will persist new ones
+ customIDService.getCustomIDs(serviceRole.getService());
+
+ CustomID cidEn = manager.find(CustomID.class, customId.getAuthId());
+
+ if (cidEn == null) {
+ throw new NoSuchCustomIDException("CustomID with an id: "
+ + customId.getAuthId() + " doesn't exist");
+ }
+
+ removeBindingWith(serviceRole, role, customId);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.labs.auth.RoleBinderService#removeBindingWithProject(org.jboss.labs.core.model.auth.ServiceRole,
+ * org.jboss.labs.core.model.auth.UserRole, java.lang.String)
+ */
+ public void removeBindingWithProject(ServiceRole serviceRole,
+ UserRole role, String projectId) throws NoSuchUserRoleException {
+ removeBindingWith(serviceRole, role, getProjectID(projectId));
+ }
+
}
Modified: 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 2008-03-17 18:59:57 UTC (rev 19039)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/auth/jsf/AuthEntityConverter.java 2008-03-17 19:56:19 UTC (rev 19040)
@@ -27,8 +27,12 @@
import javax.faces.convert.Converter;
import org.jboss.labs.auth.RoleBinderService;
+import org.jboss.labs.core.model.Project;
import org.jboss.labs.core.model.auth.Service;
import org.jboss.labs.core.model.auth.ServiceRole;
+import org.jboss.labs.core.service.ProjectService;
+import org.jboss.labs.exception.LabsRuntimeException;
+import org.jboss.labs.exception.admin.ProjectNotFoundException;
import org.jboss.labs.injection.LabsInjection;
import com.google.inject.Inject;
@@ -38,13 +42,17 @@
*
*/
public class AuthEntityConverter implements Converter {
-
+
private final static String SERVICE = "service:";
private final static String SERVICE_ROLE = "service_role:";
+ private final static String PROJECT = "project:";
@Inject
private RoleBinderService binderService;
+ @Inject
+ private ProjectService projectService;
+
public AuthEntityConverter() {
super();
@@ -63,11 +71,17 @@
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_ROLE.length()));
- }
- else {
+ } else if (objStr.startsWith(SERVICE_ROLE)) {
+ return binderService.getServiceRole(objStr.substring(SERVICE_ROLE
+ .length()));
+ } else if (objStr.startsWith(PROJECT)) {
+ try {
+ return projectService.getProject(objStr.substring(PROJECT
+ .length()));
+ } catch (ProjectNotFoundException e) {
+ throw new LabsRuntimeException(e);
+ }
+ } else {
return null;
}
}
@@ -82,11 +96,11 @@
Object objInstance) {
if (objInstance instanceof Service) {
return SERVICE + ((Service) objInstance).getId();
- }
- else if (objInstance instanceof ServiceRole) {
+ } else if (objInstance instanceof ServiceRole) {
return SERVICE_ROLE + ((ServiceRole) objInstance).getId();
- }
- else {
+ } else if (objInstance instanceof Project) {
+ return PROJECT + ((Project) objInstance).getProjectId();
+ } 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-17 18:59:57 UTC (rev 19039)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/GlobalBinderAction.java 2008-03-17 19:56:19 UTC (rev 19040)
@@ -22,6 +22,8 @@
*/
package org.jboss.labs.view.auth.action;
+import java.util.Calendar;
+
import javax.faces.event.ValueChangeEvent;
import org.jboss.labs.auth.RoleBinderService;
@@ -34,6 +36,8 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.core.Events;
+import sun.net.www.protocol.http.AuthenticationHeader;
+
import com.google.inject.Inject;
import static org.jboss.labs.auth.AuthViewEvents.*;
@@ -84,5 +88,17 @@
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);
+ Events.instance().raiseEvent(CLEAR_GLOBAL_ROLES);
+ ViewHelper.addMessage("Binding deleted");
+ } catch (NoSuchUserRoleException e) {
+ ViewHelper.addErrorMessage(e);
+ }
+ }
+ }
}
Added: 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 (rev 0)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/ProjectBinderAction.java 2008-03-17 19:56:19 UTC (rev 19040)
@@ -0,0 +1,74 @@
+/*
+ * 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 static org.jboss.labs.auth.AuthViewEvents.CLEAR_GLOBAL_ROLES;
+
+import org.jboss.labs.auth.RoleBinderService;
+import org.jboss.labs.auth.ViewHelper;
+import org.jboss.labs.core.model.Project;
+import org.jboss.labs.core.model.auth.ServiceRole;
+import org.jboss.labs.core.model.auth.UserRole;
+import org.jboss.labs.exception.LabsException;
+import org.jboss.labs.injection.seam.Guice;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.core.Events;
+
+import com.google.inject.Inject;
+
+/**
+ * @author tomaszszymanski
+ *
+ */
+ at Name("projectBinder")
+ at Guice
+public class ProjectBinderAction {
+ @Inject
+ private RoleBinderService binderService;
+
+ @In(value = "#{users.currentRole}", required = false)
+ private UserRole currentRole;
+
+ @In(value = "#{services.currentServiceRole}", required = false)
+ private ServiceRole currentServiceRole;
+
+ @In(value = "#{projects.currentProject}", required = false)
+ private Project currentProject;
+
+ public void add() {
+ if (currentProject != null && currentRole != null
+ && currentServiceRole != null) {
+ try {
+ binderService.bindRolesWithProject(currentServiceRole,
+ currentRole, currentProject.getProjectId());
+
+ ViewHelper.addMessage("Role bound");
+
+ Events.instance().raiseEvent(CLEAR_GLOBAL_ROLES);
+ } catch (LabsException e) {
+ ViewHelper.addErrorMessage(e);
+ }
+ }
+ }
+}
Modified: 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 2008-03-17 18:59:57 UTC (rev 19039)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/ProjectsManager.java 2008-03-17 19:56:19 UTC (rev 19040)
@@ -29,7 +29,9 @@
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.ScopeType;
import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
import com.google.inject.Inject;
@@ -38,11 +40,14 @@
*
*/
@Name("projects")
+ at Scope(ScopeType.PAGE)
@Guice
public class ProjectsManager {
@Inject
private ProjectService projectsManager;
+ private Project currentProject;
+
public List<Project> getAllProjects() {
List<Project> prjs = projectsManager.getProjects();
@@ -56,4 +61,12 @@
return prjs;
}
+
+ public Project getCurrentProject() {
+ return currentProject;
+ }
+
+ public void setCurrentProject(Project currentProject) {
+ this.currentProject = currentProject;
+ }
}
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-17 18:59:57 UTC (rev 19039)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/java/org/jboss/labs/view/auth/action/UserManager.java 2008-03-17 19:56:19 UTC (rev 19040)
@@ -24,6 +24,7 @@
import static org.jboss.labs.auth.AuthViewEvents.CLEAR_USERROLE;
+import java.util.Calendar;
import java.util.List;
import java.util.Vector;
@@ -31,15 +32,18 @@
import org.jboss.labs.auth.UserService;
import org.jboss.labs.auth.ViewHelper;
+import org.jboss.labs.core.model.auth.ServiceRole;
import org.jboss.labs.core.model.auth.User;
import org.jboss.labs.core.model.auth.UserRole;
import org.jboss.labs.exception.auth.NoSuchUserRoleException;
import org.jboss.labs.injection.seam.Guice;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Factory;
+import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Observer;
+import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.datamodel.DataModel;
import org.jboss.seam.annotations.datamodel.DataModelSelection;
@@ -69,6 +73,9 @@
private List<User> usersInRole;
+ @In(required = false)
+ ServiceManager services;
+
@Logger
private Log log;
@@ -91,7 +98,7 @@
}
public List<User> getUsersInRole() {
-
+
if (usersInRole == null) {
if (currentRole != null)
try {
@@ -115,6 +122,12 @@
if (ob instanceof UserRole) {
currentRole = (UserRole) ob;
+
+ // set current service role
+ if (tree.getTreeNode().getParent() != null) {
+ services.setCurrentServiceRole((ServiceRole) tree.getTreeNode()
+ .getParent().getData());
+ }
}
}
@@ -128,7 +141,7 @@
if (allRoles != null) {
String output = "";
int selectIndex = allRoles.indexOf(currentRole);
-
+
for (int i = 0; i < allRoles.size() - 1; i++) {
output += (i == selectIndex ? "selected" : "notselected") + ",";
}
@@ -144,4 +157,10 @@
return "";
}
+
+ public String getTime() {
+ Calendar c = Calendar.getInstance();
+ return c.get(Calendar.HOUR_OF_DAY) + ":" + c.get(Calendar.MINUTE) + ":"
+ + c.get(Calendar.SECOND);
+ }
}
Modified: labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/auth_view.css
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/auth_view.css 2008-03-17 18:59:57 UTC (rev 19039)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/auth_view.css 2008-03-17 19:56:19 UTC (rev 19040)
@@ -1,4 +1,9 @@
.selected {
background-color: grey;
color: black;
+}
+
+input[disabled] {
+ background-color: grey;
+ color: black;
}
\ No newline at end of file
Added: 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 (rev 0)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/choose_project.xhtml 2008-03-17 19:56:19 UTC (rev 19040)
@@ -0,0 +1,17 @@
+<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" template="/layout/template.xhtml">
+
+ <h:outputText value="Choose project"></h:outputText>
+
+ <h:selectOneRadio id="projectList" value="#{projects.currentProject}">
+ <a4j:support event="onchange" reRender="buttons" />
+ <s:selectItems value="#{projects.allProjects}" var="project"
+ label="#{project.name}" itemValue="#{project.projectId}" />
+ <f:converter converterId="serviceEntity" />
+ </h:selectOneRadio>
+</h:panelGroup>
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-17 18:59:57 UTC (rev 19039)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/choose_service_role.xhtml 2008-03-17 19:56:19 UTC (rev 19040)
@@ -9,9 +9,9 @@
<h:outputText value="Choose service"></h:outputText>
<h:selectOneRadio id="serviceList" value="#{services.currentService}">
- <a4j:support event="onchange" reRender="serviceRoleList,msgs,buttons" />
+ <a4j:support event="onchange" reRender="serviceRoleList,buttons" />
<s:selectItems value="#{services.allServices}" var="service"
- label="#{service.description}" />
+ label="[#{service.name}] #{service.description}" />
<f:converter converterId="serviceEntity" />
</h:selectOneRadio>
@@ -19,9 +19,9 @@
<h:selectOneRadio id="serviceRoleList"
value="#{services.currentServiceRole}" >
- <a4j:support event="onchange" reRender="msgs,buttons" />
+ <a4j:support event="onchange" reRender="buttons" />
<s:selectItems value="#{services.serviceRoles}" var="serviceRole"
- label="#{serviceRole.description}"/>
+ label="[#{serviceRole.name}] #{serviceRole.description}"/>
<f:converter converterId="serviceEntity" />
</h:selectOneRadio>
</h:panelGroup>
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-17 18:59:57 UTC (rev 19039)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/include/choose_user_role.xhtml 2008-03-17 19:56:19 UTC (rev 19040)
@@ -30,7 +30,7 @@
</h:column>
<h:column>
- <a4j:commandButton value="Choose" reRender="msgs,buttons" action="#{users.setRole}" />
+ <a4j:commandButton value="Choose" reRender="buttons" action="#{users.setRole}" />
</h:column>
</rich:dataTable>
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-17 18:59:57 UTC (rev 19039)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/layout/template.xhtml 2008-03-17 19:56:19 UTC (rev 19040)
@@ -5,13 +5,15 @@
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:rich="http://richfaces.org/rich">
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:a4j="http://richfaces.org/a4j">
<head>
<ui:insert name="head">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Auth</title>
<link href="/admin/stylesheet/theme.css" rel="stylesheet" type="text/css" />
</ui:insert>
+ <link rel="stylesheet" type="text/css" href="auth_view.css" />
</head>
<body>
@@ -22,7 +24,11 @@
<div class="body">
<ui:include src="breadcrumbs.xhtml"/>
- <rich:messages styleClass="message" id="msgs"/>
+
+ <a4j:outputPanel ajaxRendered="true">
+ <h:messages />
+ </a4j:outputPanel>
+
<ui:insert name="body"/>
</div>
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-17 18:59:57 UTC (rev 19039)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/manage_global.xhtml 2008-03-17 19:56:19 UTC (rev 19040)
@@ -9,9 +9,9 @@
xmlns:a4j="http://richfaces.org/a4j" template="/layout/template.xhtml">
<ui:define name="body">
-
- <rich:tabPanel switchType="ajax" valueChangeListener="#{globalBinder.changePanel}">
- <rich:tab label="Add" name="add">
+ <rich:tabPanel switchType="ajax"
+ valueChangeListener="#{globalBinder.changePanel}">
+ <rich:tab label="Add" name="add" id="addtab">
<a4j:form>
<ui:include src="include/choose_service_role.xhtml" />
@@ -20,19 +20,20 @@
<h:panelGroup id="buttons">
<a4j:commandButton action="#{globalBinder.add}" value="Bind"
- reRender="msgs,globalRolesTree" disabled="#{services.currentServiceRole == null or users.currentRole == null}" />
+ reRender="viewtab"
+ disabled="#{services.currentServiceRole == null or users.currentRole == null}" />
</h:panelGroup>
</a4j:form>
</rich:tab>
- <rich:tab label="View/Edit" name="view">
+ <rich:tab label="View/Edit" name="view" id="viewtab">
<h:panelGrid columns="2">
<a4j:form>
<rich:tree switchType="ajax" value="#{services.globalRolesTree}"
var="item" id="globalRolesTree" ajaxSubmitSelection="true"
nodeSelectListener="#{users.selectGlobalNode}"
- reRender="selectedRole" nodeFace="#{item.class.name}">
-
+ reRender="selectedRole,buttons" nodeFace="#{item.class.name}">
+
<rich:treeNode type="org.jboss.labs.core.model.auth.Service">
<h:outputText value="[Service] #{item.description}" />
</rich:treeNode>
@@ -51,13 +52,16 @@
<rich:menuItem value="Delete" id="delete"></rich:menuItem>
</rich:contextMenu>
<h:panelGroup id="buttons">
- <a4j:commandButton value="Edit" />
- <a4j:commandButton value="Delete" />
+ <a4j:commandButton value="Delete"
+ disabled="#{users.currentRole == null}"
+ onclick="confirm('Are you sure you want to delete binding for role #{users.currentRole.id} and #{services.currentServiceRole.name}?')"
+ action="#{globalBinder.deleteBinding}"
+ reRender="globalRolesTree,buttons" />
</h:panelGroup>
</a4j:form>
<h:panelGroup layout="vertical" id="selectedRole">
- <h:outputText value="#{users.currentRole.id}"/>
- <h:outputText value="#{users.currentRole.description}"/>
+ <h:outputText value="#{users.currentRole.id}" />
+ <h:outputText value="#{users.currentRole.description}" />
<rich:dataList var="user" value="#{users.usersInRole}">
<h:outputText value="#{user.name}" />
</rich:dataList>
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-17 18:59:57 UTC (rev 19039)
+++ labs/jbosslabs/labs-3.0-build/views/auth/src/main/webapp/manage_project.xhtml 2008-03-17 19:56:19 UTC (rev 19040)
@@ -1,16 +1,75 @@
<!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" xmlns:a4j="http://richfaces.org/a4j">
<ui:define name="body">
- <h:selectOneRadio>
- <s:selectItems value="#{projects.allProjects}" var="project" label="#{project.name}" itemValue="#{project.projectId}"/>
- </h:selectOneRadio>
- </ui:define>
+ <rich:tabPanel switchType="ajax"
+ valueChangeListener="#{globalBinder.changePanel}">
+ <rich:tab label="Add" name="add" id="addtab">
+ <a4j:form>
+
+ <ui:include src="include/choose_service_role.xhtml" />
+
+ <ui:include src="include/choose_project.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>
+
+ </a4j:form>
+ </rich:tab>
+ <rich:tab label="View/Edit" name="view" id="viewtab">
+ <h:panelGrid columns="2">
+ <a4j:form>
+ <rich:tree switchType="ajax" value="#{services.globalRolesTree}"
+ var="item" id="globalRolesTree" ajaxSubmitSelection="true"
+ nodeSelectListener="#{users.selectGlobalNode}"
+ reRender="selectedRole,buttons" nodeFace="#{item.class.name}">
+
+ <rich:treeNode type="org.jboss.labs.core.model.auth.Service">
+ <h:outputText value="[Service] #{item.description}" />
+ </rich:treeNode>
+
+ <rich:treeNode type="org.jboss.labs.core.model.auth.ServiceRole">
+ <h:outputText value="[ServiceRole] #{item.description}" />
+ </rich:treeNode>
+
+ <rich:treeNode type="org.jboss.labs.core.model.auth.UserRole">
+ <h:outputText value="[UserRole] #{item.id}" />
+ </rich:treeNode>
+ </rich:tree>
+ <rich:contextMenu event="oncontextmenu" attached="true"
+ submitMode="none">
+ <rich:menuItem value="Edit" id="edit"></rich:menuItem>
+ <rich:menuItem value="Delete" id="delete"></rich:menuItem>
+ </rich:contextMenu>
+ <h:panelGroup id="buttons">
+ <a4j:commandButton value="Delete"
+ disabled="#{users.currentRole == null}"
+ onclick="confirm('Are you sure you want to delete binding for role #{users.currentRole.id} and #{services.currentServiceRole.name}?')"
+ action="#{globalBinder.deleteBinding}"
+ reRender="globalRolesTree,buttons" />
+ </h:panelGroup>
+ </a4j:form>
+ <h:panelGroup layout="vertical" id="selectedRole">
+ <h:outputText value="#{users.currentRole.id}" />
+ <h:outputText value="#{users.currentRole.description}" />
+ <rich:dataList var="user" value="#{users.usersInRole}">
+ <h:outputText value="#{user.name}" />
+ </rich:dataList>
+ </h:panelGroup>
+ </h:panelGrid>
+ </rich:tab>
+ </rich:tabPanel>
+ </ui:define>
</ui:composition>
More information about the jboss-svn-commits
mailing list