mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-16 17:55:15 +00:00
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10423 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
86 lines
4.2 KiB
Java
86 lines
4.2 KiB
Java
/*
|
|
* 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.avm;
|
|
|
|
import org.alfresco.config.JNDIConstants;
|
|
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
|
import org.alfresco.service.cmr.repository.NodeRef;
|
|
|
|
public class WCMInheritPermissionsTest extends AbstractSpringContextTest
|
|
{
|
|
private static final String FILE_NAME = "fileForExport";
|
|
private static final String STORE_NAME = "TestStore1";
|
|
private static final String ROOT = "ROOT";
|
|
|
|
private void createStaggingWithSnapshots(String storeName)
|
|
{
|
|
if (avmService.getStore(storeName) != null)
|
|
{
|
|
avmService.purgeStore(storeName);
|
|
}
|
|
|
|
avmService.createStore(storeName);
|
|
assertNotNull(avmService.getStore(storeName));
|
|
|
|
avmService.createDirectory(storeName + ":/", JNDIConstants.DIR_DEFAULT_WWW);
|
|
avmService.createSnapshot(storeName, "first", "first");
|
|
assertNotNull(avmService.lookup(-1, storeName + ":/" + JNDIConstants.DIR_DEFAULT_WWW));
|
|
avmService.createDirectory(storeName + ":/" + JNDIConstants.DIR_DEFAULT_WWW, JNDIConstants.DIR_DEFAULT_APPBASE);
|
|
avmService.createSnapshot(storeName, "second", "second");
|
|
assertNotNull(avmService.lookup(-1, storeName + ":/" + JNDIConstants.DIR_DEFAULT_WWW + "/" + JNDIConstants.DIR_DEFAULT_APPBASE));
|
|
avmService.createDirectory(storeName + ":/" + JNDIConstants.DIR_DEFAULT_WWW + "/" + JNDIConstants.DIR_DEFAULT_APPBASE, ROOT);
|
|
avmService.createSnapshot(storeName, "third", "third");
|
|
assertNotNull(avmService.lookup(-1, storeName + ":/" + JNDIConstants.DIR_DEFAULT_WWW + "/" + JNDIConstants.DIR_DEFAULT_APPBASE + "/" + ROOT));
|
|
avmService.createFile(storeName + ":/" + JNDIConstants.DIR_DEFAULT_WWW + "/" + JNDIConstants.DIR_DEFAULT_APPBASE + "/" + ROOT, FILE_NAME);
|
|
avmService.createSnapshot(storeName, "fourth", "fourth");
|
|
assertNotNull(avmService.lookup(-1, storeName + ":/" + JNDIConstants.DIR_DEFAULT_WWW + "/" + JNDIConstants.DIR_DEFAULT_APPBASE + "/" + ROOT + "/" + FILE_NAME));
|
|
|
|
}
|
|
|
|
private void removeStore(String storeName)
|
|
{
|
|
avmService.purgeStore(storeName);
|
|
assertNull(avmService.getStore(storeName));
|
|
}
|
|
|
|
public void testSetInheritParentPermissions()
|
|
{
|
|
createStaggingWithSnapshots(STORE_NAME);
|
|
|
|
AVMNodeDescriptor nodeDescriptor = avmService.lookup(-1, STORE_NAME + ":/" + JNDIConstants.DIR_DEFAULT_WWW + "/" + JNDIConstants.DIR_DEFAULT_APPBASE + "/" + ROOT + "/"
|
|
+ FILE_NAME);
|
|
assertNotNull(nodeDescriptor);
|
|
NodeRef nodeRef = AVMNodeConverter.ToNodeRef(-1, nodeDescriptor.getPath());
|
|
assertNotNull(nodeRef);
|
|
|
|
permissionService.setInheritParentPermissions(nodeRef, false);
|
|
assertFalse(permissionService.getInheritParentPermissions(nodeRef));
|
|
permissionService.setInheritParentPermissions(nodeRef, true);
|
|
assertTrue(permissionService.getInheritParentPermissions(nodeRef));
|
|
|
|
removeStore(STORE_NAME);
|
|
}
|
|
}
|