richer acl event

This commit is contained in:
Benjamin Gamard 2018-04-02 11:09:21 +02:00
parent 1b3a33104a
commit f9b61546ab
4 changed files with 14 additions and 10 deletions

View File

@ -29,8 +29,7 @@ public class AclCreatedAsyncListener {
log.info("ACL created event: " + event.toString());
}
TransactionUtil.handle(() -> {
AppContext.getInstance().getIndexingHandler().createAcl(event.getSourceId());
});
TransactionUtil.handle(() -> AppContext.getInstance().getIndexingHandler()
.createAcl(event.getSourceId(), event.getPerm(), event.getTargetId()));
}
}

View File

@ -29,8 +29,7 @@ public class AclDeletedAsyncListener {
log.info("ACL deleted event: " + event.toString());
}
TransactionUtil.handle(() -> {
AppContext.getInstance().getIndexingHandler().deleteAcl(event.getSourceId());
});
TransactionUtil.handle(() -> AppContext.getInstance().getIndexingHandler()
.deleteAcl(event.getSourceId(), event.getPerm(), event.getTargetId()));
}
}

View File

@ -1,5 +1,6 @@
package com.sismics.docs.core.util.indexing;
import com.sismics.docs.core.constant.PermType;
import com.sismics.docs.core.dao.criteria.DocumentCriteria;
import com.sismics.docs.core.dao.dto.DocumentDto;
import com.sismics.docs.core.model.jpa.Document;
@ -74,15 +75,19 @@ public interface IndexingHandler {
* Create an ACL.
*
* @param sourceId Source ID
* @param perm Permission type
* @param targetId Target ID
*/
void createAcl(String sourceId);
void createAcl(String sourceId, PermType perm, String targetId);
/**
* Delete an ACL.
*
* @param sourceId Source ID
* @param perm Permission type
* @param targetId Target ID
*/
void deleteAcl(String sourceId);
void deleteAcl(String sourceId, PermType perm, String targetId);
/**
* Searches documents by criteria.

View File

@ -4,6 +4,7 @@ import com.google.common.base.Joiner;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.sismics.docs.core.constant.ConfigType;
import com.sismics.docs.core.constant.PermType;
import com.sismics.docs.core.dao.ConfigDao;
import com.sismics.docs.core.dao.criteria.DocumentCriteria;
import com.sismics.docs.core.dao.dto.DocumentDto;
@ -169,12 +170,12 @@ public class LuceneIndexingHandler implements IndexingHandler {
}
@Override
public void createAcl(String sourceId) {
public void createAcl(String sourceId, PermType perm, String targetId) {
// Lucene does not index ACLs
}
@Override
public void deleteAcl(String sourceId) {
public void deleteAcl(String sourceId, PermType perm, String targetId) {
// Lucene does not index ACLs
}