workflowDefinitions)
- {
- this.workflowDefinitions = workflowDefinitions;
- }
-
- public void setTenantService(TenantService tenantService)
- {
- this.tenantService = tenantService;
- }
-
- /**
- * @see org.alfresco.repo.admin.patch.AbstractPatch#checkProperties()
- */
- @Override
- protected void checkProperties()
- {
- super.checkProperties();
- }
-
- /**
- * @see org.alfresco.repo.admin.patch.AbstractPatch#applyInternal()
- */
- @Override
- protected String applyInternal() throws Exception
- {
- if (!tenantService.isEnabled())
- {
- return I18NUtil.getMessage(MSG_RESULT_NA);
- }
-
- if (! tenantService.getCurrentUserDomain().equals(TenantService.DEFAULT_DOMAIN))
- {
- workflowPatchDeployer.setWorkflowDefinitions(workflowDefinitions);
- workflowPatchDeployer.init();
- }
-
- return I18NUtil.getMessage(MSG_RESULT);
- }
-}
diff --git a/source/java/org/alfresco/repo/admin/patch/impl/SpacesStoreGuestPermissionPatch.java b/source/java/org/alfresco/repo/admin/patch/impl/SpacesStoreGuestPermissionPatch.java
deleted file mode 100644
index 389c4d68f0..0000000000
--- a/source/java/org/alfresco/repo/admin/patch/impl/SpacesStoreGuestPermissionPatch.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.repo.admin.patch.impl;
-
-import java.util.List;
-
-import org.springframework.extensions.surf.util.I18NUtil;
-import org.alfresco.model.ContentModel;
-import org.alfresco.repo.admin.patch.AbstractPatch;
-import org.alfresco.repo.importer.ImporterBootstrap;
-import org.alfresco.repo.security.authentication.AuthenticationUtil;
-import org.alfresco.service.cmr.admin.PatchException;
-import org.alfresco.service.cmr.repository.ChildAssociationRef;
-import org.alfresco.service.cmr.repository.NodeRef;
-import org.alfresco.service.cmr.repository.StoreRef;
-import org.alfresco.service.cmr.security.PermissionService;
-import org.alfresco.service.namespace.QName;
-import org.alfresco.service.namespace.RegexQNamePattern;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Grant Read permission to Guest in SpacesStore root node.
- * Fix for bug ETWOONE-163.
- *
- * [KR] Now correctly applies modified permissions to immediate child nodes of the
- * root node:
- *
- * sys:system - Changed inherit=false, Added GROUP_EVERYONE=READ (to disallow guest)
- * cm:categoryRoot - Removed guest=READ (as already inherits)
- *
- * @author Arseny Kovalchuk
- * @author kevinr
- */
-public class SpacesStoreGuestPermissionPatch extends AbstractPatch
-{
- private static Log logger = LogFactory.getLog(SpacesStoreGuestPermissionPatch.class);
-
- private static final String MSG_RESULT = "patch.spacesStoreGuestPermission.result";
-
- private PermissionService permissionService;
- private ImporterBootstrap importerBootstrap;
-
-
- public void setPermissionService(PermissionService permissionService)
- {
- this.permissionService = permissionService;
- }
-
- public void setImporterBootstrap(ImporterBootstrap importerBootstrap)
- {
- this.importerBootstrap = importerBootstrap;
- }
-
-
- @Override
- protected String applyInternal() throws Exception
- {
- StoreRef store = importerBootstrap.getStoreRef();
- if (store == null)
- {
- throw new PatchException("Bootstrap store has not been set");
- }
-
- NodeRef rootRef = nodeService.getRootNode(store);
- if (logger.isDebugEnabled())
- {
- logger.debug("Store Ref:" + store + " NodeRef: " + rootRef);
- }
- permissionService.setPermission(
- rootRef, AuthenticationUtil.getGuestUserName(), PermissionService.READ, true);
-
- String sysQName = importerBootstrap.getConfiguration().getProperty("system.system_container.childname");
- String catQName = "cm:categoryRoot";
- List refs = nodeService.getChildAssocs(
- rootRef, ContentModel.ASSOC_CHILDREN, RegexQNamePattern.MATCH_ALL);
- for (ChildAssociationRef ref : refs)
- {
- if (ref.getQName().equals(QName.createQName(sysQName, namespaceService)))
- {
- // found sys:system node
- permissionService.setInheritParentPermissions(ref.getChildRef(), false);
- permissionService.setPermission(
- ref.getChildRef(), PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
- }
- else if (ref.getQName().equals(QName.createQName(catQName, namespaceService)))
- {
- // found cm:categoryRoot node
- permissionService.clearPermission(ref.getChildRef(), AuthenticationUtil.getGuestUserName());
- }
- }
-
- return I18NUtil.getMessage(MSG_RESULT);
- }
-}
\ No newline at end of file
diff --git a/source/java/org/alfresco/repo/admin/patch/impl/WebSiteAddModeratedPatch.java b/source/java/org/alfresco/repo/admin/patch/impl/WebSiteAddModeratedPatch.java
deleted file mode 100644
index b78d385ef6..0000000000
--- a/source/java/org/alfresco/repo/admin/patch/impl/WebSiteAddModeratedPatch.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.repo.admin.patch.impl;
-
-import java.util.List;
-import java.util.Set;
-
-import org.springframework.extensions.surf.util.I18NUtil;
-import org.alfresco.repo.admin.patch.AbstractPatch;
-import org.alfresco.repo.site.SiteModel;
-import org.alfresco.service.cmr.repository.NodeRef;
-import org.alfresco.service.cmr.repository.NodeService;
-import org.alfresco.service.cmr.security.AccessPermission;
-import org.alfresco.service.cmr.security.PermissionService;
-import org.alfresco.service.cmr.site.SiteInfo;
-import org.alfresco.service.cmr.site.SiteService;
-import org.alfresco.service.cmr.site.SiteVisibility;
-
-
-
-/**
- * Patch that changes the web site visibility from a boolean
- * (isPublic) to an enum (PUBLIC, PRIVATE, MODERATED).
- *
- * @author mrogers
- */
-public class WebSiteAddModeratedPatch extends AbstractPatch
-{
- private PermissionService permissionService;
- private SiteService siteService;
-
- private static final String MSG_SUCCESS = "patch.webSiteAddModerated.result";
-
- @Override
- protected String applyInternal() throws Exception
- {
- // for all web sites
- String nameFilter = null;
- String sitePresetFilter = null;
- List sites = getSiteService().listSites(nameFilter, sitePresetFilter);
-
- for(SiteInfo site : sites)
- {
- SiteVisibility visibility = SiteVisibility.PRIVATE;
- NodeRef siteNodeRef = site.getNodeRef();
-
- // Get the visibility value stored in the repo
- String visibilityValue = (String)this.nodeService.getProperty(siteNodeRef, SiteModel.PROP_SITE_VISIBILITY);
- // To maintain backwards compatibility calculate the visibility from the permissions
- // if there is no value specified on the site node
- if (visibilityValue == null)
- {
- // Examine each permission to see if this is a public site or not
- Set permissions = this.permissionService.getAllSetPermissions(siteNodeRef);
- for (AccessPermission permission : permissions)
- {
- if (permission.getAuthority().equals(PermissionService.ALL_AUTHORITIES) == true &&
- permission.getPermission().equals(SiteModel.SITE_CONSUMER) == true)
- {
- visibility = SiteVisibility.PUBLIC;
- break;
- }
- }
-
- // Store the visibility value on the node ref for next time
- this.nodeService.setProperty(siteNodeRef, SiteModel.PROP_SITE_VISIBILITY, visibility.toString());
- }
- }
-
- String msg = I18NUtil.getMessage(MSG_SUCCESS);
- return msg;
-
- }
-
- public void setPermissionService(PermissionService permissionService) {
- this.permissionService = permissionService;
- }
-
- public PermissionService getPermissionService() {
- return permissionService;
- }
-
- public void setSiteService(SiteService siteService) {
- this.siteService = siteService;
- }
-
- public SiteService getSiteService() {
- return siteService;
- }
-
-}