InheritDefaultAclHandler implements IRepositoryDefaultAclHandler { @Override public RepositoryFileAcl createDefaultAcl( RepositoryFile repositoryFile ) { return new RepositoryFileAcl.Builder( PentahoSessionHolder.getSession().getName() ).entriesInheriting( true ) .build(); }  @Override RepositoryFileAcl createDefaultAcl( RepositoryFile repositoryFile );  }
@Test public void testCreateDefaultAcl() { RepositoryFileAcl repositoryFileAcl = inheritDefaultAclHandler.createDefaultAcl( repositoryFile ); assertTrue( repositoryFileAcl.isEntriesInheriting() ); }
@Test public void testSharedObjectsCreateDefaultAcl() { 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() ); 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() ); }