diff --git a/hsarweb/conf/WEB-INF/web.xml b/hsarweb/conf/WEB-INF/web.xml
index e9a46ec..2acd982 100644
--- a/hsarweb/conf/WEB-INF/web.xml
+++ b/hsarweb/conf/WEB-INF/web.xml
@@ -57,6 +57,7 @@
+
CAS Validation Filter
/*
@@ -66,7 +67,7 @@
CAS Authentication Filter
/*
-
+
Logout Servlet
de.hsadmin.logout.LogoutServlet
@@ -93,11 +94,15 @@
HSAdmin Web
- /*
+ /MainApplication/*
+
+
+
+ HSAdmin Web
+ /VAADIN/*
- index.html
index.jsp
\ No newline at end of file
diff --git a/hsarweb/src/de/hsadmin/web/AbstractModule.java b/hsarweb/src/de/hsadmin/web/AbstractModule.java
index 4b37670..537f414 100644
--- a/hsarweb/src/de/hsadmin/web/AbstractModule.java
+++ b/hsarweb/src/de/hsadmin/web/AbstractModule.java
@@ -4,12 +4,15 @@ import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.terminal.Sizeable;
import com.vaadin.terminal.ThemeResource;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.Form;
import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Select;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
import com.vaadin.ui.Button.ClickEvent;
@@ -28,23 +31,73 @@ public abstract class AbstractModule implements Module, Serializable {
private VerticalLayout layout;
private Component component;
private ComponentFactory componentFactory;
+ private Select selRunAs;
public Component getComponent() {
return layout;
}
public void reload() throws HsarwebException {
+ if (selRunAs != null) {
+ selRunAs.select(application.getRunAs());
+ selRunAs.setScrollToSelectedItem(true);
+ }
componentFactory.loadData();
}
- private void initLayout() {
+ private void initLayout() throws HsarwebException {
layout = new VerticalLayout();
layout.setSizeFull();
final Module thisModule = this;
final ModuleConfig moduleConfig = getModuleConfig();
final LocaleConfig localeConfig = application.getLocaleConfig();
- if (this instanceof SearchAble || this instanceof InsertAble) {
+ if (this instanceof SearchAble || this instanceof InsertAble ||
+ !("USER".equals(application.getLoginUserRole()) || "NONE".equals(application.getLoginUserRole()))) {
HorizontalLayout toolbar = new HorizontalLayout();
+ if (!("USER".equals(application.getLoginUserRole()) || "NONE".equals(application.getLoginUserRole()))) {
+ selRunAs = new Select();
+ selRunAs.setWidth(100.0f, Sizeable.UNITS_PIXELS);
+ selRunAs.setImmediate(true);
+ selRunAs.setNewItemsAllowed(false);
+ selRunAs.setNullSelectionAllowed(false);
+ if (!application.getLoginUserRole().startsWith("PAC")) {
+// if (application.getLoginUserRole().startsWith("PAC")) {
+//
+// }
+ selRunAs.addItem(application.getLogin());
+ Object custListObj = application.getRemote().callSearch("member", new HashMap());
+ if (custListObj instanceof Object[]) {
+ Object[] custList = (Object[]) custListObj;
+ for (Object custObj : custList) {
+ if (custObj instanceof Map, ?>) {
+ Map, ?> custHash = (Map, ?>)custObj;
+ selRunAs.addItem(custHash.get("membercode"));
+ }
+ }
+ }
+ }
+ Object pacListObj = application.getRemote().callSearch("pac", new HashMap());
+ if (pacListObj instanceof Object[]) {
+ Object[] pacList = (Object[]) pacListObj;
+ for (Object pacObj : pacList) {
+ if (pacObj instanceof Map, ?>) {
+ Map, ?> pacHash = (Map, ?>)pacObj;
+ selRunAs.addItem(pacHash.get("name"));
+ }
+ }
+ }
+ selRunAs.select(application.getRunAs());
+ selRunAs.setScrollToSelectedItem(true);
+ selRunAs.addListener(new Property.ValueChangeListener() {
+ private static final long serialVersionUID = 1L;
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ Property property = event.getProperty();
+ application.setRunAs(property.getValue().toString());
+ }
+ });
+ toolbar.addComponent(selRunAs);
+ }
if (this instanceof InsertAble) {
Button btNew = new Button(moduleConfig.getLabel("new"));
ThemeResource icon = new ThemeResource("../runo/icons/16/document-add.png");
diff --git a/hsarweb/src/de/hsadmin/web/DatabaseModule.java b/hsarweb/src/de/hsadmin/web/DatabaseModule.java
index 3ccea15..8a70b38 100644
--- a/hsarweb/src/de/hsadmin/web/DatabaseModule.java
+++ b/hsarweb/src/de/hsadmin/web/DatabaseModule.java
@@ -29,7 +29,7 @@ public abstract class DatabaseModule extends GenericModule {
protected void initModule() {
MainApplication application = getApplication();
moduleConfig = new ModuleConfig(getModuleIdent(), application.getLocale());
- String login = application.getLogin();
+ String login = application.getRunAs();
final String pac = login.length() >= 5 ? login.substring(0, 5) : "";
PropertyConfig idProp = new PropertyConfig(moduleConfig, "id", Long.class, PropertyTableColumn.INTERNAL_KEY);
idProp.setReadOnly(true);
diff --git a/hsarweb/src/de/hsadmin/web/DatabaseUserModule.java b/hsarweb/src/de/hsadmin/web/DatabaseUserModule.java
index c42d5a5..6f80135 100644
--- a/hsarweb/src/de/hsadmin/web/DatabaseUserModule.java
+++ b/hsarweb/src/de/hsadmin/web/DatabaseUserModule.java
@@ -24,7 +24,7 @@ public abstract class DatabaseUserModule extends GenericModule {
protected void initModule() {
MainApplication application = getApplication();
moduleConfig = new ModuleConfig(getModuleIdent(), application.getLocale());
- String login = application.getLogin();
+ String login = application.getRunAs();
final String pac = login.length() >= 5 ? login.substring(0, 5) : "";
PropertyConfig idProp = new PropertyConfig(moduleConfig, "id", Long.class, PropertyTableColumn.INTERNAL_KEY);
idProp.setReadOnly(true);
diff --git a/hsarweb/src/de/hsadmin/web/DomainModule.java b/hsarweb/src/de/hsadmin/web/DomainModule.java
index ef39e5f..d1ddfef 100644
--- a/hsarweb/src/de/hsadmin/web/DomainModule.java
+++ b/hsarweb/src/de/hsadmin/web/DomainModule.java
@@ -23,7 +23,7 @@ public class DomainModule extends GenericModule {
protected void initModule() {
MainApplication application = getApplication();
moduleConfig = new ModuleConfig("domain", application.getLocale());
- String login = application.getLogin();
+ String login = application.getRunAs();
final String pac = login.length() >= 5 ? login.substring(0, 5) : "";
PropertyConfig idProp = new PropertyConfig(moduleConfig, "id", Long.class, PropertyTableColumn.INTERNAL_KEY);
idProp.setReadOnly(true);
diff --git a/hsarweb/src/de/hsadmin/web/EMailAddressModule.java b/hsarweb/src/de/hsadmin/web/EMailAddressModule.java
index 8bdc8d5..3e99c6f 100644
--- a/hsarweb/src/de/hsadmin/web/EMailAddressModule.java
+++ b/hsarweb/src/de/hsadmin/web/EMailAddressModule.java
@@ -22,7 +22,7 @@ public class EMailAddressModule extends GenericModule {
protected void initModule() {
MainApplication application = getApplication();
moduleConfig = new ModuleConfig("emailaddress", application.getLocale());
- String login = application.getLogin();
+ String login = application.getRunAs();
final String pac = login.length() >= 5 ? login.substring(0, 5) : "";
PropertyConfig idProp = new PropertyConfig(moduleConfig, "id", Long.class, PropertyTableColumn.INTERNAL_KEY);
idProp.setReadOnly(true);
diff --git a/hsarweb/src/de/hsadmin/web/EMailAliasModule.java b/hsarweb/src/de/hsadmin/web/EMailAliasModule.java
index 21769e4..51a4139 100644
--- a/hsarweb/src/de/hsadmin/web/EMailAliasModule.java
+++ b/hsarweb/src/de/hsadmin/web/EMailAliasModule.java
@@ -22,7 +22,7 @@ public class EMailAliasModule extends GenericModule {
protected void initModule() {
MainApplication application = getApplication();
moduleConfig = new ModuleConfig("emailalias", application.getLocale());
- String login = application.getLogin();
+ String login = application.getRunAs();
final String pac = login.length() >= 5 ? login.substring(0, 5) : "";
PropertyConfig idProp = new PropertyConfig(moduleConfig, "id", Long.class, PropertyTableColumn.INTERNAL_KEY);
idProp.setReadOnly(true);
diff --git a/hsarweb/src/de/hsadmin/web/HomeModule.java b/hsarweb/src/de/hsadmin/web/HomeModule.java
index d71e536..e6bc473 100644
--- a/hsarweb/src/de/hsadmin/web/HomeModule.java
+++ b/hsarweb/src/de/hsadmin/web/HomeModule.java
@@ -95,7 +95,7 @@ public class HomeModule extends AbstractModule implements ComponentFactory, Upda
ThemeResource icon = new ThemeResource(moduleConfig.getLabel("change_password_icon"));
button.setIcon(icon);
Map whereHash = new HashMap();
- whereHash.put("name", application.getLogin());
+ whereHash.put("name", application.getRunAs());
Long key = -1L;
try {
Object object = application.getRemote().callSearch(moduleConfig.getRemoteName(), whereHash);
diff --git a/hsarweb/src/de/hsadmin/web/MainApplication.java b/hsarweb/src/de/hsadmin/web/MainApplication.java
index 5a883c9..373238f 100644
--- a/hsarweb/src/de/hsadmin/web/MainApplication.java
+++ b/hsarweb/src/de/hsadmin/web/MainApplication.java
@@ -46,6 +46,9 @@ public class MainApplication extends Application implements HttpServletRequestLi
private Remote remote;
private Map modules;
private Locale requestLocale;
+ private String role = "NONE";
+ private String runAs = null;
+ private TabSheet tabSheet;
@Override
@@ -56,7 +59,6 @@ public class MainApplication extends Application implements HttpServletRequestLi
}
localeConfig = new LocaleConfig(locale, "main");
remote = new Remote(this);
- String role = "NONE";
try {
Object rolesArrayObj = remote.callSearch("role", null);
if (rolesArrayObj != null && rolesArrayObj instanceof Object[]) {
@@ -69,8 +71,8 @@ public class MainApplication extends Application implements HttpServletRequestLi
showSystemException(e);
}
Window mainWindow = new Window(localeConfig.getText("applicationtitle"));
- TabSheet tabs = new TabSheet();
- tabs.setSizeFull();
+ tabSheet = new TabSheet();
+ tabSheet.setSizeFull();
String modulesParamString = localeConfig.getText("modules." + role);
modules = new HashMap();
Module firstModule = null;
@@ -84,13 +86,13 @@ public class MainApplication extends Application implements HttpServletRequestLi
ModuleConfig moduleConfig = module.getModuleConfig();
String label = moduleConfig.getLabel("moduletitle");
modules.put(label, module);
- tabs.addTab((Component) module.getComponent(), label, new ThemeResource(moduleConfig.getLabel("moduleicon")));
+ tabSheet.addTab((Component) module.getComponent(), label, new ThemeResource(moduleConfig.getLabel("moduleicon")));
} catch (Exception e) {
showSystemException(e);
}
}
- tabs.addListener(this);
- mainWindow.setContent(tabs);
+ tabSheet.addListener(this);
+ mainWindow.setContent(tabSheet);
setMainWindow(mainWindow);
setErrorHandler(new Terminal.ErrorListener() {
private static final long serialVersionUID = 1L;
@@ -105,6 +107,10 @@ public class MainApplication extends Application implements HttpServletRequestLi
showSystemException(e);
}
}
+
+ public String getLoginUserRole() {
+ return role;
+ }
public String getProxyTicket() {
return userPrincipal.getProxyTicketFor(servletContext.getInitParameter("backendURL"));
@@ -186,4 +192,24 @@ public class MainApplication extends Application implements HttpServletRequestLi
getMainWindow().showNotification("System-Fehler", "
Bitte informieren Sie den Support
" + e.getMessage(), Notification.TYPE_ERROR_MESSAGE);
}
+ public String getRunAs() {
+ if (runAs == null) {
+ return getLogin();
+ }
+ return runAs;
+ }
+
+ public void setRunAs(String runAs) {
+ this.runAs = runAs;
+ Component selectedTab = tabSheet.getSelectedTab();
+ Tab tab = tabSheet.getTab(selectedTab);
+ Module module = modules.get(tab.getCaption());
+ try {
+ module.reload();
+ } catch (HsarwebException e) {
+ e.printStackTrace();
+ showSystemException(e);
+ }
+ }
+
}
diff --git a/hsarweb/src/de/hsadmin/web/Remote.java b/hsarweb/src/de/hsadmin/web/Remote.java
index 512d7de..b9771a6 100644
--- a/hsarweb/src/de/hsadmin/web/Remote.java
+++ b/hsarweb/src/de/hsadmin/web/Remote.java
@@ -36,7 +36,7 @@ public class Remote {
private Object xmlrpcCall(String module, String operation, Map param1) throws HsarwebException {
Object[] params = new Object[3];
- params[0] = app.getLogin();
+ params[0] = app.getRunAs();
params[1] = app.getProxyTicket();
params[2] = param1 != null ? param1 : new HashMap();
return xmlrpcCall(module + "." + operation, params);
@@ -44,7 +44,7 @@ public class Remote {
private Object xmlrpcCall(String module, String operation, Map param1, Map param2) throws HsarwebException {
Object[] params = new Object[4];
- params[0] = app.getLogin();
+ params[0] = app.getRunAs();
params[1] = app.getProxyTicket();
params[2] = param1 != null ? param1 : new HashMap();
params[3] = param2 != null ? param2 : new HashMap();
diff --git a/hsarweb/src/de/hsadmin/web/UnixUserModule.java b/hsarweb/src/de/hsadmin/web/UnixUserModule.java
index 09732f5..7cc59e8 100644
--- a/hsarweb/src/de/hsadmin/web/UnixUserModule.java
+++ b/hsarweb/src/de/hsadmin/web/UnixUserModule.java
@@ -22,7 +22,7 @@ public class UnixUserModule extends GenericModule {
protected void initModule() {
MainApplication application = getApplication();
moduleConfig = new ModuleConfig("user", application.getLocale());
- String login = application.getLogin();
+ String login = application.getRunAs();
final String pac = login.length() >= 5 ? login.substring(0, 5) : "";
PropertyConfig pacProp = new PropertyConfig(moduleConfig, "pac", String.class, PropertyTableColumn.HIDDEN, new SelectPropertyFieldFactory());
pacProp.setSelectValues(new PropertySelectValues() {