Search in sources :

Example 1 with AclObjectIdentity

use of gemma.gsec.acl.domain.AclObjectIdentity in project Gemma by PavlidisLab.

the class AclAdviceTest method testExpressionExperimentAcls.

/*
     * Test of EE ACLs and also SecurityNotInherited on EE set.
     */
@Test
public void testExpressionExperimentAcls() {
    ExpressionExperiment ee = this.getTestPersistentCompleteExpressionExperiment(false);
    aclTestUtils.checkEEAcls(ee);
    /*
         * Make public, and then add a factor and factorvalue.
         */
    securityService.makePublic(ee);
    ExperimentalFactor ef = ExperimentalFactor.Factory.newInstance();
    VocabCharacteristic cat = VocabCharacteristic.Factory.newInstance();
    cat.setCategory("foo");
    cat.setCategoryUri("bar");
    ef.setName("TESTING ACLS");
    ef.setCategory(cat);
    ef.setType(FactorType.CATEGORICAL);
    ef = expressionExperimentService.addFactor(ee, ef);
    FactorValue fv = FactorValue.Factory.newInstance(ef);
    fv.setValue("ack");
    fv = FactorValue.Factory.newInstance(ef);
    fv.setValue("adddck");
    expressionExperimentService.addFactorValue(ee, fv);
    securityService.makePrivate(ee);
    aclTestUtils.checkEEAcls(ee);
    /*
         * Now associate with ee set, remove the set and then the ee, make sure things are done correctly!
         */
    ExpressionExperimentSet ees = ExpressionExperimentSet.Factory.newInstance();
    ees.getExperiments().add(ee);
    ees.setName(this.randomName());
    persisterHelper.persist(ees);
    // make sure the ACL for objects are there (throws an exception if not).
    Acl eeacl = aclService.readAclById(new AclObjectIdentity(ee));
    aclService.readAclById(new AclObjectIdentity(ees));
    assertNull(eeacl.getParentAcl());
    expressionExperimentSetService.remove(ees);
    // make sure ACL for ees is gone
    aclTestUtils.checkDeletedAcl(ees);
    // make sure the ACL for ee is still there
    aclTestUtils.checkHasAcl(ee);
    expressionExperimentService.remove(ee);
    aclTestUtils.checkDeleteEEAcls(ee);
}
Also used : VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic) ExpressionExperimentSet(ubic.gemma.model.analysis.expression.ExpressionExperimentSet) Acl(org.springframework.security.acls.model.Acl) AclObjectIdentity(gemma.gsec.acl.domain.AclObjectIdentity) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest) Test(org.junit.Test)

Example 2 with AclObjectIdentity

use of gemma.gsec.acl.domain.AclObjectIdentity in project Gemma by PavlidisLab.

the class AclTestUtils method checkHasAcl.

public void checkHasAcl(Object f) {
    try {
        aclService.readAclById(new AclObjectIdentity(f));
        AclTestUtils.log.debug("Have acl for " + f);
    } catch (NotFoundException okaye) {
        fail("Failed to create ACL for " + f);
    }
}
Also used : NotFoundException(org.springframework.security.acls.model.NotFoundException) AclObjectIdentity(gemma.gsec.acl.domain.AclObjectIdentity)

Example 3 with AclObjectIdentity

use of gemma.gsec.acl.domain.AclObjectIdentity in project Gemma by PavlidisLab.

the class AclTestUtils method checkLacksAcl.

public void checkLacksAcl(Object f) {
    try {
        aclService.readAclById(new AclObjectIdentity(f));
        fail("Should not have found an ACL");
    } catch (NotFoundException okaye) {
    // good
    }
}
Also used : NotFoundException(org.springframework.security.acls.model.NotFoundException) AclObjectIdentity(gemma.gsec.acl.domain.AclObjectIdentity)

Aggregations

AclObjectIdentity (gemma.gsec.acl.domain.AclObjectIdentity)3 NotFoundException (org.springframework.security.acls.model.NotFoundException)2 Test (org.junit.Test)1 Acl (org.springframework.security.acls.model.Acl)1 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)1 ExpressionExperimentSet (ubic.gemma.model.analysis.expression.ExpressionExperimentSet)1 VocabCharacteristic (ubic.gemma.model.common.description.VocabCharacteristic)1