From f8d2a5d084ba4827fe76ff7d16e4a41bb6a75165 Mon Sep 17 00:00:00 2001 From: Derek Hulley Date: Fri, 7 Mar 2008 04:11:23 +0000 Subject: [PATCH] Merged V2.2 to HEAD 8033: Merged V2.1 to V2.2 7728: Fix and patch for WCM-893 - now only users explicitly invited to a Web Project can see it in the web-client 7954: Missing file from CHK-2018 - Fix and patch for WCM-893 8042: Fixed AWC-1588: Exception message for unsupported target mimetype git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8452 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../messages/patch-service.properties | 5 +- .../alfresco/patch/patch-services-context.xml | 43 ++++++-- config/alfresco/version.properties | 2 +- .../AVMWebProjectInheritPermissionsPatch.java | 97 +++++++++++++++++++ .../OpenOfficeContentTransformer.java | 2 +- 5 files changed, 136 insertions(+), 13 deletions(-) create mode 100644 source/java/org/alfresco/repo/admin/patch/impl/AVMWebProjectInheritPermissionsPatch.java diff --git a/config/alfresco/messages/patch-service.properties b/config/alfresco/messages/patch-service.properties index 28c64677c5..7ea4a682ee 100644 --- a/config/alfresco/messages/patch-service.properties +++ b/config/alfresco/messages/patch-service.properties @@ -155,7 +155,7 @@ patch.webscriptsExtension.description=Adds Web Scripts Extension to Data Diction patch.AVMLayeredSnapshot.description=Set indirectionVersion on Layered Nodes. patch.AVMLayeredSnapshot.result=Layered Node indirectionVersions set. -patch.groupMembersAsIdentifiers.description=Reindex usr:authorityContainer members as identifiers======= +patch.groupMembersAsIdentifiers.description=Reindex usr:authorityContainer members as identifiers patch.genericWorkflow.result.deployed=Re-deployed {0} workflows. @@ -209,3 +209,6 @@ patch.updateAvmPermissions.result=Updated ACLs. Created {0} defining and {1} lay patch.wcmPermissionPatch.description=Fix ACLs so they are only set on the staging area store. patch.wcmPermissionPatch.result=Updated ACLs: ACLS are moved to the staging area store and removed from all other stores. They are now applied via layering. + +patch.avmWebProjectInheritPermissions.description=Break inheritance of permissions on wca:webfolder object to hide access by default. +patch.avmWebProjectInheritPermissions.result=Removed inheritance of permissions on all wca:webfolder objects. diff --git a/config/alfresco/patch/patch-services-context.xml b/config/alfresco/patch/patch-services-context.xml index 2f73ee1cbc..ec605217eb 100644 --- a/config/alfresco/patch/patch-services-context.xml +++ b/config/alfresco/patch/patch-services-context.xml @@ -1339,8 +1339,8 @@ - - + + patch.wcmPermissionPatch patch.wcmPermissionPatch.description 0 @@ -1348,13 +1348,36 @@ 122 - - - - - - - - + + + + + + + + + + + patch.avmWebProjectInheritPermissions + patch.avmWebProjectInheritPermissions.description + 0 + 122 + 123 + + + + + + + + + + + + + + + + diff --git a/config/alfresco/version.properties b/config/alfresco/version.properties index 56f86eeb56..1c93561a1f 100644 --- a/config/alfresco/version.properties +++ b/config/alfresco/version.properties @@ -19,4 +19,4 @@ version.build=@build-number@ # Schema number -version.schema=122 +version.schema=123 diff --git a/source/java/org/alfresco/repo/admin/patch/impl/AVMWebProjectInheritPermissionsPatch.java b/source/java/org/alfresco/repo/admin/patch/impl/AVMWebProjectInheritPermissionsPatch.java new file mode 100644 index 0000000000..264e2e4331 --- /dev/null +++ b/source/java/org/alfresco/repo/admin/patch/impl/AVMWebProjectInheritPermissionsPatch.java @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing + */ +package org.alfresco.repo.admin.patch.impl; + +import org.alfresco.i18n.I18NUtil; +import org.alfresco.repo.admin.patch.AbstractPatch; +import org.alfresco.repo.importer.ImporterBootstrap; +import org.alfresco.repo.search.Indexer; +import org.alfresco.repo.search.IndexerAndSearcher; +import org.alfresco.service.cmr.search.ResultSet; +import org.alfresco.service.cmr.search.ResultSetRow; +import org.alfresco.service.cmr.search.SearchParameters; +import org.alfresco.service.cmr.search.SearchService; +import org.alfresco.service.cmr.security.PermissionService; + +/** + * Patch to break the inheritance of permissions on AVM Web Project Folders. + * This removes the need for admins to write a script or similar to by default hide web folders + * to all users except those explicitly invited (given permissions) to the project. + * + * @author Kevin Roast + */ +public class AVMWebProjectInheritPermissionsPatch extends AbstractPatch +{ + private static final String MSG_SUCCESS = "patch.avmWebProjectInheritPermissions.result"; + + private ImporterBootstrap spacesImporterBootstrap; + private IndexerAndSearcher indexerAndSearcher; + private PermissionService permissionService; + + public void setIndexerAndSearcher(IndexerAndSearcher indexerAndSearcher) + { + this.indexerAndSearcher = indexerAndSearcher; + } + + public void setSpacesImporterBootstrap(ImporterBootstrap spacesImporterBootstrap) + { + this.spacesImporterBootstrap = spacesImporterBootstrap; + } + + public void setPermissionService(PermissionService permissionService) + { + this.permissionService = permissionService; + } + + /* (non-Javadoc) + * @see org.alfresco.repo.admin.patch.AbstractPatch#applyInternal() + */ + @Override + protected String applyInternal() throws Exception + { + SearchParameters sp = new SearchParameters(); + sp.setLanguage(SearchService.LANGUAGE_LUCENE); + sp.setQuery("TYPE:\"wca:webfolder\""); + sp.addStore(spacesImporterBootstrap.getStoreRef()); + ResultSet rs = null; + try + { + rs = searchService.query(sp); + for (ResultSetRow row : rs) + { + this.permissionService.setInheritParentPermissions(row.getNodeRef(), false); + } + } + finally + { + if (rs != null) + { + rs.close(); + } + } + + return I18NUtil.getMessage(MSG_SUCCESS); + } +} diff --git a/source/java/org/alfresco/repo/content/transform/OpenOfficeContentTransformer.java b/source/java/org/alfresco/repo/content/transform/OpenOfficeContentTransformer.java index 9a34a6e693..00e33ba2db 100644 --- a/source/java/org/alfresco/repo/content/transform/OpenOfficeContentTransformer.java +++ b/source/java/org/alfresco/repo/content/transform/OpenOfficeContentTransformer.java @@ -192,7 +192,7 @@ public class OpenOfficeContentTransformer extends AbstractContentTransformer if (targetFormat == null) { // target format is not recognised - throw new ContentIOException("No OpenOffice document format for target extension: " + sourceExtension); + throw new ContentIOException("No OpenOffice document format for target extension: " + targetExtension); } // get the family of the target document DocumentFamily sourceFamily = sourceFormat.getFamily();