use of org.opencastproject.authorization.xacml.manager.api.ManagedAcl in project opencast by opencast.
the class OsgiJpaAclTransitionDbTest method testUpdateEpisode.
@Test
public void testUpdateEpisode() throws Exception {
final ManagedAcl macl = createAcl();
EpisodeACLTransition t1 = db.storeEpisodeAclTransition(ORG, "uuid", new Date(), some(macl.getId()), Option.<ConfiguredWorkflowRef>none());
EpisodeACLTransition u1 = db.updateEpisodeAclTransition(ORG, t1.getTransitionId(), t1.getApplicationDate(), none(0L), Option.some(workflow("full")));
assertEquals(t1.getTransitionId(), u1.getTransitionId());
assertEquals(t1.getEpisodeId(), u1.getEpisodeId());
assertEquals(t1.getOrganizationId(), u1.getOrganizationId());
assertTrue(u1.getAccessControlList().isNone());
assertNotSame(t1.isDelete(), u1.isDelete());
assertNotSame(t1.getWorkflow(), u1.getWorkflow());
try {
db.updateEpisodeAclTransition(ORG2, t1.getTransitionId(), t1.getApplicationDate(), some(macl.getId()), Option.some(workflow("full")));
fail("Updating from non-owner org should not be possible");
} catch (AclTransitionDbException ignore1) {
} catch (NotFoundException ignore2) {
}
}
use of org.opencastproject.authorization.xacml.manager.api.ManagedAcl in project opencast by opencast.
the class OsgiJpaAclTransitionDbTest method testUpdateSeries.
@Test
public void testUpdateSeries() throws Exception {
final ManagedAcl macl = createAcl();
SeriesACLTransition t1 = db.storeSeriesAclTransition(ORG, "uuid", new Date(), macl.getId(), true, Option.<ConfiguredWorkflowRef>none());
SeriesACLTransition u1 = db.updateSeriesAclTransition(ORG, t1.getTransitionId(), t1.getApplicationDate(), macl.getId(), false, Option.some(workflow("full")));
assertEquals(t1.getTransitionId(), u1.getTransitionId());
assertEquals(t1.getSeriesId(), u1.getSeriesId());
assertEquals(t1.getOrganizationId(), u1.getOrganizationId());
assertEquals(t1.getAccessControlList().getId(), u1.getAccessControlList().getId());
assertNotSame(t1.getWorkflow(), u1.getWorkflow());
assertNotSame(t1.isOverride(), u1.isOverride());
try {
db.updateSeriesAclTransition(ORG2, t1.getTransitionId(), t1.getApplicationDate(), macl.getId(), false, Option.some(workflow("full")));
fail("Updating from non-owner org should not be possible");
} catch (AclTransitionDbException ignore1) {
} catch (NotFoundException ignore2) {
}
}
use of org.opencastproject.authorization.xacml.manager.api.ManagedAcl in project opencast by opencast.
the class OsgiJpaAclTransitionDbTest method testGetSeriesTransitions.
@Test
public void testGetSeriesTransitions() throws Exception {
final ManagedAcl macl = createAcl();
db.storeSeriesAclTransition(ORG, "uuid", new Date(), macl.getId(), true, Option.<ConfiguredWorkflowRef>none());
db.storeSeriesAclTransition(ORG, "uuid", new Date(), macl.getId(), false, Option.<ConfiguredWorkflowRef>none());
// there should now be two transitions for series "uuid"
List<SeriesACLTransition> series = db.getSeriesAclTransitions(ORG, "uuid");
assertEquals(2, series.size());
// transitions shouldn't be accessible from another organization
assertEquals(0, db.getSeriesAclTransitions(ORG2, "uuid").size());
}
use of org.opencastproject.authorization.xacml.manager.api.ManagedAcl in project opencast by opencast.
the class OsgiJpaAclTransitionDbTest method testDeleteEpisode.
@Test
public void testDeleteEpisode() throws Exception {
final ManagedAcl macl = createAcl();
EpisodeACLTransition t1 = db.storeEpisodeAclTransition(ORG, "uuid", new Date(), some(macl.getId()), Option.<ConfiguredWorkflowRef>none());
// try deletion from different org
try {
db.deleteEpisodeAclTransition(ORG2, t1.getTransitionId());
fail("Deleting from non-owner org should not be possible");
} catch (NotFoundException ignore) {
}
db.deleteEpisodeAclTransition(ORG, t1.getTransitionId());
try {
db.deleteEpisodeAclTransition(ORG, t1.getTransitionId());
fail("Deleting a non existing transition should throw an exception");
} catch (NotFoundException ignore) {
}
}
use of org.opencastproject.authorization.xacml.manager.api.ManagedAcl in project opencast by opencast.
the class AclServiceImpl method createAcl.
@Override
public Option<ManagedAcl> createAcl(AccessControlList acl, String name) {
Option<ManagedAcl> createAcl = aclDb.createAcl(organization, acl, name);
if (createAcl.isSome()) {
AclItem aclItem = AclItem.create(createAcl.get().getName());
messageSender.sendObjectMessage(AclItem.ACL_QUEUE, MessageSender.DestinationType.Queue, aclItem);
}
return createAcl;
}
Aggregations