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.service.url=https://config.hostsharing.net:443/hsar/backend
accountprefix.hostmaster=hsh01

View File

@ -1,30 +1,50 @@
package de.hsadmin.web;
import java.util.ArrayList;
import java.util.List;
import de.hsadmin.login.Role;
import de.hsadmin.rpc.ModulesManager;
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
public String[] getEntryPointNames(final String role) {
final ModulesManager modulesManager = mainWindow.getModulesManager();
final List<String> entryPointNames = new ArrayList<>();
if (Role.SYSTEM.name().equals(role)) {
return new String[] { "customer", "pac" };
// return new String[] { "customer", "pac", "domain" };
addEntryPointIfModuleExists(modulesManager, entryPointNames, "customer");
addEntryPointIfModuleExists(modulesManager, entryPointNames, "pac");
addEntryPointIfModuleExists(modulesManager, entryPointNames, "domain");
}
if (Role.CUSTOMER.name().equals(role)) {
return new String[] { "customer", "pac" };
// return new String[] { "customer", "pac", "domain" };
addEntryPointIfModuleExists(modulesManager, entryPointNames, "customer");
addEntryPointIfModuleExists(modulesManager, entryPointNames, "pac");
addEntryPointIfModuleExists(modulesManager, entryPointNames, "domain");
}
if (Role.PACKET.name().equals(role)) {
return new String[] { "pac" };
// return new String[] { "pac", "domain" };
addEntryPointIfModuleExists(modulesManager, entryPointNames, "pac");
addEntryPointIfModuleExists(modulesManager, entryPointNames, "domain");
}
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 {
final String role = getRole();
final AbstractEntryPointsFactory entryPointsFactory = FactoryProducer.getEntryPointsFactory("default");
final AbstractEntryPointsFactory entryPointsFactory = FactoryProducer.getEntryPointsFactory(mainWindow, "default");
int tabCount = 0;
for(String tabName : entryPointsFactory.getEntryPointNames(role)) {
accordion.addTab(new EntryPoint(this, tabName), I18N.getText(tabName));

View File

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