Author: heiko.braun(a)jboss.com
Date: 2009-04-29 05:26:32 -0400 (Wed, 29 Apr 2009)
New Revision: 4667
Added:
projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java
projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/integration/UserManagement.java
Modified:
projects/gwt-console/trunk/gui/war/gui-war.iml
projects/gwt-console/trunk/gui/workspace-api/workspace-api.iml
projects/gwt-console/trunk/gui/workspace-example/workspace-example.iml
projects/gwt-console/trunk/gwt-parent.iml
projects/gwt-console/trunk/server/server-core/server-core.iml
projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java
projects/gwt-console/trunk/server/server-integration/server-integration.iml
projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/integration/ManagementFactory.java
Log:
Re-introduce accidentally deleted files
Modified: projects/gwt-console/trunk/gui/war/gui-war.iml
===================================================================
--- projects/gwt-console/trunk/gui/war/gui-war.iml 2009-04-29 09:02:07 UTC (rev 4666)
+++ projects/gwt-console/trunk/gui/war/gui-war.iml 2009-04-29 09:26:32 UTC (rev 4667)
@@ -13,6 +13,7 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="gwt-rpc"
exported="" />
<orderEntry type="module" module-name="workspace-api"
exported="" />
+ <orderEntry type="module" module-name="gwt-parent" />
<orderEntry type="module-library" exported="">
<library name="M2 Dep: javax.xml.bind:jaxb-api:jar:2.1:compile">
<CLASSES>
Modified: projects/gwt-console/trunk/gui/workspace-api/workspace-api.iml
===================================================================
--- projects/gwt-console/trunk/gui/workspace-api/workspace-api.iml 2009-04-29 09:02:07 UTC
(rev 4666)
+++ projects/gwt-console/trunk/gui/workspace-api/workspace-api.iml 2009-04-29 09:26:32 UTC
(rev 4667)
@@ -10,6 +10,7 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="gwt-rpc"
exported="" />
+ <orderEntry type="module" module-name="gwt-parent" />
<orderEntry type="module-library" exported="">
<library name="M2 Dep:
com.google.code.gwt-log:gwt-log:jar:2.5.2:compile">
<CLASSES>
Modified: projects/gwt-console/trunk/gui/workspace-example/workspace-example.iml
===================================================================
--- projects/gwt-console/trunk/gui/workspace-example/workspace-example.iml 2009-04-29
09:02:07 UTC (rev 4666)
+++ projects/gwt-console/trunk/gui/workspace-example/workspace-example.iml 2009-04-29
09:26:32 UTC (rev 4667)
@@ -14,6 +14,7 @@
<orderEntry type="module" module-name="gwt-rpc" />
<orderEntry type="module" module-name="plugin" />
<orderEntry type="module" module-name="workspace-api" />
+ <orderEntry type="module" module-name="gwt-parent" />
<orderEntry type="module-library">
<library name="M2 Dep: javax.xml.bind:jaxb-api:jar:2.1:compile">
<CLASSES>
Modified: projects/gwt-console/trunk/gwt-parent.iml
===================================================================
--- projects/gwt-console/trunk/gwt-parent.iml 2009-04-29 09:02:07 UTC (rev 4666)
+++ projects/gwt-console/trunk/gwt-parent.iml 2009-04-29 09:26:32 UTC (rev 4667)
@@ -13,8 +13,6 @@
<sourceFolder
url="file://$MODULE_DIR$/gui/workspace-example/src/main/java"
isTestSource="false" />
<sourceFolder
url="file://$MODULE_DIR$/gui/workspace-example/src/main/resources"
isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/rpc/src/main/java"
isTestSource="false" />
- <sourceFolder
url="file://$MODULE_DIR$/server/form-plugin/src/main/java"
isTestSource="false" />
- <sourceFolder
url="file://$MODULE_DIR$/server/form-plugin/src/main/resources"
isTestSource="false" />
<sourceFolder
url="file://$MODULE_DIR$/server/server-core/src/main/java"
isTestSource="false" />
<sourceFolder
url="file://$MODULE_DIR$/server/server-core/src/main/resources"
isTestSource="false" />
<sourceFolder
url="file://$MODULE_DIR$/server/server-core/src/test/java"
isTestSource="true" />
@@ -24,6 +22,7 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="gwt-rpc"
exported="" />
<orderEntry type="module" module-name="workspace-api"
exported="" />
+ <orderEntry type="module" module-name="server-integration"
exported="" />
<orderEntry type="module-library" exported="">
<library name="M2 Dep: org.slf4j:slf4j-simple:jar:1.5.2:compile">
<CLASSES>
@@ -308,25 +307,36 @@
</library>
</orderEntry>
<orderEntry type="module-library" exported="">
- <library name="M2 Dep: javax.xml.bind:jaxb-api:jar:2.1:provided">
+ <library name="M2 Dep:
javax.xml.stream:stax-api:jar:1.0-2:provided">
<CLASSES>
- <root
url="jar://$MODULE_DIR$/../../../../../../.m2/repository/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar!/"
/>
+ <root
url="jar://$MODULE_DIR$/../../../../../../.m2/repository/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar!/"
/>
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library" exported="">
- <library name="M2 Dep:
javax.xml.stream:stax-api:jar:1.0-2:provided">
+ <library name="M2 Dep:
javax.activation:activation:jar:1.1:provided">
<CLASSES>
- <root
url="jar://$MODULE_DIR$/../../../../../../.m2/repository/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar!/"
/>
+ <root
url="jar://$MODULE_DIR$/../../../../../../.m2/repository/javax/activation/activation/1.1/activation-1.1.jar!/"
/>
</CLASSES>
<JAVADOC />
+ <SOURCES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../.m2/repository/javax/activation/activation/1.1/activation-1.1-sources.jar!/"
/>
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library" exported="">
+ <library name="M2 Dep: javax.xml.bind:jaxb-api:jar:2.1:compile">
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../.m2/repository/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library" exported="">
- <library name="M2 Dep:
commons-beanutils:commons-beanutils:jar:1.7.0:test">
+ <library name="M2 Dep:
commons-beanutils:commons-beanutils:jar:1.7.0:compile">
<CLASSES>
<root
url="jar://$MODULE_DIR$/../../../../../../.m2/repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar!/"
/>
</CLASSES>
@@ -337,20 +347,18 @@
</library>
</orderEntry>
<orderEntry type="module-library" exported="">
- <library name="M2 Dep:
javax.activation:activation:jar:1.1:provided">
+ <library name="M2 Dep: commons-lang:commons-lang:jar:2.4:compile">
<CLASSES>
- <root
url="jar://$MODULE_DIR$/../../../../../../.m2/repository/javax/activation/activation/1.1/activation-1.1.jar!/"
/>
+ <root
url="jar://$MODULE_DIR$/../../../../../../.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar!/"
/>
</CLASSES>
<JAVADOC />
- <SOURCES>
- <root
url="jar://$MODULE_DIR$/../../../../../../.m2/repository/javax/activation/activation/1.1/activation-1.1-sources.jar!/"
/>
- </SOURCES>
+ <SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library" exported="">
- <library name="M2 Dep: commons-lang:commons-lang:jar:2.4:test">
+ <library name="M2 Dep:
commons-collections:commons-collections:jar:3.2:test">
<CLASSES>
- <root
url="jar://$MODULE_DIR$/../../../../../../.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar!/"
/>
+ <root
url="jar://$MODULE_DIR$/../../../../../../.m2/repository/commons-collections/commons-collections/3.2/commons-collections-3.2.jar!/"
/>
</CLASSES>
<JAVADOC />
<SOURCES />
Modified: projects/gwt-console/trunk/server/server-core/server-core.iml
===================================================================
--- projects/gwt-console/trunk/server/server-core/server-core.iml 2009-04-29 09:02:07 UTC
(rev 4666)
+++ projects/gwt-console/trunk/server/server-core/server-core.iml 2009-04-29 09:26:32 UTC
(rev 4667)
@@ -12,6 +12,7 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="gwt-rpc"
exported="" />
<orderEntry type="module" module-name="gwt-parent"
exported="" />
+ <orderEntry type="module" module-name="server-integration"
/>
<orderEntry type="module-library" exported="">
<library name="M2 Dep: org.slf4j:slf4j-simple:jar:1.5.2:compile">
<CLASSES>
Modified:
projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java
===================================================================
---
projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java 2009-04-29
09:02:07 UTC (rev 4666)
+++
projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java 2009-04-29
09:26:32 UTC (rev 4667)
@@ -38,7 +38,8 @@
{
singletons.add(new ProcessMgmtFacade());
singletons.add(new TaskListFacade());
- singletons.add(new TaskMgmtFacade());
+ singletons.add(new TaskMgmtFacade());
+ singletons.add(new UserMgmtFacade());
singletons.add(new TestFacade());
}
Added:
projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java
===================================================================
---
projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java
(rev 0)
+++
projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java 2009-04-29
09:26:32 UTC (rev 4667)
@@ -0,0 +1,143 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server;
+
+import com.google.gson.Gson;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.bpm.console.client.model.RoleAssignmentRef;
+import org.jboss.bpm.console.client.model.RoleAssignmentRefWrapper;
+import org.jboss.bpm.console.server.gson.GsonFactory;
+import org.jboss.bpm.console.server.integration.ManagementFactory;
+import org.jboss.bpm.console.server.integration.UserManagement;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import java.util.*;
+
+/**
+ * REST server module for accessing user related data.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+@Path("identity")
+public class UserMgmtFacade
+{
+
+ private static final Log log = LogFactory.getLog(UserMgmtFacade.class);
+
+ private UserManagement userManagement;
+
+ private UserManagement getUserManagement()
+ {
+ if(null==userManagement)
+ {
+ ManagementFactory factory = ManagementFactory.newInstance();
+ this.userManagement = factory.createUserManagement();
+ }
+
+ return this.userManagement;
+ }
+
+ @GET
+ @Path("/user/roles")
+ @Produces("application/json")
+ public Response getRolesForJAASPrincipal(
+ @Context
+ HttpServletRequest request,
+ @QueryParam("roleCheck")
+ String roleCheck
+ )
+ {
+ // TODO: Why not use the identity DB right away?
+ // These roles are security roles
+ if(null==roleCheck)
+ throw new WebApplicationException( new IllegalArgumentException("Missing
parameter 'roleCheck'") );
+
+ log.debug("Role check user: " + request.getRemoteUser() + ",
actualRoles requested: " + roleCheck);
+
+ List<RoleAssignmentRef> actualRoles = new
ArrayList<RoleAssignmentRef>();
+
+ StringTokenizer tok = new StringTokenizer(roleCheck, ",");
+ while(tok.hasMoreTokens())
+ {
+ String possibleRole = tok.nextToken();
+ actualRoles.add( new RoleAssignmentRef(possibleRole,
request.isUserInRole(possibleRole)));
+ }
+ return createJsonResponse( new RoleAssignmentRefWrapper(actualRoles));
+ }
+
+ @GET
+ @Path("/user/{actorId}/groups/")
+ @Produces("application/json")
+ public Response getGroupsForActor(
+ @PathParam("actorId")
+ String actorId
+ )
+ {
+ List<String> groups = getUserManagement().getGroupsForActor(actorId);
+ return createJsonResponse(groups);
+ }
+
+ @GET
+ @Path("/group/{groupName}/members")
+ @Produces("application/json")
+ public Response getActorsForGroup(
+ @PathParam("groupName")
+ String groupName
+ )
+ {
+ List<String> groups = getUserManagement().getActorsForGroup(groupName);
+ return createJsonResponse(groups);
+ }
+
+ @GET
+ @Path("/user/{actorId}/actors")
+ @Produces("application/json")
+ public Response getAvailableActors(
+ @PathParam("actorId")
+ String actorId
+ )
+ {
+ Set<String> users = new HashSet<String>();
+ List<String> groups = getUserManagement().getGroupsForActor(actorId);
+ for(String group : groups)
+ {
+ List<String> actors = getUserManagement().getActorsForGroup(group);
+ users.addAll(actors);
+ }
+
+ List<String> availableActors = new ArrayList<String>();
+ availableActors.addAll(users);
+ availableActors.addAll(groups);
+ return createJsonResponse(availableActors);
+ }
+
+ private Response createJsonResponse(Object wrapper)
+ {
+ Gson gson = GsonFactory.createInstance();
+ String json = gson.toJson(wrapper);
+ return Response.ok(json).type("application/json").build();
+ }
+}
\ No newline at end of file
Modified: projects/gwt-console/trunk/server/server-integration/server-integration.iml
===================================================================
--- projects/gwt-console/trunk/server/server-integration/server-integration.iml 2009-04-29
09:02:07 UTC (rev 4666)
+++ projects/gwt-console/trunk/server/server-integration/server-integration.iml 2009-04-29
09:26:32 UTC (rev 4667)
@@ -8,7 +8,8 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="module" module-name="gwt-rpc" />
+ <orderEntry type="module" module-name="gwt-rpc"
exported="" />
+ <orderEntry type="module" module-name="gwt-parent"
exported="" />
<orderEntry type="module-library" exported="">
<library name="M2 Dep: javax.xml.bind:jaxb-api:jar:2.1:provided">
<CLASSES>
Modified:
projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/integration/ManagementFactory.java
===================================================================
---
projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/integration/ManagementFactory.java 2009-04-29
09:02:07 UTC (rev 4666)
+++
projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/integration/ManagementFactory.java 2009-04-29
09:26:32 UTC (rev 4667)
@@ -48,4 +48,5 @@
public abstract TaskManagement createTaskManagement();
+ public abstract UserManagement createUserManagement();
}
Added:
projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/integration/UserManagement.java
===================================================================
---
projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/integration/UserManagement.java
(rev 0)
+++
projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/integration/UserManagement.java 2009-04-29
09:26:32 UTC (rev 4667)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server.integration;
+
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface UserManagement
+{
+ List<String> getGroupsForActor(String actorId);
+
+ List<String> getActorsForGroup(String groupName);
+}
\ No newline at end of file