Search in sources :

Example 1 with IAclService

use of org.pentaho.di.ui.repository.pur.services.IAclService in project pentaho-kettle by pentaho.

the class RepositoryTestBase method testGetAcl.

@Test
@Ignore
public void testGetAcl() throws Exception {
    RepositoryDirectoryInterface rootDir = initRepo();
    JobMeta jobMeta = createJobMeta(EXP_JOB_NAME);
    RepositoryDirectoryInterface jobsDir = rootDir.findDirectory(DIR_JOBS);
    repository.save(jobMeta, VERSION_COMMENT_V1, null);
    deleteStack.push(jobMeta);
    assertNotNull(jobMeta.getObjectId());
    ObjectRevision version = jobMeta.getObjectRevision();
    assertNotNull(version);
    assertTrue(hasVersionWithComment(jobMeta, VERSION_COMMENT_V1));
    assertTrue(repository.exists(EXP_JOB_NAME, jobsDir, RepositoryObjectType.JOB));
    ObjectAcl acl = ((IAclService) repository).getAcl(jobMeta.getObjectId(), false);
    assertNotNull(acl);
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) ObjectAcl(org.pentaho.di.repository.pur.model.ObjectAcl) IAclService(org.pentaho.di.ui.repository.pur.services.IAclService) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with IAclService

use of org.pentaho.di.ui.repository.pur.services.IAclService in project pentaho-kettle by pentaho.

the class RepositoryTestBase method testSetAcl.

@Test
@Ignore
public void testSetAcl() throws Exception {
    RepositoryDirectoryInterface rootDir = initRepo();
    JobMeta jobMeta = createJobMeta(EXP_JOB_NAME);
    RepositoryDirectoryInterface jobsDir = rootDir.findDirectory(DIR_JOBS);
    repository.save(jobMeta, VERSION_COMMENT_V1, null);
    deleteStack.push(jobMeta);
    assertNotNull(jobMeta.getObjectId());
    ObjectRevision version = jobMeta.getObjectRevision();
    assertNotNull(version);
    assertTrue(hasVersionWithComment(jobMeta, VERSION_COMMENT_V1));
    assertTrue(repository.exists(EXP_JOB_NAME, jobsDir, RepositoryObjectType.JOB));
    ObjectAcl acl = ((IAclService) repository).getAcl(jobMeta.getObjectId(), false);
    assertNotNull(acl);
    acl.setEntriesInheriting(false);
    ObjectAce ace = new RepositoryObjectAce(new RepositoryObjectRecipient("suzy", Type.USER), EnumSet.of(RepositoryFilePermission.READ));
    List<ObjectAce> aceList = new ArrayList<ObjectAce>();
    aceList.add(ace);
    acl.setAces(aceList);
    ((IAclService) repository).setAcl(jobMeta.getObjectId(), acl);
    ObjectAcl acl1 = ((IAclService) repository).getAcl(jobMeta.getObjectId(), false);
    assertEquals(Boolean.FALSE, acl1.isEntriesInheriting());
    assertEquals(1, acl1.getAces().size());
    ObjectAce ace1 = acl1.getAces().get(0);
    assertEquals(ace1.getRecipient().getName(), "suzy");
    assertTrue(ace1.getPermissions().contains(RepositoryFilePermission.READ));
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) ObjectAcl(org.pentaho.di.repository.pur.model.ObjectAcl) RepositoryObjectRecipient(org.pentaho.di.repository.pur.model.RepositoryObjectRecipient) ArrayList(java.util.ArrayList) IAclService(org.pentaho.di.ui.repository.pur.services.IAclService) ObjectAce(org.pentaho.di.repository.pur.model.ObjectAce) RepositoryObjectAce(org.pentaho.di.repository.pur.model.RepositoryObjectAce) RepositoryObjectAce(org.pentaho.di.repository.pur.model.RepositoryObjectAce) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

Ignore (org.junit.Ignore)2 Test (org.junit.Test)2 JobMeta (org.pentaho.di.job.JobMeta)2 ObjectAcl (org.pentaho.di.repository.pur.model.ObjectAcl)2 IAclService (org.pentaho.di.ui.repository.pur.services.IAclService)2 ArrayList (java.util.ArrayList)1 ObjectAce (org.pentaho.di.repository.pur.model.ObjectAce)1 RepositoryObjectAce (org.pentaho.di.repository.pur.model.RepositoryObjectAce)1 RepositoryObjectRecipient (org.pentaho.di.repository.pur.model.RepositoryObjectRecipient)1