mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
SAIL-373 (SAIL-294): Fix ACL update entity - fix PersonTest.testCreateMissingPeople after r20931 (which enabled the shared ACL entity cache)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@20979 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -35,6 +35,7 @@ import org.alfresco.repo.domain.avm.AVMStoreDAO;
|
|||||||
import org.alfresco.repo.domain.patch.PatchDAO;
|
import org.alfresco.repo.domain.patch.PatchDAO;
|
||||||
import org.alfresco.repo.domain.permissions.AclCrudDAO;
|
import org.alfresco.repo.domain.permissions.AclCrudDAO;
|
||||||
import org.alfresco.repo.domain.permissions.AclEntity;
|
import org.alfresco.repo.domain.permissions.AclEntity;
|
||||||
|
import org.alfresco.repo.domain.permissions.AclUpdateEntity;
|
||||||
import org.alfresco.repo.domain.permissions.Authority;
|
import org.alfresco.repo.domain.permissions.Authority;
|
||||||
import org.alfresco.repo.domain.permissions.Permission;
|
import org.alfresco.repo.domain.permissions.Permission;
|
||||||
import org.alfresco.repo.search.AVMSnapShotTriggeredIndexingMethodInterceptor.StoreType;
|
import org.alfresco.repo.search.AVMSnapShotTriggeredIndexingMethodInterceptor.StoreType;
|
||||||
@@ -1058,14 +1059,14 @@ public class ResetWCMToGroupBasedPermissionsPatch extends MoveWCMToGroupBasedPer
|
|||||||
|
|
||||||
private void updateAclInheritsFrom(final long aclId, final long inheritsFromId) throws Exception
|
private void updateAclInheritsFrom(final long aclId, final long inheritsFromId) throws Exception
|
||||||
{
|
{
|
||||||
AclEntity aclEntity = aclCrudDAO.getAclForUpdate(aclId);
|
AclUpdateEntity aclEntity = aclCrudDAO.getAclForUpdate(aclId);
|
||||||
aclEntity.setInheritsFrom(inheritsFromId);
|
aclEntity.setInheritsFrom(inheritsFromId);
|
||||||
aclCrudDAO.updateAcl(aclEntity);
|
aclCrudDAO.updateAcl(aclEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateAclInherited(final long aclId, final long inheritedAclId) throws Exception
|
private void updateAclInherited(final long aclId, final long inheritedAclId) throws Exception
|
||||||
{
|
{
|
||||||
AclEntity aclEntity = aclCrudDAO.getAclForUpdate(aclId);
|
AclUpdateEntity aclEntity = aclCrudDAO.getAclForUpdate(aclId);
|
||||||
aclEntity.setInheritedAcl(inheritedAclId);
|
aclEntity.setInheritedAcl(inheritedAclId);
|
||||||
aclCrudDAO.updateAcl(aclEntity);
|
aclCrudDAO.updateAcl(aclEntity);
|
||||||
}
|
}
|
||||||
|
@@ -206,7 +206,7 @@ public abstract class AbstractAclCrudDAOImpl implements AclCrudDAO
|
|||||||
return entityPair.getSecond();
|
return entityPair.getSecond();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AclEntity getAclForUpdate(long id)
|
public AclUpdateEntity getAclForUpdate(long id)
|
||||||
{
|
{
|
||||||
AclEntity acl = getAclImpl(id);
|
AclEntity acl = getAclImpl(id);
|
||||||
if (acl == null)
|
if (acl == null)
|
||||||
@@ -215,7 +215,7 @@ public abstract class AbstractAclCrudDAOImpl implements AclCrudDAO
|
|||||||
}
|
}
|
||||||
|
|
||||||
// copy for update
|
// copy for update
|
||||||
AclEntity aclEntity = new AclEntity();
|
AclUpdateEntity aclEntity = new AclUpdateEntity();
|
||||||
aclEntity.setId(acl.getId());
|
aclEntity.setId(acl.getId());
|
||||||
aclEntity.setVersion(acl.getVersion());
|
aclEntity.setVersion(acl.getVersion());
|
||||||
aclEntity.setAclChangeSetId(acl.getAclChangeSetId());
|
aclEntity.setAclChangeSetId(acl.getAclChangeSetId());
|
||||||
@@ -254,7 +254,7 @@ public abstract class AbstractAclCrudDAOImpl implements AclCrudDAO
|
|||||||
return getAVMNodeEntityIdsByAcl(aclEntityId, maxResults);
|
return getAVMNodeEntityIdsByAcl(aclEntityId, maxResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateAcl(AclEntity entity)
|
public void updateAcl(AclUpdateEntity entity)
|
||||||
{
|
{
|
||||||
ParameterCheck.mandatory("entity", entity);
|
ParameterCheck.mandatory("entity", entity);
|
||||||
ParameterCheck.mandatory("entity.id", entity.getId());
|
ParameterCheck.mandatory("entity.id", entity.getId());
|
||||||
|
@@ -57,10 +57,10 @@ public interface AclCrudDAO
|
|||||||
|
|
||||||
public Acl createAcl(AclEntity entity);
|
public Acl createAcl(AclEntity entity);
|
||||||
public Acl getAcl(long aclEntityId);
|
public Acl getAcl(long aclEntityId);
|
||||||
public AclEntity getAclForUpdate(long aclEntityId);
|
public AclUpdateEntity getAclForUpdate(long aclEntityId);
|
||||||
public List<Long> getAclsThatInheritFromAcl(long aclEntityId);
|
public List<Long> getAclsThatInheritFromAcl(long aclEntityId);
|
||||||
public Long getLatestAclByGuid(String aclGuid);
|
public Long getLatestAclByGuid(String aclGuid);
|
||||||
public void updateAcl(AclEntity entity);
|
public void updateAcl(AclUpdateEntity entity);
|
||||||
public void deleteAcl(long aclEntityId);
|
public void deleteAcl(long aclEntityId);
|
||||||
public List<Long> getADMNodesByAcl(long aclEntityId, int maxResults);
|
public List<Long> getADMNodesByAcl(long aclEntityId, int maxResults);
|
||||||
public List<Long> getAVMNodesByAcl(long aclEntityId, int maxResults);
|
public List<Long> getAVMNodesByAcl(long aclEntityId, int maxResults);
|
||||||
|
@@ -423,7 +423,7 @@ public class AclDAOImpl implements AclDAO
|
|||||||
private AclChange getWritable(final Long id, final Long parent, List<? extends AccessControlEntry> exclude, List<Ace> acesToAdd, Long inheritsFrom,
|
private AclChange getWritable(final Long id, final Long parent, List<? extends AccessControlEntry> exclude, List<Ace> acesToAdd, Long inheritsFrom,
|
||||||
List<Ace> inherited, List<Integer> positions, int depth, WriteMode mode, boolean requiresVersion)
|
List<Ace> inherited, List<Integer> positions, int depth, WriteMode mode, boolean requiresVersion)
|
||||||
{
|
{
|
||||||
AclEntity acl = (AclEntity)aclCrudDAO.getAcl(id);
|
AclUpdateEntity acl = aclCrudDAO.getAclForUpdate(id);
|
||||||
if (!acl.isLatest())
|
if (!acl.isLatest())
|
||||||
{
|
{
|
||||||
aclCache.remove(id);
|
aclCache.remove(id);
|
||||||
@@ -590,7 +590,7 @@ public class AclDAOImpl implements AclDAO
|
|||||||
if (parent != null)
|
if (parent != null)
|
||||||
{
|
{
|
||||||
Long writableParentAcl = getWritable(parent, null, null, null, null, null, null, 0, WriteMode.COPY_ONLY, false).getAfter();
|
Long writableParentAcl = getWritable(parent, null, null, null, null, null, null, 0, WriteMode.COPY_ONLY, false).getAfter();
|
||||||
AclEntity parentAcl = aclCrudDAO.getAclForUpdate(writableParentAcl);
|
AclUpdateEntity parentAcl = aclCrudDAO.getAclForUpdate(writableParentAcl);
|
||||||
parentAcl.setInheritedAcl(created);
|
parentAcl.setInheritedAcl(created);
|
||||||
aclCrudDAO.updateAcl(parentAcl);
|
aclCrudDAO.updateAcl(parentAcl);
|
||||||
}
|
}
|
||||||
@@ -851,7 +851,7 @@ public class AclDAOImpl implements AclDAO
|
|||||||
|
|
||||||
List<AclChange> acls = new ArrayList<AclChange>();
|
List<AclChange> acls = new ArrayList<AclChange>();
|
||||||
|
|
||||||
final AclEntity acl = aclCrudDAO.getAclForUpdate(id);
|
final AclUpdateEntity acl = aclCrudDAO.getAclForUpdate(id);
|
||||||
if (!acl.isLatest())
|
if (!acl.isLatest())
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Old ACL versions can not be updated");
|
throw new UnsupportedOperationException("Old ACL versions can not be updated");
|
||||||
@@ -894,7 +894,7 @@ public class AclDAOImpl implements AclDAO
|
|||||||
|
|
||||||
if (inherited.isVersioned())
|
if (inherited.isVersioned())
|
||||||
{
|
{
|
||||||
AclEntity inheritedForUpdate = aclCrudDAO.getAclForUpdate(inherited.getId());
|
AclUpdateEntity inheritedForUpdate = aclCrudDAO.getAclForUpdate(inherited.getId());
|
||||||
if (inheritedForUpdate != null)
|
if (inheritedForUpdate != null)
|
||||||
{
|
{
|
||||||
inheritedForUpdate.setLatest(Boolean.FALSE);
|
inheritedForUpdate.setLatest(Boolean.FALSE);
|
||||||
@@ -1075,7 +1075,7 @@ public class AclDAOImpl implements AclDAO
|
|||||||
*/
|
*/
|
||||||
public Long getInheritedAccessControlList(Long id)
|
public Long getInheritedAccessControlList(Long id)
|
||||||
{
|
{
|
||||||
AclEntity acl = aclCrudDAO.getAclForUpdate(id);
|
AclUpdateEntity acl = aclCrudDAO.getAclForUpdate(id);
|
||||||
if (acl.getAclType() == ACLType.OLD)
|
if (acl.getAclType() == ACLType.OLD)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@@ -1260,7 +1260,7 @@ public class AclDAOImpl implements AclDAO
|
|||||||
{
|
{
|
||||||
List<AclChange> changes = new ArrayList<AclChange>();
|
List<AclChange> changes = new ArrayList<AclChange>();
|
||||||
|
|
||||||
AclEntity acl = aclCrudDAO.getAclForUpdate(id);
|
AclUpdateEntity acl = aclCrudDAO.getAclForUpdate(id);
|
||||||
|
|
||||||
switch (acl.getAclType())
|
switch (acl.getAclType())
|
||||||
{
|
{
|
||||||
@@ -1305,7 +1305,7 @@ public class AclDAOImpl implements AclDAO
|
|||||||
*/
|
*/
|
||||||
public List<AclChange> disableInheritance(Long id, boolean setInheritedOnAcl)
|
public List<AclChange> disableInheritance(Long id, boolean setInheritedOnAcl)
|
||||||
{
|
{
|
||||||
AclEntity acl = aclCrudDAO.getAclForUpdate(id);
|
AclUpdateEntity acl = aclCrudDAO.getAclForUpdate(id);
|
||||||
List<AclChange> changes = new ArrayList<AclChange>(1);
|
List<AclChange> changes = new ArrayList<AclChange>(1);
|
||||||
switch (acl.getAclType())
|
switch (acl.getAclType())
|
||||||
{
|
{
|
||||||
@@ -1330,7 +1330,7 @@ public class AclDAOImpl implements AclDAO
|
|||||||
|
|
||||||
private Long getCopy(Long toCopy, Long toInheritFrom, ACLCopyMode mode)
|
private Long getCopy(Long toCopy, Long toInheritFrom, ACLCopyMode mode)
|
||||||
{
|
{
|
||||||
AclEntity aclToCopy;
|
AclUpdateEntity aclToCopy;
|
||||||
Long inheritedId;
|
Long inheritedId;
|
||||||
Acl aclToInheritFrom;
|
Acl aclToInheritFrom;
|
||||||
switch (mode)
|
switch (mode)
|
||||||
@@ -1352,7 +1352,7 @@ public class AclDAOImpl implements AclDAO
|
|||||||
inheritedId = getInheritedAccessControlList(toCopy);
|
inheritedId = getInheritedAccessControlList(toCopy);
|
||||||
if ((inheritedId != null) && (!inheritedId.equals(toCopy)))
|
if ((inheritedId != null) && (!inheritedId.equals(toCopy)))
|
||||||
{
|
{
|
||||||
AclEntity inheritedAcl = aclCrudDAO.getAclForUpdate(inheritedId);
|
AclUpdateEntity inheritedAcl = aclCrudDAO.getAclForUpdate(inheritedId);
|
||||||
inheritedAcl.setRequiresVersion(true);
|
inheritedAcl.setRequiresVersion(true);
|
||||||
aclCrudDAO.updateAcl(inheritedAcl);
|
aclCrudDAO.updateAcl(inheritedAcl);
|
||||||
aclCache.remove(inheritedId);
|
aclCache.remove(inheritedId);
|
||||||
@@ -1502,18 +1502,18 @@ public class AclDAOImpl implements AclDAO
|
|||||||
return acl;
|
return acl;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<AclChange> disableInheritanceImpl(Long id, boolean setInheritedOnAcl, AclEntity acl)
|
private List<AclChange> disableInheritanceImpl(Long id, boolean setInheritedOnAcl, AclEntity aclIn)
|
||||||
{
|
{
|
||||||
List<AclChange> changes = new ArrayList<AclChange>();
|
List<AclChange> changes = new ArrayList<AclChange>();
|
||||||
|
|
||||||
if (!acl.getInherits())
|
if (!aclIn.getInherits())
|
||||||
{
|
{
|
||||||
return Collections.<AclChange> emptyList();
|
return Collections.<AclChange> emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Manages caching
|
// Manages caching
|
||||||
getWritable(id, null, null, null, null, false, changes, WriteMode.COPY_ONLY);
|
getWritable(id, null, null, null, null, false, changes, WriteMode.COPY_ONLY);
|
||||||
acl = aclCrudDAO.getAclForUpdate(changes.get(0).getAfter());
|
AclUpdateEntity acl = aclCrudDAO.getAclForUpdate(changes.get(0).getAfter());
|
||||||
final Long inheritsFrom = acl.getInheritsFrom();
|
final Long inheritsFrom = acl.getInheritsFrom();
|
||||||
acl.setInherits(Boolean.FALSE);
|
acl.setInherits(Boolean.FALSE);
|
||||||
aclCrudDAO.updateAcl(acl);
|
aclCrudDAO.updateAcl(acl);
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2010 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.domain.permissions;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entity for <b>alf_acess_control_list</b> persistence.
|
||||||
|
*
|
||||||
|
* @author janv
|
||||||
|
* @since 3.4
|
||||||
|
*/
|
||||||
|
public class AclUpdateEntity extends AclEntity
|
||||||
|
{
|
||||||
|
}
|
Reference in New Issue
Block a user