Package org.hive2hive.core.model

Examples of org.hive2hive.core.model.FolderIndex.canWrite()


      // get and check the file nodes to be rearranged
      FolderIndex oldParent = (FolderIndex) userProfile.getFileById(oldParentKey);
      if (oldParent == null) {
        logger.error("Could not find the old parent.");
        return;
      } else if (!oldParent.canWrite(sender)) {
        logger.error("User was not allowed to change the source directory.");
        return;
      }

      Index child = oldParent.getChildByName(sourceFileName);
View Full Code Here


      FolderIndex newParent = (FolderIndex) userProfile.getFileById(newParentKey);
      if (newParent == null) {
        logger.error("Could not find the new parent.");
        return;
      } else if (!newParent.canWrite(sender)) {
        logger.error("User was not allowed to change the destination directory.");
        return;
      }

      // rearrange
View Full Code Here

    // find the parent node using the relative path to navigate there
    FolderIndex parentNode = (FolderIndex) userProfile.getFileByPath(file.getParentFile(), root);

    // validate the write protection
    if (!parentNode.canWrite()) {
      throw new ProcessExecutionException(String.format(
          "This directory '%s' is write protected (and we don't have the keys).", file
              .getParentFile().getName()));
    }
   
View Full Code Here

      newParent.addChild(movedNode);

      // validate
      if (!oldParent.canWrite()) {
        throw new ProcessExecutionException("No write access to the source directory");
      } else if (!newParent.canWrite()) {
        throw new ProcessExecutionException("No write access to the destination directory");
      }

      // update in DHT
      profileManager.readyToPut(userProfile, getID());
View Full Code Here

        logger.error("Could not process the task because the parent node has not been found.");
        return;
      }

      // validate if the other sharer has the right to share
      if (parentNode.canWrite(sender)) {
        logger.debug("Rights of user '{}' checked. User is allowed to modify.", sender);
      } else {
        logger.error("Permission of user '{}' not found. Deny to apply this user's changes.", sender);
        return;
      }
View Full Code Here

      // find the parent node using the relative path to navigate there
      FolderIndex parentNode = (FolderIndex) userProfile.getFileByPath(file.getParentFile(), root);

      // validate the write protection
      if (!parentNode.canWrite()) {
        throw new ProcessExecutionException("This directory is write protected (and we don't have the keys).");
      }

      // create a file tree node in the user profile
      parentKey = parentNode.getFilePublicKey();
View Full Code Here

      logger.error("Got task to delete the root, which is invalid.");
      return null;
    }

    // check write permision
    if (!parent.canWrite(sender)) {
      logger.error("User without WRITE permissions tried to delete a file.");
      return null;
    }

    parent.removeChild(toDelete);
View Full Code Here

    try {
      UserProfile userProfile = profileManager.getUserProfile(getID(), true);
      FolderIndex folderIndex = (FolderIndex) userProfile.getFileByPath(context.getFolder(), root);

      if (!folderIndex.canWrite()) {
        throw new ProcessExecutionException(String.format(
            "Cannot share folder '%s' with read-only access.", folderIndex.getName()));
      } else if (!folderIndex.getSharedFlag() && folderIndex.isSharedOrHasSharedChildren()) {
        // restriction that disallows sharing folders within other shared folders
        throw new ProcessExecutionException(String.format(
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.