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

Examples of org.pentaho.platform.api.repository2.unified.RepositoryFile


  public void setLocalePropertiesForFileById( Serializable fileId, String locale, Properties properties ) {
    if ( isKioskEnabled() ) {
      throw new RuntimeException( Messages.getInstance().getString( "JcrRepositoryFileDao.ERROR_0006_ACCESS_DENIED" ) ); //$NON-NLS-1$
    }

    RepositoryFile repositoryFile = getFileById( fileId, true );
    setLocalePropertiesForFile( repositoryFile, locale, properties );
  }
View Full Code Here


  public void setLocalePropertiesForFileByPath( String relPath, String locale, Properties properties ) {
    if ( isKioskEnabled() ) {
      throw new RuntimeException( Messages.getInstance().getString( "JcrRepositoryFileDao.ERROR_0006_ACCESS_DENIED" ) ); //$NON-NLS-1$
    }

    RepositoryFile repositoryFile = getFileById( relPath, true );
    setLocalePropertiesForFile( repositoryFile, locale, properties );
  }
View Full Code Here

  public static RepositoryFileSid root() {
    return new RepositoryFileSid( userNameUtils.getPrincipleId( null, "__root__" ), USER );
  }

  protected void init() {
    RepositoryFile rootFolder =
        new RepositoryFile.Builder( "" ).path( RepositoryFile.SEPARATOR ).folder( true ).build();

    RepositoryFileAcl rootFolderAcl =
        new RepositoryFileAcl.Builder( root() ).entriesInheriting( false ).ace( everyone(), READ ).build();

    root = new FileRecord( rootFolder, rootFolderAcl );
    idManager.register( root );

    RepositoryFile publicFolder =
        new RepositoryFile.Builder( "public" ).path( RepositoryFile.SEPARATOR + "public" ).folder( true ).build();

    RepositoryFileAcl publicFolderAcl =
        new RepositoryFileAcl.Builder( root() ).entriesInheriting( false ).ace( everyone(), READ, WRITE ).build();

    FileRecord pub = new FileRecord( publicFolder, publicFolderAcl );
    root.addChild( pub );
    idManager.register( pub );

    RepositoryFile etcFolder =
        new RepositoryFile.Builder( "etc" ).path( RepositoryFile.SEPARATOR + "etc" ).folder( true ).build();

    RepositoryFileAcl etcFolderAcl = new RepositoryFileAcl.Builder( root() ).entriesInheriting( true ).build();

    FileRecord etc = new FileRecord( etcFolder, etcFolderAcl );
View Full Code Here

  @Override
  public RepositoryFileTree getTree( final String path, final int depth, final String filter,
                                     final boolean showHidden ) {
    FileRecord r = root.getFileRecord( path );
    RepositoryFile rootFile = r.getFile();
    if ( !showHidden && rootFile.isHidden() ) {
      return null;
    }
    List<RepositoryFileTree> children;
    if ( depth != 0 ) {
      children = new ArrayList<RepositoryFileTree>();
      if ( rootFile.isFolder() ) {
        List<RepositoryFile> childrenTmp = getChildren( rootFile.getId(), filter );
        for ( RepositoryFile child : childrenTmp ) {
          RepositoryFileTree repositoryFileTree = getTree( child.getPath(), depth - 1, filter, showHidden );
          if ( repositoryFileTree != null ) {
            children.add( repositoryFileTree );
          }
View Full Code Here

    userRoleDao.createUser( tenantAcme, USERNAME_SUZY, PASSWORD, "", new String[] { tenantAdminRoleName } );
    logout();

    login( USERNAME_SUZY, tenantAcme, new String[] { tenantAdminRoleName, tenantAuthenticatedRoleName } );

    RepositoryFile suzyHomeFolder = repo.getFile( ClientRepositoryPaths.getUserHomeFolderPath( USERNAME_SUZY ) );
    assertNotNull( suzyHomeFolder );
    assertNotNull( SimpleJcrTestUtils.getItem( testJcrTemplate, ServerRepositoryPaths.getTenantRootFolderPath() ) );
    assertNotNull( SimpleJcrTestUtils.getItem( testJcrTemplate, ServerRepositoryPaths.getTenantPublicFolderPath() ) );
    assertNotNull( SimpleJcrTestUtils.getItem( testJcrTemplate, ServerRepositoryPaths.getTenantHomeFolderPath() ) );
    final String suzyFolderPath = ServerRepositoryPaths.getUserHomeFolderPath( tenantAcme, USERNAME_SUZY );
View Full Code Here

        new RepositoryFileSid( tenantAuthenticatedRoleName, RepositoryFileSid.Type.ROLE );
    final RepositoryFileSid sysAdminSid = new RepositoryFileSid( sysAdminUserName, RepositoryFileSid.Type.USER );
    final RepositoryFileSid tenantAdminSid = new RepositoryFileSid( USERNAME_ADMIN, RepositoryFileSid.Type.USER );
    final RepositoryFileSid tenantCreatorSid = new RepositoryFileSid( sysAdminUserName, RepositoryFileSid.Type.USER );

    RepositoryFile file = tenantManager.getTenantRootFolder( tenantAcme );
    String tenantRootFolderAbsPath = pathConversionHelper.relToAbs( file.getPath() );
    // pentaho root folder
    assertTrue( SimpleJcrTestUtils.hasPrivileges( testJcrTemplate, tenantRootFolderAbsPath, Privilege.JCR_READ ) );
    // TODO mlowery possible issue
    assertTrue( SimpleJcrTestUtils.hasPrivileges( testJcrTemplate, tenantRootFolderAbsPath,
        Privilege.JCR_READ_ACCESS_CONTROL ) );
View Full Code Here

    Validate.isTrue( !file.isFolder() );
    if ( !hasAccess( parentFolderId, EnumSet.of( WRITE ) ) ) {
      throw new AccessDeniedException( "access denied" );
    }
    FileRecord parentFolder = idManager.getFileById( parentFolderId );
    RepositoryFile fileFromRepo =
        new RepositoryFile.Builder( file ).path( parentFolder.getPath() + RepositoryFile.SEPARATOR + file.getName() )
            .title( findTitle( file ) ).description( findDesc( file ) ).build();
    RepositoryFileAcl aclFromRepo = new RepositoryFileAcl.Builder( acl ).build();
    FileRecord fileRecord = new FileRecord( fileFromRepo, data, aclFromRepo, new HashMap<String, Serializable>() );
    idManager.register( fileRecord );
View Full Code Here

    login( USERNAME_ADMIN, tenantDuff, new String[] { tenantAdminRoleName, tenantAuthenticatedRoleName } );
    userRoleDao.createUser( tenantDuff, USERNAME_PAT, PASSWORD, "", null );

    login( USERNAME_TIFFANY, tenantAcme, new String[] { tenantAuthenticatedRoleName } );
    RepositoryFile tiffanyHomeFolder = repo.getFile( ClientRepositoryPaths.getUserHomeFolderPath( USERNAME_TIFFANY ) );
    assertNotNull( tiffanyHomeFolder );
    assertNotNull( repo.createFolder( tiffanyHomeFolder.getId(), new RepositoryFile.Builder( "test" ).folder( true )
        .build(), null ) );
    login( USERNAME_SUZY, tenantAcme, new String[] { tenantAuthenticatedRoleName } );
    final String acmeTenantRootFolderPath = ClientRepositoryPaths.getRootFolderPath();
    final String homeFolderPath = ClientRepositoryPaths.getHomeFolderPath();
    final String tiffanyFolderPath = homeFolderPath + "/" + USERNAME_TIFFANY;
View Full Code Here

    Validate.isTrue( !file.isVersioned() );
    if ( !hasAccess( parentFolderId, EnumSet.of( WRITE ) ) ) {
      throw new AccessDeniedException( "access denied" );
    }
    FileRecord parentFolder = idManager.getFileById( parentFolderId );
    RepositoryFile fileFromRepo =
        new RepositoryFile.Builder( file ).path(
            parentFolder.getPath()
                + ( parentFolder.getPath().endsWith( RepositoryFile.SEPARATOR ) ? "" : RepositoryFile.SEPARATOR )
                + file.getName() ).title( findTitle( file ) ).description( findDesc( file ) ).build();
    RepositoryFileAcl aclFromRepo = new RepositoryFileAcl.Builder( acl ).build();
View Full Code Here

    login( USERNAME_ADMIN, tenantAcme, new String[] { tenantAdminRoleName, tenantAuthenticatedRoleName } );
    userRoleDao.createUser( tenantAcme, USERNAME_TIFFANY, PASSWORD, "", null );

    login( USERNAME_TIFFANY, tenantAcme, new String[] { tenantAuthenticatedRoleName } );

    RepositoryFile tiffanyHomeFolder = repo.getFile( ClientRepositoryPaths.getUserHomeFolderPath( USERNAME_TIFFANY ) );
    repo.createFolder( tiffanyHomeFolder.getId(), new RepositoryFile.Builder( "test" ).folder( true ).build(), null );
    RepositoryFileAcl acl = repo.getAcl( tiffanyHomeFolder.getId() );
    login( USERNAME_ADMIN, tenantAcme, new String[] { tenantAdminRoleName, tenantAuthenticatedRoleName } );
    assertNotNull( repo.getFile( ClientRepositoryPaths.getUserHomeFolderPath( USERNAME_TIFFANY ) ) );
    assertNotNull( repo.getFile( ClientRepositoryPaths.getUserHomeFolderPath( USERNAME_TIFFANY ) + "/test" ) );
  }
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.repository2.unified.RepositoryFile

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.