public UpdateURI2RepositoryMappings() { super("Update URI2Repository mappings", "The structure of the URI2Repository mappings have changed in 3.5", RepositoryConstants.CONFIG, SERVER_URI2REPOSITORY_MAPPING); subTasks = new ArrayDelegateTask("Move URI2Repository mapping nodes"); }
@Override protected List<Task> getExtraInstallTasks(InstallContext installContext) { final List<Task> tasks = new ArrayList<Task>(); tasks.add(new BootstrapConditionally("Observation listeners", "Installs observation listeners by keeping already existing ones, possibly provided by other modules.", "/mgnl-bootstrap/listenerConfigs/config.modules.observation.config.xml", new ArrayDelegateTask("", new PartialBootstrapTask("", "", "/mgnl-bootstrap/listenerConfigs/config.modules.observation.config.xml", "/config/listenerConfigurations/sendMailOnPageChanges"), new PartialBootstrapTask("", "", "/mgnl-bootstrap/listenerConfigs/config.modules.observation.config.xml", "/config/listenerConfigurations/activateAddedPages")))); tasks.add(usePublicationCommand); return tasks; } }
protected List<Task> getCommonTasks() { final List<Task> commonTasks = new ArrayList<>(); commonTasks.add(new IsInstallSamplesTask("Re-Bootstrap website content for sample pages", "Re-bootstrap website content to account for all changes", new ArrayDelegateTask("", new BootstrapSingleResource("", "", "/mgnl-bootstrap-samples/samples/website.ftl-sample-site.xml"), new BootstrapSingleResource("", "", "/mgnl-bootstrap-samples/samples/dam.samples.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING)))); // We re-bootstrap twice because a simple (and single) re-bootstrap (using ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING) would NOT // "move" an existing site definition (which might actually exist from a previous version) in the site module commonTasks.add(new BootstrapSingleModuleResource("config.modules.samples.config.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING)); commonTasks.add(new BootstrapSingleModuleResource("config.modules.samples.config.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW)); return commonTasks; }
private Task getRemoveLegacyAppsTask(String name, String description) { ArrayDelegateTask removeLegacyAppsTask = new ArrayDelegateTask(name, description); try { Node appsNode = SessionUtil.getNode(RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/data/apps"); if (appsNode != null) { NodeIterator nodeIterator = appsNode.getNodes(); while (nodeIterator.hasNext()) { String appName = ((Node) nodeIterator.next()).getName(); removeLegacyAppsTask.addTask(new RemoveNodeTask("Remove data legacy app " + appName, "This removes configuration for the data legacy app " + appName, RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/" + appName)); removeLegacyAppsTask.addTask(new RemoveNodeTask("Remove " + appName + " launcher", "This task removes the applauncher configuration for the data legacy app " + appName, RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/data/apps/" + appName)); } } } catch (RepositoryException e) { log.warn("Couldn't fetch data app configuration in appLauncherLayout", e); } return removeLegacyAppsTask; }
protected Task updateSecurityBaseRolePermissions() { ArrayDelegateTask permissionsTask = new ArrayDelegateTask("Update security-base role", "Disallows access to some sensitive URIs and grants basic access to AdminCentral."); for (String path : PERMISSIONS_FOR_LEGACY_PAGES) { permissionsTask.addTask(new RemovePermissionTask("", SECURITY_BASE_ROLE, "uri", path, AddURIPermissionTask.DENY)); } permissionsTask.addTask(new RemovePermissionTask("", SECURITY_BASE_ROLE, RepositoryConstants.USER_ROLES, "/" + SECURITY_BASE_ROLE, Permission.READ)); return permissionsTask; }
public ReplaceIfExistsTask(String name, String description, String warningMessageIfNotExisting, String workspaceName, String pathToCheck, String bootstrapFile) { super(name, description, workspaceName, pathToCheck, new ArrayDelegateTask("", new RemoveNodeTask("", "", workspaceName, pathToCheck), new BootstrapSingleResource(name, description, bootstrapFile) ), new WarnTask(name, warningMessageIfNotExisting)); } }
@Override protected List<Task> getExtraInstallTasks(InstallContext installContext) { List<Task> list = new ArrayList<Task>(); // We have to enable PUT/DELETE method in /server/IPConfig/allow-all.methods list.add(new CheckAndModifyPropertyValueTask("Enable PUT method", "Enables PUT method in '/server/IPConfig/allow-all.methods'", RepositoryConstants.CONFIG, "/server/IPConfig/allow-all", "methods", "GET,POST", "GET,POST,PUT,DELETE")); list.add(new ArrayDelegateTask("Update 'rest-editor' role", new AddPermissionTask("Update 'rest-editor' role", "Allows access to the REST API documentation interface residing under '/.rest/api-docs' in role 'rest-editor'.", "rest-editor", "uri", "/.rest/commands*", Permission.NONE, false), new AddPermissionTask("Update 'rest-editor' role", "Denies access to the 'nodes' endpoint.", "rest-editor", "uri", "/.rest/nodes*", Permission.NONE, false), new AddPermissionTask("Update 'rest-editor' role", "Allows access to the 'nodes' endpoint for workspace 'website'.", "rest-editor", "uri", "/.rest/nodes/v1/website*", Permission.ALL, false), new AddPermissionTask("Update 'rest-editor' role", "Denies access to the 'properties' endpoint.", "rest-editor", "uri", "/.rest/properties*", Permission.NONE, false), new AddPermissionTask("Update 'rest-editor' role", "Allows access to the 'nodes' properties for workspace 'website'.", "rest-editor", "uri", "/.rest/properties/v1/website*", Permission.ALL, false) )); return list; }
private Task addBypassToResourcesServlet() { return new ArrayDelegateTask("Add delegateResourceVoter to ResourcesServlet.", new NodeExistsDelegateTask("", "/server/filters/servlets/ResourcesServlet", new NodeExistsDelegateTask("", "/server/filters/servlets/ResourcesServlet/bypasses", new WarnTask("", "DelegateResourceVoter couldn't be installed since there is already a bypass defined for ResourcesServlet."), new ArrayDelegateTask("", new CreateNodeTask("", "/server/filters/servlets/ResourcesServlet", "bypasses", NodeTypes.ContentNode.NAME), new CreateNodeTask("", "/server/filters/servlets/ResourcesServlet/bypasses", "bypassWhenNotInResourceFilter", NodeTypes.ContentNode.NAME), new NewPropertyTask("", "/server/filters/servlets/ResourcesServlet/bypasses/bypassWhenNotInResourceFilter", "class", "info.magnolia.module.resources.DelegateResourceVoter"), new NewPropertyTask("", "/server/filters/servlets/ResourcesServlet/bypasses/bypassWhenNotInResourceFilter", "not", true))))); }
tasks.add(new IsModuleInstalledOrRegistered("Configure STK site for multisite", "multisite", new NodeExistsDelegateTask("Check if stk can be moved to the multisite", "/modules/standard-templating-kit/config/site", new ArrayDelegateTask("", "", new NodeExistsDelegateTask("Check for default site", "Check whether default site already exists or not - if no, site from stk will be copied to multisite", RepositoryConstants.CONFIG, "/modules/multisite/config/sites/default", new WarnTask("Default already site exists", "Default site already exists. No actions will be taken."), new ArrayDelegateTask("", "", new CreateNodePathTask("", "/modules/multisite/config/sites/", NodeTypes.ContentNode.NAME), new CopyNodeTask("Default site configuration", "Copy the configuration of the STK site", "config", "/modules/standard-templating-kit/config/site", "/modules/multisite/config/sites/default", false),
public MigrateValidationSelectFieldToTwinColSelectFieldTask(String name, String[] fields) { super(name); for (String field : fields) { addTask(new NodeExistsDelegateTask(String.format("Migrate 'validation' field '%s' to multi select field.", field), field, new ArrayDelegateTask("", new RemovePropertyTask(String.format("Remove property 'buttonLabel' for validation field in '%s'", field), field, "buttonLabel"), new RemovePropertyTask(String.format("Remove property 'type' for validation field in '%s'", field), field, "type"), new ValueOfPropertyDelegateTask("", field, "class", "info.magnolia.ui.form.field.definition.SelectFieldDefinition", false, new SetPropertyTask(RepositoryConstants.CONFIG, field, "class", "info.magnolia.ui.form.field.definition.TwinColSelectFieldDefinition")), new SetPropertyTask(RepositoryConstants.CONFIG, field, "leftColumnCaption", "dialog.form.edit.tabMain.validation.leftColumnCaption"), new SetPropertyTask(RepositoryConstants.CONFIG, field, "rightColumnCaption", "dialog.form.edit.tabMain.validation.rightColumnCaption") ), new WarnTask("Unable to migrate validation field", String.format(WARNING_MESSAGE_FORMAT, field))) ); } }
@Override public void execute(InstallContext ctx) throws TaskExecutionException { try { final ModuleDefinition def = ctx.getCurrentModuleDefinition(); // register repositories for (RepositoryDefinition repDef : def.getRepositories()) { for (final String workspace : repDef.getWorkspaces()) { ArrayDelegateTask arrayDelegateTask = new ArrayDelegateTask(String.format("Bootstrap the %s if empty, grant it to superuser and subscribe it if activation is installed so that activation can be used.", workspace), new InitializeWorkspaceTask("", "", workspace), new AddPermissionTask("", "superuser", workspace, "/*", Permission.ALL, false), new SubscribeWorkspaceTask(workspace)); arrayDelegateTask.execute(ctx); } } } catch (Throwable e) { throw new TaskExecutionException("Could not bootstrap workspace: " + e.getMessage(), e); } }
)); tasks.add(new AppLauncherReorderingTask("assets", "edit", Order.AFTER, "pages")); tasks.add(new ArrayDelegateTask("Configure icons for assets app", new NodeExistsDelegateTask("", "/server/MIMEMapping/txt", new SetPropertyTask(RepositoryConstants.CONFIG, "/server/MIMEMapping/txt", "iconStyle", "icon-file-text")),
public SiteModuleVersionHandler() { register(DeltaBuilder.update("1.0.1", "") .addTask(updateI18nContentSupport)); register(DeltaBuilder.update("1.0.3", "") .addTask(new NodeExistsDelegateTask("Create empty site definition node if it does not exist", "/modules/site/config/site", null, new BootstrapSingleModuleResource("config.modules.site.config.site.xml")))); register(DeltaBuilder.update("1.0.5", "") .addTask(new BootstrapConditionally("Add site-aware JSP renderer if it does not exist", "/mgnl-bootstrap/site/config.modules.site.renderers.site-jsp.xml")) .addTask(new PropertyValueDelegateTask("Reconfigure site renderer to delegate to freemarker renderer", "/modules/site/renderers/site", "class", SiteAwareFreemarkerRenderer.class.getName(), true, new ArrayDelegateTask("", new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/site/renderers/site", "wrappedRendererType", "freemarker"), new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/site/renderers/site", "class", SiteAwareRendererWrapper.class.getName()), new RemoveNodeTask("", "/modules/site/renderers/site/contextAttributes"), new RemovePropertyTask("", "/modules/site/renderers/site/", "type")))) .addTask(orderSiteMergeFilter) //fix incorrect order of siteMerge filter after update from M5.3 which is before multiSite filter ); register(DeltaBuilder.update("1.1", "") .addTask(new NodeExistsDelegateTask("Remove themes folder if empty", "Location /modules/site/config/themes is deprecated but still supported", RepositoryConstants.CONFIG, "/modules/site/config/themes", new RemoveNodeWithoutChildren("/modules/site/config/themes")))); }
private Task getSampleRegistrationTypeTask(Task... additionalTasks) { ArrayDelegateTask task = new ArrayDelegateTask("", "", new RegisterNodeTypeTask("company"), new RegisterNodeTypeTask("department"), new RegisterNodeTypeTask("employees"), new RegisterNodeTypeTask("director"), new RegisterNodeTypeTask("manager"), new RegisterNodeTypeTask("developer")); for (Task t : additionalTasks) { task.addTask(t); } return new IsInstallSamplesTask("Samples installation", "Register sample of hierarchical node types", task); } }
private Task configureActionsAsAsynchronous() { return new IsModuleInstalledOrRegistered("Configure actions as asynchronous", "Configure actions as asynchronous if scheduler module is installed", "scheduler", new ArrayDelegateTask("", "", new NodeExistsDelegateTask("Configure activation as asynchronous", "/modules/dam/apps/assets/subApps/browser/actions/activate", new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/browser/actions/activate", "asynchronous", "true")), new NodeExistsDelegateTask("Configure recursive activation as asynchronous", "/modules/dam/apps/assets/subApps/browser/actions/activateRecursive", new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/browser/actions/activateRecursive", "asynchronous", "true")), new NodeExistsDelegateTask("Configure deletion as asynchronous", "/modules/dam/apps/assets/subApps/browser/actions/delete", new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/browser/actions/delete", "asynchronous", "true")), new NodeExistsDelegateTask("Configure deletion of folder as asynchronous", "/modules/dam/apps/assets/subApps/browser/actions/deleteFolder", new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/browser/actions/deleteFolder", "asynchronous", "true")) )); }
new ArrayDelegateTask("", new MoveNodeTask("", "", RepositoryConstants.USERS, "/anonymous", "/system/anonymous", false), new NewPropertyTask("Anonymous user", "Anonymous user must have a password.", RepositoryConstants.USERS, "/system/anonymous", "pswd", new String(Base64.encodeBase64("anonymous".getBytes())))
public SamplesVersionHandler() { register(DeltaBuilder.update("5.4.1", "") .addTask(new ArrayDelegateTask("Remove samples configuration from JCR", new NodeExistsDelegateTask("", "/modules/samples/dialogs", new RemoveNodeTask("", "/modules/samples/dialogs")), new NodeExistsDelegateTask("", "/modules/samples/templates", new RemoveNodeTask("", "/modules/samples/templates")), new NodeExistsDelegateTask("", "/modules/samples/virtualURIMapping", new RemoveNodeTask("", "/modules/samples/virtualURIMapping")))) .addTasks(getCommonTasks())); register(DeltaBuilder.update("6.0", "") .addTask(new RemoveNodeTask("Remove JSP sample site", "Magnolia Templating JSP is deprecated as of 6.0.", WEBSITE, "/jsp-sample-site"))); }
register(DeltaBuilder.update("5.2.1", "") .addTask(new NodeExistsDelegateTask("Check if the apps have been installed yet", "Install those that are missing and move existing ones to the ApplLauncher tools group.", RepositoryConstants.CONFIG, "/modules/activation/apps/activation", new ArrayDelegateTask("", new PartialBootstrapTask("Bootstrap app", "Bootstrap activation monitor app", "/mgnl-bootstrap/activation/config.modules.activation.apps.xml", "/apps/activationMonitor"), new NodeExistsDelegateTask("Remove Activation tools from dev group of appLauncher", "", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/dev/apps/activation",
public ObservationModuleVersionHandler() { register(DeltaBuilder.update("2.0", "") .addTask(new CheckAndModifyPropertyValueTask("Replace activation command", "Replaces old activation command with the new one provided by the activation module.", RepositoryConstants.CONFIG, "/modules/observation/config/listenerConfigurations/activateAddedPages/listener/command", "class", "info.magnolia.module.admininterface.commands.ActivationCommand", "info.magnolia.module.activation.commands.ActivationCommand")) .addTask(new CheckAndModifyPropertyValueTask("Replace node type", "Replaces the node type to be used for added pages activation from mgnl:content to mgnl:page.", RepositoryConstants.CONFIG, "/modules/observation/config/listenerConfigurations/activateAddedPages/listener", "nodeType", "mgnl:content", "mgnl:page"))); register(DeltaBuilder.update("2.0.1", "") .addTask(new ArrayDelegateTask("Move repository property", "Moves repository property for activateAddedPages configuration to command params.", new RemovePropertyTask("", "", RepositoryConstants.CONFIG, "/modules/observation/config/listenerConfigurations/activateAddedPages/listener/command", "repository"), new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/observation/config/listenerConfigurations/activateAddedPages/listener/params", null, new CreateNodePathTask("", "", RepositoryConstants.CONFIG, "/modules/observation/config/listenerConfigurations/activateAddedPages/listener/params")), new NewPropertyTask("", "", RepositoryConstants.CONFIG, "/modules/observation/config/listenerConfigurations/activateAddedPages/listener/params", "repository", "website")))); register(DeltaBuilder.update("2.0.2", "") .addTask(new BootstrapSingleResource("foo", "bar", "/mgnl-bootstrap/observation/setup/mail/config.modules.mail.config.templatesConfiguration.pageChangeNotification.xml")) .addTask(new UpdateSendMailOnPagesNotificationTask())); register(DeltaBuilder.update("2.1", "") .addTask(usePublicationCommand) ); }
.addTask(new ArrayDelegateTask("Fix XSS issue in /resources/templating-kit/js/scriptloader-plugin.js", "Fix XSS issue in /resources/templating-kit/js/scriptloader-plugin.js", new InstallTextResourceTask("/templating-kit/js/libs/swfobject.js", ResourceTypes.JS, InstallTextResourceTask.DEFAULT_ENCODING, null, null, null, null, true, false), new RemovePropertyTask("", "", JcrResourceOrigin.RESOURCES_WORKSPACE, "/templating-kit/js/libs/swfobject.js", "extension"),