return role "PAC_ADMIN_DW" or "PAC_ADMIN_SW" for webclient

This commit is contained in:
peter 2013-05-01 09:54:28 +02:00
parent 651a2f1c20
commit 95c92273e9
3 changed files with 11 additions and 2 deletions

View File

@ -286,4 +286,9 @@ public class Pac extends AbstractEntity implements Serializable {
return multi.getQuantity(); return multi.getQuantity();
} }
} }
public boolean isDynamic() {
String basepacName = getBasepac().getName();
return PAC_DW.equals(basepacName) || PAC_WEB.equals(basepacName);
}
} }

View File

@ -34,7 +34,11 @@ public class RoleRemote implements IRemote {
role = "HOSTMASTER"; role = "HOSTMASTER";
} }
if (user.equals(pacName)) { if (user.equals(pacName)) {
role = "PAC_ADMIN"; if (pac.isDynamic()) {
role = "PAC_ADMIN_DW";
} else {
role = "PAC_ADMIN_SW";
}
} }
if (role.equals("USER")) { if (role.equals("USER")) {
GenericModuleImpl module = new GenericModuleImpl(transaction); GenericModuleImpl module = new GenericModuleImpl(transaction);

View File

@ -45,7 +45,7 @@ public class RoleTest {
Object[] result = (Object[]) execute; Object[] result = (Object[]) execute;
assertTrue(result.length == 1); assertTrue(result.length == 1);
String role = (String) ((Map<?, ?>) result[0]).get("role"); String role = (String) ((Map<?, ?>) result[0]).get("role");
assertEquals("PAC_ADMIN", role); assertEquals("PAC_ADMIN_DW", role);
} catch (XmlRpcException e) { } catch (XmlRpcException e) {
fail(e.getMessage()); fail(e.getMessage());
} }