Search in sources :

Example 1 with SiteConfiguration

use of org.olat.core.gui.control.navigation.SiteConfiguration in project OpenOLAT by OpenOLAT.

the class CatalogContextEntryControllerCreator method isCatalogSiteVisible.

private boolean isCatalogSiteVisible(UserRequest ureq) {
    if (repositoryModule.isCatalogEnabled() && repositoryModule.isCatalogSiteEnabled()) {
        try {
            CatalogSiteDef siteDef = CoreSpringFactory.getImpl(CatalogSiteDef.class);
            SiteDefinitions siteDefinitions = CoreSpringFactory.getImpl(SiteDefinitions.class);
            SiteConfiguration config = siteDefinitions.getConfigurationSite(siteDef);
            if (config != null && StringHelper.containsNonWhitespace(config.getSecurityCallbackBeanId())) {
                String secCallbackBeanId = config.getSecurityCallbackBeanId();
                Object siteSecCallback = CoreSpringFactory.getBean(secCallbackBeanId);
                if (siteSecCallback instanceof SiteSecurityCallback && !((SiteSecurityCallback) siteSecCallback).isAllowedToLaunchSite(ureq)) {
                    return false;
                }
            }
        } catch (Exception e) {
            log.error("Cannot find if the user is allowed to launch the catalog.", e);
        }
        return true;
    } else {
        return false;
    }
}
Also used : SiteSecurityCallback(org.olat.core.gui.control.navigation.SiteSecurityCallback) CatalogSiteDef(org.olat.repository.site.CatalogSiteDef) SiteConfiguration(org.olat.core.gui.control.navigation.SiteConfiguration) SiteDefinitions(org.olat.core.gui.control.navigation.SiteDefinitions)

Example 2 with SiteConfiguration

use of org.olat.core.gui.control.navigation.SiteConfiguration in project openolat by klemens.

the class SitesConfigurationController method doUpdateOrders.

private void doUpdateOrders() {
    int count = 0;
    List<SiteConfiguration> configs = new ArrayList<SiteConfiguration>();
    for (SiteDefRow row : model.getObjects()) {
        SiteConfiguration config = row.getRawConfiguration(false);
        config.setOrder(count++);
        configs.add(config);
    }
    sitesModule.setSitesConfiguration(configs);
}
Also used : ArrayList(java.util.ArrayList) SiteConfiguration(org.olat.core.gui.control.navigation.SiteConfiguration)

Example 3 with SiteConfiguration

use of org.olat.core.gui.control.navigation.SiteConfiguration in project openolat by klemens.

the class SitesConfigurationController method reload.

protected void reload() {
    List<SiteDefRow> configs = new ArrayList<SiteDefRow>();
    for (Map.Entry<String, SiteDefinition> entryDef : siteDefs.entrySet()) {
        String id = entryDef.getKey();
        SiteDefinition siteDef = entryDef.getValue();
        String title = translate(siteDef.getClass().getSimpleName());
        SiteConfiguration config = sitesModule.getConfigurationSite(id);
        SiteDefRow row = new SiteDefRow(siteDef, config, title, formLayout);
        configs.add(row);
    }
    Collections.sort(configs, new RowOrderComparator());
    model.setObjects(configs);
}
Also used : SiteDefinition(org.olat.core.gui.control.navigation.SiteDefinition) ArrayList(java.util.ArrayList) SiteConfiguration(org.olat.core.gui.control.navigation.SiteConfiguration) Map(java.util.Map)

Example 4 with SiteConfiguration

use of org.olat.core.gui.control.navigation.SiteConfiguration in project openolat by klemens.

the class SitesConfigurationController method doSaveSettings.

private void doSaveSettings() {
    int count = 0;
    List<SiteConfiguration> configs = new ArrayList<SiteConfiguration>();
    for (SiteDefRow row : model.getObjects()) {
        SiteConfiguration config = row.getRawConfiguration(true);
        config.setOrder(count++);
        configs.add(config);
    }
    sitesModule.setSitesConfiguration(configs);
}
Also used : ArrayList(java.util.ArrayList) SiteConfiguration(org.olat.core.gui.control.navigation.SiteConfiguration)

Example 5 with SiteConfiguration

use of org.olat.core.gui.control.navigation.SiteConfiguration in project OpenOLAT by OpenOLAT.

the class SitesConfigurationController method reload.

protected void reload() {
    List<SiteDefRow> configs = new ArrayList<SiteDefRow>();
    for (Map.Entry<String, SiteDefinition> entryDef : siteDefs.entrySet()) {
        String id = entryDef.getKey();
        SiteDefinition siteDef = entryDef.getValue();
        String title = translate(siteDef.getClass().getSimpleName());
        SiteConfiguration config = sitesModule.getConfigurationSite(id);
        SiteDefRow row = new SiteDefRow(siteDef, config, title, formLayout);
        configs.add(row);
    }
    Collections.sort(configs, new RowOrderComparator());
    model.setObjects(configs);
}
Also used : SiteDefinition(org.olat.core.gui.control.navigation.SiteDefinition) ArrayList(java.util.ArrayList) SiteConfiguration(org.olat.core.gui.control.navigation.SiteConfiguration) Map(java.util.Map)

Aggregations

SiteConfiguration (org.olat.core.gui.control.navigation.SiteConfiguration)8 ArrayList (java.util.ArrayList)6 Map (java.util.Map)2 SiteDefinition (org.olat.core.gui.control.navigation.SiteDefinition)2 SiteDefinitions (org.olat.core.gui.control.navigation.SiteDefinitions)2 SiteSecurityCallback (org.olat.core.gui.control.navigation.SiteSecurityCallback)2 CatalogSiteDef (org.olat.repository.site.CatalogSiteDef)2