Package org.pentaho.platform.api.repository2.unified

Examples of org.pentaho.platform.api.repository2.unified.RepositoryFileAcl$Builder


          new RepositoryFile.Builder( bundle.getName() ).hidden( isHiddenBundle( bundle ) ).title(
              RepositoryFile.DEFAULT_LOCALE,
              getTitle( bundle.getTitle() != null ? bundle.getTitle() : bundle.getName() ) ).versioned( true ).build();
      final Serializable parentId = checkAndCreatePath( repositoryPath, getImportSession().getCurrentManifestKey() );

      final RepositoryFileAcl acl = bundle.getAcl();
      if ( null == acl ) {
        return repository.createFile( parentId, file, data, bundle.getComment() );
      } else {
        return repository.createFile( parentId, file, data, acl, bundle.getComment() );
      }
View Full Code Here


    }
    RepositoryFile.Builder builder =
        new RepositoryFile.Builder( RepositoryFilenameUtils.getName( folderPath ) ).path(
            RepositoryFilenameUtils.getPath( folderPath ) ).folder( true ).hidden( isHidden );
    RepositoryFile repoFile = builder.build();
    RepositoryFileAcl repoAcl = getImportSession().processAclForFile( manifestKey );
    if ( repoAcl != null ) {
      repoFile = repository.createFolder( parentId, repoFile, repoAcl, null );
      RepositoryFileAcl repositoryFileAcl = null;
      try {
        repositoryFileAcl =
            getImportSession().getManifest().getExportManifestEntity( manifestKey ).getRepositoryFileAcl();
      } catch ( NullPointerException e ) {
        // If npe then manifest entry is not defined which is likely so just ignore
View Full Code Here

          tenant = new Tenant( parentTenant.getRootFolderAbsolutePath() + "/" + tenantName, true );
          String folderPath = parentTenant.getRootFolderAbsolutePath();
          parentFolder = repositoryFileDao.getFileByAbsolutePath( folderPath );
        }

        RepositoryFileAcl acl = new RepositoryFileAcl.Builder( tenantCreatorId ).entriesInheriting( false ).build();
        RepositoryFile systemTenantFolder =
            repositoryFileDao.createFolder( parentFolder != null ? parentFolder.getId() : null,
                new RepositoryFile.Builder( tenant.getName() ).folder( true ).build(), acl, "" );
        repositoryFileDao.getFileByAbsolutePath( tenant.getId() );
View Full Code Here

    if ( parentTenant == null ) {
      repositoryFileAclDao.addAce( tenantRootFolder.getId(), tenantAdminRoleSid, EnumSet
          .of( RepositoryFilePermission.ALL ) );
    } else {

      RepositoryFileAcl acl = repositoryFileAclDao.getAcl( tenantRootFolder.getId() );
      Builder aclBuilder =
          new RepositoryFileAcl.Builder( acl ).ace( tenantAdminRoleSid, EnumSet.of( RepositoryFilePermission.ALL ) );

      IPentahoSession origPentahoSession = PentahoSessionHolder.getSession();
      Authentication origAuthentication = SecurityContextHolder.getContext().getAuthentication();
View Full Code Here

    userRoleDao.createUser( tenantAcme, USERNAME_SUZY, PASSWORD, "", null );

    DataNode node = new DataNode( "kdjd" );
    RepositoryFile sampleFile =
        createSampleFile( ClientRepositoryPaths.getPublicFolderPath(), "helloworld2.sample", "dfdd", true, 83 );
    RepositoryFileAcl acl = repo.getAcl( sampleFile.getId() );
    RepositoryFileAcl newAcl = new RepositoryFileAcl.Builder( acl ).entriesInheriting( false ).clearAces().build();
    repo.updateAcl( newAcl );
    node.setProperty( "urei2", new DataNodeRef( sampleFile.getId() ) );
    final String parentFolderPath = ClientRepositoryPaths.getPublicFolderPath();
    final String expectedName = "helloworld.doesnotmatter";
    RepositoryFile parentFolder = repo.getFile( parentFolderPath );
View Full Code Here

    RepositoryFile destFolder = new RepositoryFile.Builder( "dest" ).folder( true ).build();
    srcFolder = repo.createFolder( parentFolder.getId(), srcFolder, null );
    destFolder = repo.createFolder( parentFolder.getId(), destFolder, null );

    RepositoryFile newFile = createSampleFile( srcFolder.getPath(), "helloworld.sample", "ddfdf", false, 83 );
    RepositoryFileAcl acl =
        new RepositoryFileAcl.Builder( newFile.getId(), userNameUtils.getPrincipleId( tenantAcme, USERNAME_TIFFANY ),
            RepositoryFileSid.Type.USER ).entriesInheriting( false ).ace(
            userNameUtils.getPrincipleId( tenantAcme, USERNAME_SUZY ), RepositoryFileSid.Type.USER,
            RepositoryFilePermission.READ ).build();
    repo.updateAcl( acl );
View Full Code Here

    RepositoryFile rootFolder = repo.getFile( "/" );
    assertNotNull( rootFolder );
    assertEquals( "", rootFolder.getName() );
    assertNotNull( rootFolder.getId() );
    assertNotNull( repo.getChildren( new RepositoryRequest( String.valueOf( rootFolder.getId() ), true, -1, null ) ) );
    RepositoryFileAcl rootFolderAcl = repo.getAcl( rootFolder.getId() );
  }
View Full Code Here

    inheritDefaultAclHandler = new InheritDefaultAclHandler();
  }

  @Test
  public void testCreateDefaultAcl() {
    RepositoryFileAcl repositoryFileAcl = inheritDefaultAclHandler.createDefaultAcl( repositoryFile );
    assertTrue( repositoryFileAcl.isEntriesInheriting() );
  }
