Search in sources :

Example 1 with AclItem

use of org.opencastproject.message.broker.api.acl.AclItem in project opencast by opencast.

the class AclServiceImpl method updateAcl.

@Override
public boolean updateAcl(ManagedAcl acl) {
    Option<ManagedAcl> oldName = getAcl(acl.getId());
    boolean updateAcl = aclDb.updateAcl(acl);
    if (updateAcl) {
        if (oldName.isSome() && !(oldName.get().getName().equals(acl.getName()))) {
            AclItem aclItem = AclItem.update(oldName.get().getName(), acl.getName());
            messageSender.sendObjectMessage(AclItem.ACL_QUEUE, MessageSender.DestinationType.Queue, aclItem);
        }
    }
    return updateAcl;
}
Also used : AclItem(org.opencastproject.message.broker.api.acl.AclItem) ManagedAcl(org.opencastproject.authorization.xacml.manager.api.ManagedAcl)

Example 2 with AclItem

use of org.opencastproject.message.broker.api.acl.AclItem 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;
}
Also used : AclItem(org.opencastproject.message.broker.api.acl.AclItem) ManagedAcl(org.opencastproject.authorization.xacml.manager.api.ManagedAcl)

Example 3 with AclItem

use of org.opencastproject.message.broker.api.acl.AclItem in project opencast by opencast.

the class AclServiceImpl method deleteAcl.

@Override
public boolean deleteAcl(long id) throws AclServiceException, NotFoundException {
    final TransitionQuery query = TransitionQuery.query().withDone(false).withAclId(id);
    final TransitionResult result = persistence.getByQuery(organization, query);
    if (result.getEpisodeTransistions().size() > 0 || result.getSeriesTransistions().size() > 0)
        return false;
    Option<ManagedAcl> deletedAcl = getAcl(id);
    if (aclDb.deleteAcl(organization, id)) {
        if (deletedAcl.isSome()) {
            AclItem aclItem = AclItem.delete(deletedAcl.get().getName());
            messageSender.sendObjectMessage(AclItem.ACL_QUEUE, MessageSender.DestinationType.Queue, aclItem);
        }
        return true;
    }
    throw new NotFoundException("Managed acl with id " + id + " not found.");
}
Also used : AclItem(org.opencastproject.message.broker.api.acl.AclItem) TransitionQuery(org.opencastproject.authorization.xacml.manager.api.TransitionQuery) ManagedAcl(org.opencastproject.authorization.xacml.manager.api.ManagedAcl) NotFoundException(org.opencastproject.util.NotFoundException) TransitionResult(org.opencastproject.authorization.xacml.manager.api.TransitionResult)

Aggregations

ManagedAcl (org.opencastproject.authorization.xacml.manager.api.ManagedAcl)3 AclItem (org.opencastproject.message.broker.api.acl.AclItem)3 TransitionQuery (org.opencastproject.authorization.xacml.manager.api.TransitionQuery)1 TransitionResult (org.opencastproject.authorization.xacml.manager.api.TransitionResult)1 NotFoundException (org.opencastproject.util.NotFoundException)1