mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V2.2 to HEAD
8405: Added causal exception to the runtime generated 8408: AR-2136, AR-2137, AR-2138 8410: WCM-1110, WCM-1111 8417: Stopped chiba:match() function from being inserted into bindings for xforms model elements of type xs:integer. 8419: Fixes for correct use of .empty in name spaces of QNames 8420: Finally fixes WCM-1108 and WCM-1109 8489: Merged V2.1 to V2.2 8482: Fix For AR-2163 8507: Merged V2.1 to V2.2 8504: Fix for AR-2165 - respect repo read only setting during authentication git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8508 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -49,16 +49,23 @@ public class AVMPermissionsPatch extends AbstractPatch
|
||||
@Override
|
||||
protected String applyInternal() throws Exception
|
||||
{
|
||||
Long toDo = aclDaoComponent.getAVMHeadNodeCount();
|
||||
Long maxId = aclDaoComponent.getMaxAclId();
|
||||
Thread progressThread = null;
|
||||
if (aclDaoComponent.supportsProgressTracking())
|
||||
{
|
||||
Long toDo = aclDaoComponent.getAVMHeadNodeCount();
|
||||
Long maxId = aclDaoComponent.getMaxAclId();
|
||||
|
||||
Thread progressThread = new Thread(new ProgressWatcher(toDo, maxId), "WCMPactchProgressWatcher");
|
||||
progressThread.start();
|
||||
progressThread = new Thread(new ProgressWatcher(toDo, maxId), "WCMPactchProgressWatcher");
|
||||
progressThread.start();
|
||||
}
|
||||
|
||||
Map<ACLType, Integer> summary = accessControlListDao.patchAcls();
|
||||
|
||||
progressThread.interrupt();
|
||||
progressThread.join();
|
||||
if (progressThread != null)
|
||||
{
|
||||
progressThread.interrupt();
|
||||
progressThread.join();
|
||||
}
|
||||
|
||||
// build the result message
|
||||
String msg = I18NUtil.getMessage(MSG_SUCCESS, summary.get(ACLType.DEFINING), summary.get(ACLType.LAYERED));
|
||||
|
@@ -25,6 +25,7 @@
|
||||
package org.alfresco.repo.admin.patch.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.i18n.I18NUtil;
|
||||
import org.alfresco.model.WCMAppModel;
|
||||
@@ -89,11 +90,15 @@ public class WCMPermissionPatch extends AbstractPatch
|
||||
@Override
|
||||
protected String applyInternal() throws Exception
|
||||
{
|
||||
Long toDo = aclDaoComponent.getAVMHeadNodeCount();
|
||||
Long maxId = aclDaoComponent.getMaxAclId();
|
||||
Thread progressThread = null;
|
||||
if (aclDaoComponent.supportsProgressTracking())
|
||||
{
|
||||
Long toDo = aclDaoComponent.getAVMHeadNodeCount();
|
||||
Long maxId = aclDaoComponent.getMaxAclId();
|
||||
|
||||
Thread progressThread = new Thread(new ProgressWatcher(toDo, maxId), "WCMPactchProgressWatcher");
|
||||
progressThread.start();
|
||||
progressThread = new Thread(new ProgressWatcher(toDo, maxId), "WCMPactchProgressWatcher");
|
||||
progressThread.start();
|
||||
}
|
||||
|
||||
List<AVMStoreDescriptor> stores = avmService.getStores();
|
||||
for (AVMStoreDescriptor store : stores)
|
||||
@@ -130,9 +135,12 @@ public class WCMPermissionPatch extends AbstractPatch
|
||||
}
|
||||
}
|
||||
|
||||
progressThread.interrupt();
|
||||
progressThread.join();
|
||||
|
||||
if (progressThread != null)
|
||||
{
|
||||
progressThread.interrupt();
|
||||
progressThread.join();
|
||||
}
|
||||
|
||||
// build the result message
|
||||
String msg = I18NUtil.getMessage(MSG_SUCCESS);
|
||||
// done
|
||||
@@ -182,6 +190,30 @@ public class WCMPermissionPatch extends AbstractPatch
|
||||
NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, store.getName() + ":/www");
|
||||
permissionService.setPermission(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
|
||||
|
||||
QName propQName = QName.createQName(null, ".web_project.noderef");
|
||||
|
||||
PropertyValue pValue = avmService.getStoreProperty(store.getName(), propQName);
|
||||
|
||||
if (pValue != null)
|
||||
{
|
||||
NodeRef webProjectNodeRef = (NodeRef) pValue.getValue(DataTypeDefinition.NODE_REF);
|
||||
|
||||
// Apply sepcific user permissions as set on the web project
|
||||
List<ChildAssociationRef> userInfoRefs = nodeService.getChildAssocs(webProjectNodeRef, WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef ref : userInfoRefs)
|
||||
{
|
||||
NodeRef userInfoRef = ref.getChildRef();
|
||||
String username = (String) nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
|
||||
String userrole = (String) nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
|
||||
|
||||
if (userrole.equals("ContentManager"))
|
||||
{
|
||||
permissionService.setPermission(dirRef.getStoreRef(), username, PermissionService.CHANGE_PERMISSIONS, true);
|
||||
permissionService.setPermission(dirRef.getStoreRef(), username, PermissionService.READ_PERMISSIONS, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setSandBoxMasks(AVMStoreDescriptor sandBoxStore)
|
||||
@@ -195,6 +227,7 @@ public class WCMPermissionPatch extends AbstractPatch
|
||||
|
||||
NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, sandBoxStore.getName() + ":/www");
|
||||
|
||||
Map<QName, PropertyValue> woof = avmService.getStoreProperties(stagingAreaName);
|
||||
PropertyValue pValue = avmService.getStoreProperty(stagingAreaName, propQName);
|
||||
|
||||
permissionService.setPermission(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
|
||||
|
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* 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 java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.i18n.I18NUtil;
|
||||
import org.alfresco.repo.admin.patch.AbstractPatch;
|
||||
import org.alfresco.repo.domain.hibernate.AclDaoComponentImpl;
|
||||
import org.alfresco.repo.search.AVMSnapShotTriggeredIndexingMethodInterceptor;
|
||||
import org.alfresco.repo.search.impl.lucene.AVMLuceneIndexer;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
|
||||
|
||||
/**
|
||||
* Snap shot all stores after applying the staging are permissions patch
|
||||
*
|
||||
* @author andyh
|
||||
*/
|
||||
public class WCMPostPermissionSnapshotPatch extends AbstractPatch
|
||||
{
|
||||
private static final String MSG_SUCCESS = "patch.wcmPostPermissionSnapshotPatch.result";
|
||||
|
||||
AVMSnapShotTriggeredIndexingMethodInterceptor avmSnapShotTriggeredIndexingMethodInterceptor;
|
||||
|
||||
AVMService avmService;
|
||||
|
||||
AclDaoComponentImpl aclDaoComponent;
|
||||
|
||||
public void setAvmService(AVMService avmService)
|
||||
{
|
||||
this.avmService = avmService;
|
||||
}
|
||||
|
||||
public void setAvmSnapShotTriggeredIndexingMethodInterceptor(AVMSnapShotTriggeredIndexingMethodInterceptor avmSnapShotTriggeredIndexingMethodInterceptor)
|
||||
{
|
||||
this.avmSnapShotTriggeredIndexingMethodInterceptor = avmSnapShotTriggeredIndexingMethodInterceptor;
|
||||
}
|
||||
|
||||
public void setAclDaoComponent(AclDaoComponentImpl aclDaoComponent)
|
||||
{
|
||||
this.aclDaoComponent = aclDaoComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String applyInternal() throws Exception
|
||||
{
|
||||
List<AVMStoreDescriptor> stores = avmService.getStores();
|
||||
|
||||
Thread progressThread = null;
|
||||
|
||||
Long toDo = aclDaoComponent.getNewInStore();
|
||||
|
||||
List<AVMLuceneIndexer> indexers = new ArrayList<AVMLuceneIndexer>(stores.size());
|
||||
for (AVMStoreDescriptor storeDesc : stores)
|
||||
{
|
||||
AVMLuceneIndexer indexer = avmSnapShotTriggeredIndexingMethodInterceptor.getIndexer(storeDesc.getName());
|
||||
indexers.add(indexer);
|
||||
}
|
||||
|
||||
progressThread = new Thread(new ProgressWatcher(toDo, indexers), "WCMPactchProgressWatcher");
|
||||
progressThread.start();
|
||||
|
||||
for (AVMStoreDescriptor storeDesc : stores)
|
||||
{
|
||||
if (avmService.getStoreRoot(-1, storeDesc.getName()).getLayerID() == -1)
|
||||
{
|
||||
avmService.createSnapshot(storeDesc.getName(), "PermissionPatch", "Snapshot after 2.2 permission patch");
|
||||
AVMLuceneIndexer indexer = avmSnapShotTriggeredIndexingMethodInterceptor.getIndexer(storeDesc.getName());
|
||||
indexer.flushPending();
|
||||
}
|
||||
}
|
||||
|
||||
progressThread.interrupt();
|
||||
progressThread.join();
|
||||
|
||||
// build the result message
|
||||
String msg = I18NUtil.getMessage(MSG_SUCCESS);
|
||||
// done
|
||||
return msg;
|
||||
}
|
||||
|
||||
private class ProgressWatcher implements Runnable
|
||||
{
|
||||
private boolean running = true;
|
||||
|
||||
Long toDo;
|
||||
|
||||
List<AVMLuceneIndexer> indexers;
|
||||
|
||||
ProgressWatcher(Long toDo, List<AVMLuceneIndexer> indexers)
|
||||
{
|
||||
this.toDo = toDo;
|
||||
this.indexers = indexers;
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
while (running)
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.sleep(60000);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
running = false;
|
||||
}
|
||||
|
||||
if (running)
|
||||
{
|
||||
long done = 0;
|
||||
for(AVMLuceneIndexer indexer : indexers)
|
||||
{
|
||||
if(indexer != null)
|
||||
{
|
||||
done += indexer.getIndexedDocCount();
|
||||
}
|
||||
}
|
||||
|
||||
reportProgress(toDo, done);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user