mirror of
https://github.com/sismics/docs.git
synced 2024-11-25 07:07:57 +01:00
richer acl event + upgrade json lib
This commit is contained in:
parent
d819c05669
commit
1b3a33104a
@ -1,31 +1,9 @@
|
|||||||
package com.sismics.docs.core.event;
|
package com.sismics.docs.core.event;
|
||||||
|
|
||||||
import com.google.common.base.MoreObjects;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ACL created event.
|
* ACL created event.
|
||||||
*
|
*
|
||||||
* @author bgamard
|
* @author bgamard
|
||||||
*/
|
*/
|
||||||
public class AclCreatedAsyncEvent extends UserEvent {
|
public class AclCreatedAsyncEvent extends AclEvent {
|
||||||
/**
|
|
||||||
* 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();
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,31 +1,9 @@
|
|||||||
package com.sismics.docs.core.event;
|
package com.sismics.docs.core.event;
|
||||||
|
|
||||||
import com.google.common.base.MoreObjects;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ACL deleted event.
|
* ACL deleted event.
|
||||||
*
|
*
|
||||||
* @author bgamard
|
* @author bgamard
|
||||||
*/
|
*/
|
||||||
public class AclDeletedAsyncEvent extends UserEvent {
|
public class AclDeletedAsyncEvent extends AclEvent {
|
||||||
/**
|
|
||||||
* 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();
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
@ -104,6 +104,8 @@ public class AclResource extends BaseResource {
|
|||||||
AclCreatedAsyncEvent event = new AclCreatedAsyncEvent();
|
AclCreatedAsyncEvent event = new AclCreatedAsyncEvent();
|
||||||
event.setUserId(principal.getId());
|
event.setUserId(principal.getId());
|
||||||
event.setSourceId(sourceId);
|
event.setSourceId(sourceId);
|
||||||
|
event.setPerm(perm);
|
||||||
|
event.setTargetId(targetId);
|
||||||
ThreadLocalContext.get().addAsyncEvent(event);
|
ThreadLocalContext.get().addAsyncEvent(event);
|
||||||
|
|
||||||
// Returns the ACL
|
// Returns the ACL
|
||||||
@ -181,6 +183,8 @@ public class AclResource extends BaseResource {
|
|||||||
AclDeletedAsyncEvent event = new AclDeletedAsyncEvent();
|
AclDeletedAsyncEvent event = new AclDeletedAsyncEvent();
|
||||||
event.setUserId(principal.getId());
|
event.setUserId(principal.getId());
|
||||||
event.setSourceId(sourceId);
|
event.setSourceId(sourceId);
|
||||||
|
event.setPerm(perm);
|
||||||
|
event.setTargetId(targetId);
|
||||||
ThreadLocalContext.get().addAsyncEvent(event);
|
ThreadLocalContext.get().addAsyncEvent(event);
|
||||||
|
|
||||||
// Always return OK
|
// Always return OK
|
||||||
|
2
pom.xml
2
pom.xml
@ -29,7 +29,7 @@
|
|||||||
<junit.junit.version>4.12</junit.junit.version>
|
<junit.junit.version>4.12</junit.junit.version>
|
||||||
<com.h2database.h2.version>1.4.191</com.h2database.h2.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.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.mindrot.jbcrypt>0.3m</org.mindrot.jbcrypt>
|
||||||
<org.apache.lucene.version>5.5.0</org.apache.lucene.version>
|
<org.apache.lucene.version>5.5.0</org.apache.lucene.version>
|
||||||
<org.imgscalr.imgscalr-lib.version>4.2</org.imgscalr.imgscalr-lib.version>
|
<org.imgscalr.imgscalr-lib.version>4.2</org.imgscalr.imgscalr-lib.version>
|
||||||
|
Loading…
Reference in New Issue
Block a user