RM: Fallout from previous model security service changes

* we don't need to evaluate the capabilites, just need to know if the user 'has' the capability
  * added ebable/disable 
  * disabled for now since code refactor is complete, but we need to think some more about what (and why) some properties and aspects are protected



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@44230 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2012-12-03 08:10:21 +00:00
parent e7f1b2e62c
commit aaab4b2c9e
6 changed files with 181 additions and 84 deletions

View File

@@ -23,7 +23,9 @@ import junit.framework.TestSuite;
import org.alfresco.module.org_alfresco_module_rm.test.service.DataSetServiceImplTest;
import org.alfresco.module.org_alfresco_module_rm.test.service.DispositionServiceImplTest;
import org.alfresco.module.org_alfresco_module_rm.test.service.ExtendedSecurityServiceImplTest;
import org.alfresco.module.org_alfresco_module_rm.test.service.FreezeServiceImplTest;
import org.alfresco.module.org_alfresco_module_rm.test.service.ModelSecurityServiceImplTest;
import org.alfresco.module.org_alfresco_module_rm.test.service.RecordServiceImplTest;
import org.alfresco.module.org_alfresco_module_rm.test.service.RecordsManagementActionServiceImplTest;
import org.alfresco.module.org_alfresco_module_rm.test.service.RecordsManagementAdminServiceImplTest;
@@ -48,6 +50,8 @@ public class ServicesTestSuite extends TestSuite
public static Test suite()
{
TestSuite suite = new TestSuite();
suite.addTestSuite(ExtendedSecurityServiceImplTest.class);
suite.addTestSuite(ModelSecurityServiceImplTest.class);
suite.addTestSuite(RecordsManagementServiceImplTest.class);
suite.addTestSuite(DispositionServiceImplTest.class);
suite.addTestSuite(RecordsManagementActionServiceImplTest.class);

View File

@@ -43,7 +43,9 @@ public class ModelSecurityServiceImplTest extends BaseRMTestCase
/** Model security service */
private ModelSecurityService modelSecurityService;
private ModelSecurityService modelSecurityService;
private boolean enabled;
/**
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest()
@@ -76,7 +78,20 @@ public class ModelSecurityServiceImplTest extends BaseRMTestCase
@Override
protected void setupTestDataImpl()
{
super.setupTestDataImpl();
super.setupTestDataImpl();
enabled = modelSecurityService.isEnabled();
modelSecurityService.setEnabled(true);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#tearDownImpl()
*/
@Override
protected void tearDownImpl()
{
super.tearDownImpl();
modelSecurityService.setEnabled(enabled);
}
/**
@@ -194,27 +209,27 @@ public class ModelSecurityServiceImplTest extends BaseRMTestCase
protectedProperty = modelSecurityService.getProtectedProperty(CUSTOM_PROTECTED_PROPERTY);
assertNotNull(protectedProperty);
assertNotNull(protectedProperty.getQName());
assertNotNull(protectedProperty.getCapabilities());
doTestInTransaction(new VoidTest()
{
@Override
public void runImpl() throws Exception
{
assertTrue(modelSecurityService.canEditProtectedProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY));
}
}, rmAdminName);
doTestInTransaction(new VoidTest()
{
@Override
public void runImpl() throws Exception
{
assertFalse(modelSecurityService.canEditProtectedProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY));
}
}, powerUserName);
assertNotNull(protectedProperty.getCapabilities());
}
});
});
doTestInTransaction(new VoidTest()
{
@Override
public void runImpl() throws Exception
{
assertTrue(modelSecurityService.canEditProtectedProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY));
}
}, rmAdminName);
doTestInTransaction(new VoidTest()
{
@Override
public void runImpl() throws Exception
{
assertFalse(modelSecurityService.canEditProtectedProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY));
}
}, powerUserName);
doTestInTransaction(new VoidTest()
{