customer tab works in local admin-web

This commit is contained in:
Peter Hormanns 2017-05-10 11:45:52 +02:00
parent 19c43be1d7
commit da37fd8832
4 changed files with 35 additions and 15 deletions

View File

@ -1,4 +1,4 @@
ticketvalidator.class=de.hsadmin.login.TestTicketValidator ticketvalidator.class=de.hsadmin.login.cas.TestTicketValidator
cas.validate.url=https://login.hostsharing.net:443/cas/proxyValidate cas.validate.url=https://login.hostsharing.net:443/cas/proxyValidate
cas.service.url=https://config.hostsharing.net:443/hsar/backend cas.service.url=https://config.hostsharing.net:443/hsar/backend
accountprefix.hostmaster=hsh01 accountprefix.hostmaster=hsh01

View File

@ -1,30 +1,50 @@
package de.hsadmin.web; package de.hsadmin.web;
import java.util.ArrayList;
import java.util.List;
import de.hsadmin.login.Role; import de.hsadmin.login.Role;
import de.hsadmin.rpc.ModulesManager;
public class EntryPointsFactory extends AbstractEntryPointsFactory { public class EntryPointsFactory extends AbstractEntryPointsFactory {
// FIXME: Domain-Modul zum Testen auskommentiert (ph) private final MainWindow mainWindow;
public EntryPointsFactory(final MainWindow window) {
this.mainWindow = window;
}
@Override @Override
public String[] getEntryPointNames(final String role) { public String[] getEntryPointNames(final String role) {
final ModulesManager modulesManager = mainWindow.getModulesManager();
final List<String> entryPointNames = new ArrayList<>();
if (Role.SYSTEM.name().equals(role)) { if (Role.SYSTEM.name().equals(role)) {
return new String[] { "customer", "pac" }; addEntryPointIfModuleExists(modulesManager, entryPointNames, "customer");
// return new String[] { "customer", "pac", "domain" }; addEntryPointIfModuleExists(modulesManager, entryPointNames, "pac");
addEntryPointIfModuleExists(modulesManager, entryPointNames, "domain");
} }
if (Role.CUSTOMER.name().equals(role)) { if (Role.CUSTOMER.name().equals(role)) {
return new String[] { "customer", "pac" }; addEntryPointIfModuleExists(modulesManager, entryPointNames, "customer");
// return new String[] { "customer", "pac", "domain" }; addEntryPointIfModuleExists(modulesManager, entryPointNames, "pac");
addEntryPointIfModuleExists(modulesManager, entryPointNames, "domain");
} }
if (Role.PACKET.name().equals(role)) { if (Role.PACKET.name().equals(role)) {
return new String[] { "pac" }; addEntryPointIfModuleExists(modulesManager, entryPointNames, "pac");
// return new String[] { "pac", "domain" }; addEntryPointIfModuleExists(modulesManager, entryPointNames, "domain");
} }
if (Role.DOMAIN.name().equals(role)) { if (Role.DOMAIN.name().equals(role)) {
// return new String[] { "domain" }; addEntryPointIfModuleExists(modulesManager, entryPointNames, "domain");
}
return entryPointNames.toArray(new String[] {});
}
private void addEntryPointIfModuleExists(
final ModulesManager modulesManager, final List<String> entryPointNames,
final String moduleName)
{
if (modulesManager.hasModule(moduleName)) {
entryPointNames.add(moduleName);
} }
return new String[] { };
} }
} }

View File

@ -41,7 +41,7 @@ public class EntryPointsSelector extends CustomComponent implements ItemClickLis
private void createTabs() throws RpcException { private void createTabs() throws RpcException {
final String role = getRole(); final String role = getRole();
final AbstractEntryPointsFactory entryPointsFactory = FactoryProducer.getEntryPointsFactory("default"); final AbstractEntryPointsFactory entryPointsFactory = FactoryProducer.getEntryPointsFactory(mainWindow, "default");
int tabCount = 0; int tabCount = 0;
for(String tabName : entryPointsFactory.getEntryPointNames(role)) { for(String tabName : entryPointsFactory.getEntryPointNames(role)) {
accordion.addTab(new EntryPoint(this, tabName), I18N.getText(tabName)); accordion.addTab(new EntryPoint(this, tabName), I18N.getText(tabName));

View File

@ -18,8 +18,8 @@ public class FactoryProducer {
return new GenericEditorFactory(); return new GenericEditorFactory();
} }
public static AbstractEntryPointsFactory getEntryPointsFactory(String choice) { public static AbstractEntryPointsFactory getEntryPointsFactory(MainWindow window, String choice) {
return new EntryPointsFactory(); return new EntryPointsFactory(window);
} }
} }