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
This commit is contained in:
Derek Hulley
2008-03-07 04:11:23 +00:00
parent 0ec2646938
commit f8d2a5d084
5 changed files with 136 additions and 13 deletions

View File

@@ -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);
}
}