Exemple #1
0
  public static void getFolder(HttpServletRequest request) throws Exception {
    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    long folderId = ParamUtil.getLong(request, "folderId");

    Folder folder = null;

    if ((folderId > 0) && (folderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID)) {

      folder = DLAppServiceUtil.getFolder(folderId);

      if (folder.getModel() instanceof DLFolder) {
        DLFolder dlFolder = (DLFolder) folder.getModel();

        if (dlFolder.isInTrash() || dlFolder.isInTrashContainer()) {
          throw new NoSuchFolderException();
        }
      }
    } else {
      DLPermission.check(
          themeDisplay.getPermissionChecker(), themeDisplay.getScopeGroupId(), ActionKeys.VIEW);
    }

    request.setAttribute(WebKeys.DOCUMENT_LIBRARY_FOLDER, folder);
  }
  @Override
  public boolean hasAddPermission(
      PermissionChecker permissionChecker, long groupId, long classTypeId) throws Exception {

    if ((classTypeId > 0)
        && !DLFileEntryTypePermission.contains(permissionChecker, classTypeId, ActionKeys.VIEW)) {

      return false;
    }

    return DLPermission.contains(permissionChecker, groupId, ActionKeys.ADD_DOCUMENT);
  }
  public static boolean contains(
      PermissionChecker permissionChecker, long groupId, long folderId, String actionId)
      throws PortalException, SystemException {

    if (folderId == DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
      return DLPermission.contains(permissionChecker, groupId, actionId);
    } else {
      Folder folder = DLAppLocalServiceUtil.getFolder(folderId);

      return folder.containsPermission(permissionChecker, actionId);
    }
  }
Exemple #4
0
  public static void getRepository(HttpServletRequest request) throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    long repositoryId = ParamUtil.getLong(request, "repositoryId");

    Repository repository = null;

    if (repositoryId > 0) {
      repository = RepositoryServiceUtil.getRepository(repositoryId);
    } else {
      DLPermission.check(
          themeDisplay.getPermissionChecker(), themeDisplay.getScopeGroupId(), ActionKeys.VIEW);
    }

    request.setAttribute(WebKeys.DOCUMENT_LIBRARY_REPOSITORY, repository);
  }