View Full Code Here

  public void testSharedObjectsCreateDefaultAcl() {
    // default behavior is to inherit everything but database connections
    SharedObjectsDefaultAclHandler aclHandler = new SharedObjectsDefaultAclHandler();
    RepositoryFile f = mock( RepositoryFile.class );
    when( f.getPath() ).thenReturn( "/pentaho/tenant0/etc/pdi/databases/Test.kdb" );
    RepositoryFileAcl acl = aclHandler.createDefaultAcl( f );
    assertTrue( !acl.isEntriesInheriting() );
    assertTrue( acl.getAces().size() == 1 );
    assertTrue( "Authenticated".equals( acl.getAces().get( 0 ).getSid().getName().toString() ) );
    assertTrue( RepositoryFileSid.Type.ROLE.equals( acl.getAces().get( 0 ).getSid().getType() ) );
    assertTrue( acl.getAces().get( 0 ).getPermissions().size() == 1 );
    assertTrue( acl.getAces().get( 0 ).getPermissions().contains( RepositoryFilePermission.ALL ) );

    acl = aclHandler.createDefaultAcl( repositoryFile );
    assertTrue( acl.isEntriesInheriting() );

    // null role tells the acl handler to default to no aces
    List<String> paths = new ArrayList<String>();
    paths.add( "{0}/etc/pdi/databases" );
    aclHandler = new SharedObjectsDefaultAclHandler( null, paths );

    acl = aclHandler.createDefaultAcl( f );
    assertTrue( !acl.isEntriesInheriting() );
    System.out.println( acl.getAces() );
    assertTrue( acl.getAces().size() == 0 );

    acl = aclHandler.createDefaultAcl( repositoryFile );
    assertTrue( acl.isEntriesInheriting() );
  }
View Full Code Here

      path = FileUtils.PATH_SEPARATOR;
    } else if ( !pathId.startsWith( FileUtils.PATH_SEPARATOR ) ) {
      path = idToPath( pathId );
    }

    RepositoryRequest repositoryRequest = getRepositoryRequest( path, showHidden, depth, filter );
    repositoryRequest.setIncludeAcls( includeAcls );

    RepositoryFileTreeDto tree = getRepoWs().getTreeFromRequest( repositoryRequest );
    List<RepositoryFileTreeDto> filteredChildren = new ArrayList<RepositoryFileTreeDto>();

    // BISERVER-9599 - Use special sort order
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.repository2.unified.RepositoryFileAcl$Builder

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.