Package pt.webdetails.cpf.repository.api

Examples of pt.webdetails.cpf.repository.api.IUserContentAccess.fileExists()


      log.debug("Get repository file: " + file);

      IUserContentAccess access = contentAccessFactory.getUserContentAccess(null);

      if( !access.fileExists(file) && access.hasAccess(file, FileAccess.READ)) {
        log.error("Access to Repository has failed File does not exist: " + file);
        throw new NullPointerException("Access to Repository has failed");
      }
      IBasicFile bf = access.fetchFile(file);
View Full Code Here


      log.debug("Delete repository file: " + file);

      IUserContentAccess access = contentAccessFactory.getUserContentAccess(null);

      if( !access.fileExists(file) && access.hasAccess(file, FileAccess.DELETE)) {
        throw new SaikuServiceException("Access to Repository has failed File does not exist or no delete right: " + file);
      }
      boolean ok = access.deleteFile(file);
      if (!ok) {
        throw new SaikuServiceException("Failed to write file: " + file);
View Full Code Here

        return Response.ok().build();

      final String fileType = type;
      IUserContentAccess access = contentAccessFactory.getUserContentAccess(null);
     
      if( !access.fileExists(directory) && access.hasAccess(directory, FileAccess.READ)) {
        throw new SaikuServiceException("Access to Repository has failed File does not exist or no read right: " + directory);
      }
     
      IBasicFileFilter txtFilter = StringUtils.isBlank(type) ? null : new IBasicFileFilter() {
        public boolean accept(IBasicFile file) {
View Full Code Here

      }
    };
    List<IBasicFile> files = new ArrayList<IBasicFile>();
    IUserContentAccess access = contentAccessFactory.getUserContentAccess(null);
        path = path.replace(":", "/");
    if (access.fileExists(path)) {
      IBasicFile bf = access.fetchFile(path);
      if (!bf.isDirectory()) {
        files.add(bf);
        log.debug("Found file in " + path);
      } else {
View Full Code Here

  private List<AclMethod> getAcl(String file, boolean folder) {
    List<AclMethod> acls = new ArrayList<AclMethod>();
      IAuthorizationPolicy policy = PentahoSystem.get( IAuthorizationPolicy.class );
    boolean isAdmin = policy.isAllowed( AdministerSecurityAction.NAME );
    IUserContentAccess access = contentAccessFactory.getUserContentAccess(null);
    if (access.fileExists(file)) {
      acls.add(AclMethod.READ);
      if (isAdmin || access.hasAccess(file, FileAccess.WRITE)) {
        acls.add(AclMethod.WRITE);
      }
      if (isAdmin) {
View Full Code Here

    }

    IUserContentAccess contentAccess = CdfEngine.getUserContentReader( null );
    IReadAccess systemAccess = CdfEngine.getPluginSystemReader( null );

    if ( contentAccess.fileExists( resourcePath ) && contentAccess.hasAccess( resourcePath, FileAccess.EXECUTE ) ) {
      PluginIOUtils.writeOutAndFlush( out, contentAccess.getFileInputStream( resourcePath ) );
    } else if ( systemAccess.fileExists( resourcePath ) ) {
      PluginIOUtils.writeOutAndFlush( out, systemAccess.getFileInputStream( resourcePath ) );
    } else {
      logger.info( " resource not found: " + resourcePath );
View Full Code Here

    boolean success = false;

    IUserContentAccess access = CdfEngine.getUserContentReader( null );

    if ( access.fileExists( dashboard ) ) {

      // Check for access permissions
      if ( !access.hasAccess( dashboard, FileAccess.EXECUTE ) ) {
        throw new InvalidCdfOperationException( "Access denied" );
      }
View Full Code Here

    IUserContentAccess repoAccess = CdfEngine.getUserContentReader( null );
    IReadAccess systemAccess = CdfEngine.getPluginSystemReader( null );
    IBasicFile dashboardTemplateFile = null;

    if ( !StringUtils.isEmpty( templatePath ) && repoAccess.fileExists( templatePath ) ) {

      // Check for access permissions
      if ( repoAccess.hasAccess( templatePath, FileAccess.EXECUTE ) ) {
        dashboardTemplateFile = repoAccess.fetchFile( templatePath );
      } else {
View Full Code Here

  public void getFile( final OutputStream out ) throws IOException {

    String path = getRequestParameters().getStringParameter( MethodParams.PATH, "" );
    IUserContentAccess access = CdeEnvironment.getUserContentAccess();

    if ( access.fileExists( path ) ) {
      setResponseHeaders( "text/plain", NO_CACHE_DURATION, null );
      writeOut( out, IOUtils.toString( access.getFileInputStream( path ) ) );
    } else {
      writeOut( out, "No file found in given path " + path );
    }
View Full Code Here

  public void createFolder( OutputStream out ) throws PentahoAccessControlException, IOException {

    String path = getRequestParameters().getStringParameter( MethodParams.PATH, null );
    IUserContentAccess access = CdeEnvironment.getUserContentAccess();

    if ( access.fileExists( path ) ) {
      writeOut( out, "already exists: " + path );
    } else {
      if ( access.createFolder( path ) ) {
        writeOut( out, path + "created ok" );
      } else {
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.