From 95c92273e94269fffd707557ca33243101530a53 Mon Sep 17 00:00:00 2001
From: peter <peter.hormanns@jalin.de>
Date: Wed, 01 May 2013 09:54:28 +0200
Subject: [PATCH] return role "PAC_ADMIN_DW" or "PAC_ADMIN_SW" for webclient

---
 hsarback/test/de/hsadmin/remote/RoleTest.java  |    2 +-
 hsarback/src/de/hsadmin/mods/pac/Pac.java      |    5 +++++
 hsarback/src/de/hsadmin/remote/RoleRemote.java |    6 +++++-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/hsarback/src/de/hsadmin/mods/pac/Pac.java b/hsarback/src/de/hsadmin/mods/pac/Pac.java
index 7536363..23fa538 100644
--- a/hsarback/src/de/hsadmin/mods/pac/Pac.java
+++ b/hsarback/src/de/hsadmin/mods/pac/Pac.java
@@ -286,4 +286,9 @@
 			return multi.getQuantity();
 		}
 	}
+	
+	public boolean isDynamic() {
+		String basepacName = getBasepac().getName();
+		return PAC_DW.equals(basepacName) || PAC_WEB.equals(basepacName);
+	}
 }
diff --git a/hsarback/src/de/hsadmin/remote/RoleRemote.java b/hsarback/src/de/hsadmin/remote/RoleRemote.java
index 6b3cd70..7d74ac4 100644
--- a/hsarback/src/de/hsadmin/remote/RoleRemote.java
+++ b/hsarback/src/de/hsadmin/remote/RoleRemote.java
@@ -34,7 +34,11 @@
 				role = "HOSTMASTER";
 			}
 			if (user.equals(pacName)) {
-				role = "PAC_ADMIN";
+				if (pac.isDynamic()) {
+					role = "PAC_ADMIN_DW";
+				} else {
+					role = "PAC_ADMIN_SW";
+				}
 			}
 			if (role.equals("USER")) {
 				GenericModuleImpl module = new GenericModuleImpl(transaction);
diff --git a/hsarback/test/de/hsadmin/remote/RoleTest.java b/hsarback/test/de/hsadmin/remote/RoleTest.java
index 7f114f7..0236509 100644
--- a/hsarback/test/de/hsadmin/remote/RoleTest.java
+++ b/hsarback/test/de/hsadmin/remote/RoleTest.java
@@ -45,7 +45,7 @@
 			Object[] result = (Object[]) execute;
 			assertTrue(result.length == 1);
 			String role = (String) ((Map<?, ?>) result[0]).get("role");
-			assertEquals("PAC_ADMIN", role);
+			assertEquals("PAC_ADMIN_DW", role);
 		} catch (XmlRpcException e) {
 			fail(e.getMessage());
 		}

--
Gitblit v1.9.0-SNAPSHOT