op = "";
final String operation = op;
ParamBean jParams = initAdminJahiaData(request, response, session);
final JahiaUser user = jParams.getUser();
final JahiaSite site = jParams.getSite();
try {
Boolean accessGranted = (Boolean) session.getAttribute(CLASS_NAME + "accessGranted");
if (accessGranted == null) {
accessGranted = Boolean.FALSE;
}
if (accessGranted) {
Locale uiLocale = (Locale) request.getSession().getAttribute(ProcessingContext.SESSION_UI_LOCALE);
if(request.getParameter("switchUiLocale") != null) {
uiLocale = LanguageCodeConverters.languageCodeToLocale(request.getParameter("switchUiLocale"));
request.getSession().setAttribute(ProcessingContext.SESSION_UI_LOCALE, uiLocale);
user.setProperty("preferredLanguage", uiLocale.toString());
}
Config.set(request, Config.FMT_LOCALIZATION_CONTEXT,
new LocalizationContext(new JahiaResourceBundle(uiLocale, site.getTemplatePackageName()), uiLocale));
AdministrationModulesRegistry modulesRegistry = (AdministrationModulesRegistry) SpringContextSingleton.getInstance().getContext().getBean("administrationModulesRegistry");
AdministrationModule currentModule = modulesRegistry.getServerAdministrationModule(operation);
if (currentModule != null) {
if (hasSitePermission(currentModule.getPermissionName(), site.getSiteKey()) || hasServerPermission(currentModule.getPermissionName())) {
session.setAttribute(CLASS_NAME + "configJahia", Boolean.TRUE);
/** todo clean up this hardcoded mess. Is it even used anymore ? */
if ("sharecomponents".equals(operation) && user.isRoot()) {
request.setAttribute("showAllComponents", Boolean.TRUE);
}
currentModule.service(request, response);
} else if ("sites".equals(operation) && (session.getAttribute(JahiaAdministration.CLASS_NAME + "redirectToJahia") != null)) {
session.setAttribute(CLASS_NAME + "configJahia", Boolean.TRUE);
currentModule.service(request, response);
}
} else {
currentModule = modulesRegistry.getSiteAdministrationModule(operation);
if (currentModule != null) {
if (hasSitePermission(currentModule.getPermissionName(), site.getSiteKey())) {
session.setAttribute(CLASS_NAME + "configJahia", Boolean.FALSE);
if ("search".equals(operation)) {
// Use response wrapper to ensure correct handling of Application fields output to the response
// @todo is this still necessary with Pluto wrapper in effect ?
currentModule.service(new ServletIncludeRequestWrapper(request), new ServletIncludeResponseWrapper(response, true, SettingsBean.getInstance().getCharacterEncoding()));