Package org.structr.common

Examples of org.structr.common.SecurityContext$SuperUserSecurityContext


  //~--- methods --------------------------------------------------------
  @Override
  public void processMessage(WebSocketMessage webSocketData) {

    final SecurityContext securityContext = getWebSocket().getSecurityContext();

    // Node to clone
    String nodeId = webSocketData.getId();
    final AbstractNode nodeToClone = getNode(nodeId);
    final Map<String, Object> nodeData = webSocketData.getNodeData();
View Full Code Here


   * @param id
   * @return the node
   */
  public AbstractNode getNode(final String id) {

    final SecurityContext securityContext = getWebSocket().getSecurityContext();
    final App app = StructrApp.getInstance(securityContext);

    try (final Tx tx = app.tx()) {

      final AbstractNode node = (AbstractNode)app.get(id);
View Full Code Here

    if (id == null) {
      return null;
    }

    final SecurityContext securityContext = getWebSocket().getSecurityContext();
    final App app = StructrApp.getInstance(securityContext);

    try (final Tx tx = app.tx()) {

      final AbstractRelationship rel = (AbstractRelationship)app.get(id);
View Full Code Here

      final User tester2 = app.nodeQuery(User.class).andName("tester2").getFirst();

      assertNotNull("User tester1 should exist.", tester1);
      assertNotNull("User tester2 should exist.", tester2);

      final SecurityContext tester1Context = SecurityContext.getInstance(tester1, AccessMode.Backend);
      final SecurityContext tester2Context = SecurityContext.getInstance(tester2, AccessMode.Backend);

      // users
      assertEquals("tester1", p1.replaceVariables(tester1Context, ctx, "${me.name}"));
      assertEquals("tester2", p1.replaceVariables(tester2Context, ctx, "${me.name}"));
View Full Code Here

  }

  @Override
  public void processMessage(final WebSocketMessage webSocketData) {

    final SecurityContext securityContext  = getWebSocket().getSecurityContext();
    final String rawType                   = (String) webSocketData.getNodeData().get("type");
    final String properties                = (String) webSocketData.getNodeData().get("properties");
    final Class type                       = SchemaHelper.getEntityClassForRawType(rawType);

    if (type == null) {
      getWebSocket().send(MessageBuilder.status().code(404).message("Type " + rawType + " not found").build(), true);
      return;
    }

    if (properties != null) {
      securityContext.setCustomView(StringUtils.split(properties, ","));
    }
   
    final String sortOrder   = webSocketData.getSortOrder();
    final String sortKey     = webSocketData.getSortKey();
    final int pageSize       = webSocketData.getPageSize();
View Full Code Here

  }

  @Override
  public void processMessage(WebSocketMessage webSocketData) {

    final SecurityContext securityContext = getWebSocket().getSecurityContext();
    final String searchString = (String) webSocketData.getNodeData().get("searchString");
    final String restQuery    = (String) webSocketData.getNodeData().get("restQuery");
    final String cypherQuery  = (String) webSocketData.getNodeData().get("cypherQuery");
    final String paramString  = (String) webSocketData.getNodeData().get("cypherParams");
    final String typeString   = (String) webSocketData.getNodeData().get("type");

    Class type = null;
    if (typeString != null) {
      type = SchemaHelper.getEntityClassForRawType(typeString);
    }

    if (searchString == null) {

      if (cypherQuery != null) {

        try {
          Map<String, Object> obj = null;
         
          if (StringUtils.isNoneBlank(paramString)) {
           
            obj = new Gson().fromJson(paramString, Map.class);
           
          }
         
          final List<GraphObject> result = StructrApp.getInstance(securityContext).cypher(cypherQuery, obj);

          webSocketData.setResult(result);
          getWebSocket().send(webSocketData, true);

          return;

        } catch (Exception ex) {

          logger.log(Level.WARNING, "Exception occured", ex);
          getWebSocket().send(MessageBuilder.status().code(400).message(ex.getMessage()).build(), true);

        }

      }

      if (restQuery != null) {

        final RestDataSource restDataSource = new RestDataSource();
        try {
          securityContext.setRequest(getWebSocket().getRequest());
         
          webSocketData.setResult(restDataSource.getData(securityContext, null, restQuery));
          getWebSocket().send(webSocketData, true);
         
          return;
View Full Code Here

  }
 
  @Override
  public void processMessage(WebSocketMessage webSocketData) {

    final SecurityContext securityContext = getWebSocket().getSecurityContext();
    String sourceId                       = webSocketData.getId();
    Map<String, Object> properties        = webSocketData.getNodeData();
    String targetId                       = (String) properties.get("targetId");
    final LinkSource sourceNode           = (LinkSource) getNode(sourceId);
    final Linkable targetNode             = (Linkable) getNode(targetId);
View Full Code Here

  //~--- methods --------------------------------------------------------

  @Override
  public void processMessage(final WebSocketMessage webSocketData) {

    final SecurityContext securityContext = getWebSocket().getSecurityContext();
    final App app = StructrApp.getInstance(securityContext);

    Map<String, Object> nodeData = webSocketData.getNodeData();

    try {
View Full Code Here

  }

  @Override
  public void processMessage(WebSocketMessage webSocketData) {

    final SecurityContext securityContext = getWebSocket().getSecurityContext();
    final App app                         = StructrApp.getInstance(securityContext);
    final String id                       = webSocketData.getId();

    try (final Tx tx = app.tx()) {
View Full Code Here

  }

  @Override
  public void processMessage(WebSocketMessage webSocketData) {

    final SecurityContext securityContext = getWebSocket().getSecurityContext();
    final String sortOrder                = webSocketData.getSortOrder();
    final String sortKey                  = webSocketData.getSortKey();
    final int pageSize                    = webSocketData.getPageSize();
    final int page                        = webSocketData.getPage();
    final PropertyKey sortProperty        = StructrApp.getConfiguration().getPropertyKeyForJSONName(DOMNode.class, sortKey);
View Full Code Here

TOP

Related Classes of org.structr.common.SecurityContext$SuperUserSecurityContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.