Package org.structr.core.entity

Examples of org.structr.core.entity.Principal


  }

  @Override
  public String getOwnerName() {
    try (Tx tx = StructrApp.getInstance().tx()) {
      Principal owner = getOwner();
      return owner != null ? owner.getProperty(AbstractUser.name) : "";
    } catch (FrameworkException fex) {
      logger.log(Level.SEVERE, "Error while getting owner name of " + this, fex);
    }
    return null;
  }
View Full Code Here


  @Override
  public String getGroupName() {

    try (Tx tx = StructrApp.getInstance().tx()) {

      Principal owner = getOwner();

      if (owner != null) {
        List<Principal> parents = owner.getParents();
        if (!parents.isEmpty()) {

          return parents.get(0).getProperty(AbstractNode.name);

        }
View Full Code Here

    return false;
  }

  private Principal getOwner() {
    try (Tx tx = StructrApp.getInstance().tx()) {
      Principal owner = structrFile.getProperty(File.owner);
      return owner;
    } catch (FrameworkException fex) {
      logger.log(Level.SEVERE, "Error while getting owner of " + this, fex);
    }
    return null;
View Full Code Here

    if (parentNode instanceof Group) {

      Group group = (Group) parentNode;
     
      Principal user = (Principal) getNode(id);

      if (user != null) {
        try {
          group.addMember(user);
        } catch (FrameworkException ex) {
View Full Code Here

  }

  @Override
  public void processMessage(WebSocketMessage webSocketData) {

    final Principal user = getWebSocket().getCurrentUser();

    if (user != null) {

      final String sessionId = webSocketData.getSessionId();
      if (sessionId != null) {

        AuthHelper.clearSession(sessionId);
        user.removeSessionId(sessionId);

      }

      getWebSocket().setAuthenticated(null, null);
View Full Code Here

    return true;
  }

  private Principal getOwner() {
    try (Tx tx = StructrApp.getInstance().tx()) {
      Principal owner = getProperty(File.owner);
      tx.success();
      return owner;
    } catch (FrameworkException fex) {
      logger.log(Level.SEVERE, "Error while getting owner of " + this, fex);
    }
View Full Code Here

    String name = "";

    try (Tx tx = StructrApp.getInstance().tx()) {

      Principal owner = getOwner();
      if (owner != null) {

        name = owner.getProperty(AbstractUser.name);
      }
      tx.success();

    } catch (FrameworkException fex) {
      logger.log(Level.SEVERE, "Error while getting owner name of " + this, fex);
View Full Code Here

    String name = "";

    try (Tx tx = StructrApp.getInstance().tx()) {

      Principal owner = getOwner();

      if (owner != null) {
        List<Principal> parents = owner.getParents();
        if (!parents.isEmpty()) {

          name = parents.get(0).getProperty(AbstractNode.name);
        }
      }
View Full Code Here

        // don't continue on redirects
        if (response.getStatus() == 302) {
          return;
        }

        final Principal user = securityContext.getUser(false);
        if (user != null) {

          // Don't cache if a user is logged in
          dontCache = true;
View Full Code Here

        // don't continue on redirects
        if (response.getStatus() == 302) {
          return;
        }

        final Principal user = securityContext.getUser(false);
        if (user != null) {

          // Don't cache if a user is logged in
          dontCache = true;
View Full Code Here

TOP

Related Classes of org.structr.core.entity.Principal

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.