//~--- methods --------------------------------------------------------
@Override
public void processMessage(WebSocketMessage webSocketData) {
AbstractNode obj = getNode(webSocketData.getId());
boolean rec = (Boolean) webSocketData.getNodeData().get("recursive");
String principalId = (String) webSocketData.getNodeData().get("principalId");
String permission = (String) webSocketData.getNodeData().get("permission");
String action = (String) webSocketData.getNodeData().get("action");
if (principalId == null) {
logger.log(Level.SEVERE, "This command needs a principalId");
getWebSocket().send(MessageBuilder.status().code(400).build(), true);
}
Principal principal = (Principal) getNode(principalId);
if (principal == null) {
logger.log(Level.SEVERE, "No principal found with id {0}", new Object[]{principalId});
getWebSocket().send(MessageBuilder.status().code(400).build(), true);
}
webSocketData.getNodeData().remove("recursive");
if (obj != null) {
final App app = StructrApp.getInstance(getWebSocket().getSecurityContext());
try (final Tx tx = app.tx()) {
if (!getWebSocket().getSecurityContext().isAllowed(((AbstractNode) obj), Permission.accessControl)) {
logger.log(Level.WARNING, "No access control permission for {0} on {1}", new Object[]{getWebSocket().getCurrentUser().toString(), obj.toString()});
getWebSocket().send(MessageBuilder.status().message("No access control permission").code(400).build(), true);
tx.success();
return;