richer acl event + upgrade json lib

This commit is contained in:
Benjamin Gamard 2018-04-02 10:47:43 +02:00
parent d819c05669
commit 1b3a33104a
5 changed files with 69 additions and 47 deletions

View File

@ -1,31 +1,9 @@
package com.sismics.docs.core.event;
import com.google.common.base.MoreObjects;
/**
* ACL created event.
*
* @author bgamard
*/
public class AclCreatedAsyncEvent extends UserEvent {
/**
* Source ID.
*/
private String sourceId;
public String getSourceId() {
return sourceId;
}
public AclCreatedAsyncEvent setSourceId(String sourceId) {
this.sourceId = sourceId;
return this;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("sourceId", sourceId)
.toString();
}
public class AclCreatedAsyncEvent extends AclEvent {
}

View File

@ -1,31 +1,9 @@
package com.sismics.docs.core.event;
import com.google.common.base.MoreObjects;
/**
* ACL deleted event.
*
* @author bgamard
*/
public class AclDeletedAsyncEvent extends UserEvent {
/**
* Source ID.
*/
private String sourceId;
public String getSourceId() {
return sourceId;
}
public AclDeletedAsyncEvent setSourceId(String sourceId) {
this.sourceId = sourceId;
return this;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("sourceId", sourceId)
.toString();
}
public class AclDeletedAsyncEvent extends AclEvent {
}

View File

@ -0,0 +1,62 @@
package com.sismics.docs.core.event;
import com.google.common.base.MoreObjects;
import com.sismics.docs.core.constant.PermType;
/**
* ACL event.
*
* @author bgamard
*/
public abstract class AclEvent extends UserEvent {
/**
* Source ID.
*/
private String sourceId;
/**
* Permission type.
*/
private PermType perm;
/**
* Target ID.
*/
private String targetId;
public String getSourceId() {
return sourceId;
}
public AclEvent setSourceId(String sourceId) {
this.sourceId = sourceId;
return this;
}
public PermType getPerm() {
return perm;
}
public AclEvent setPerm(PermType permType) {
this.perm = permType;
return this;
}
public String getTargetId() {
return targetId;
}
public AclEvent setTargetId(String targetId) {
this.targetId = targetId;
return this;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("sourceId", sourceId)
.add("perm", perm)
.add("targetId", targetId)
.toString();
}
}

View File

@ -104,6 +104,8 @@ public class AclResource extends BaseResource {
AclCreatedAsyncEvent event = new AclCreatedAsyncEvent();
event.setUserId(principal.getId());
event.setSourceId(sourceId);
event.setPerm(perm);
event.setTargetId(targetId);
ThreadLocalContext.get().addAsyncEvent(event);
// Returns the ACL
@ -181,6 +183,8 @@ public class AclResource extends BaseResource {
AclDeletedAsyncEvent event = new AclDeletedAsyncEvent();
event.setUserId(principal.getId());
event.setSourceId(sourceId);
event.setPerm(perm);
event.setTargetId(targetId);
ThreadLocalContext.get().addAsyncEvent(event);
// Always return OK

View File

@ -29,7 +29,7 @@
<junit.junit.version>4.12</junit.junit.version>
<com.h2database.h2.version>1.4.191</com.h2database.h2.version>
<org.glassfish.jersey.version>2.22.2</org.glassfish.jersey.version>
<org.glassfish.javax.json.version>1.0.4</org.glassfish.javax.json.version>
<org.glassfish.javax.json.version>1.1.2</org.glassfish.javax.json.version>
<org.mindrot.jbcrypt>0.3m</org.mindrot.jbcrypt>
<org.apache.lucene.version>5.5.0</org.apache.lucene.version>
<org.imgscalr.imgscalr-lib.version>4.2</org.imgscalr.imgscalr-lib.version>