Search in sources :

Example 11 with RepositoryObjectRecipient

use of org.pentaho.di.repository.pur.model.RepositoryObjectRecipient in project pentaho-kettle by pentaho.

the class UIRepositoryObjectAclsTest method createObjectAce.

private ObjectAce createObjectAce(String recipientName) {
    ObjectRecipient objectRecipient = new RepositoryObjectRecipient(recipientName, ObjectRecipient.Type.USER);
    ObjectAce objectAce = new RepositoryObjectAce(objectRecipient, EnumSet.of(RepositoryFilePermission.READ, RepositoryFilePermission.WRITE));
    return objectAce;
}
Also used : ObjectRecipient(org.pentaho.di.repository.ObjectRecipient) RepositoryObjectRecipient(org.pentaho.di.repository.pur.model.RepositoryObjectRecipient) RepositoryObjectRecipient(org.pentaho.di.repository.pur.model.RepositoryObjectRecipient) ObjectAce(org.pentaho.di.repository.pur.model.ObjectAce) RepositoryObjectAce(org.pentaho.di.repository.pur.model.RepositoryObjectAce) RepositoryObjectAce(org.pentaho.di.repository.pur.model.RepositoryObjectAce)

Example 12 with RepositoryObjectRecipient

use of org.pentaho.di.repository.pur.model.RepositoryObjectRecipient in project pentaho-kettle by pentaho.

the class UIRepositoryObjectAclsTest method beforeTest.

@Before
public void beforeTest() {
    repositoryObjectAcls = new UIRepositoryObjectAcls();
    repObjectAcl = new RepositoryObjectAcl(new RepositoryObjectRecipient(RECIPIENT0, Type.ROLE));
    // The fact that the next line is needed to avoid an NPE on many of the methods, ( from doing an addAll(null) ),
    // might indicate a bug but I'm not comfortable fixing it at this time since something might depend
    // on UIRepositoryObjectAcls.getAcls() delivering null rather than an empty list.
    repositoryObjectAcls.setObjectAcl(repObjectAcl);
    objectAcl1 = new UIRepositoryObjectAcl(createObjectAce(RECIPIENT1));
    objectAcl2 = new UIRepositoryObjectAcl(createObjectAce(RECIPIENT2));
    objectAcl3 = new UIRepositoryObjectAcl(createObjectAce(RECIPIENT3));
}
Also used : RepositoryObjectAcl(org.pentaho.di.repository.pur.model.RepositoryObjectAcl) RepositoryObjectRecipient(org.pentaho.di.repository.pur.model.RepositoryObjectRecipient) Before(org.junit.Before)

Example 13 with RepositoryObjectRecipient

use of org.pentaho.di.repository.pur.model.RepositoryObjectRecipient in project pentaho-kettle by pentaho.

the class UIRepositoryObjectAclsTest method testBooleanFlags.

@Test
public void testBooleanFlags() {
    List<UIRepositoryObjectAcl> originalUIAcls = Arrays.asList(new UIRepositoryObjectAcl[] { objectAcl1, objectAcl2, objectAcl3 });
    UIRepositoryObjectAcls repositoryObjectAcls = new UIRepositoryObjectAcls();
    repositoryObjectAcls.setObjectAcl(new RepositoryObjectAcl(new RepositoryObjectRecipient(RECIPIENT1, Type.USER)));
    assertFalse(repositoryObjectAcls.isModelDirty());
    assertFalse(repositoryObjectAcls.isRemoveEnabled());
    assertFalse(repositoryObjectAcls.hasManageAclAccess());
    assertTrue(repositoryObjectAcls.isEntriesInheriting());
    repositoryObjectAcls.addAcls(originalUIAcls);
    assertTrue(repositoryObjectAcls.isModelDirty());
    assertTrue(repositoryObjectAcls.isEntriesInheriting());
    assertFalse(repositoryObjectAcls.isRemoveEnabled());
    repositoryObjectAcls.setRemoveEnabled(true);
    assertTrue(repositoryObjectAcls.isRemoveEnabled());
    repositoryObjectAcls.setModelDirty(true);
    assertTrue(repositoryObjectAcls.isModelDirty());
    assertTrue(repositoryObjectAcls.isRemoveEnabled());
    assertTrue(repositoryObjectAcls.isEntriesInheriting());
    repositoryObjectAcls.setModelDirty(false);
    assertFalse(repositoryObjectAcls.isModelDirty());
    assertTrue(repositoryObjectAcls.isEntriesInheriting());
    repositoryObjectAcls.setEntriesInheriting(true);
    assertFalse(repositoryObjectAcls.isModelDirty());
    assertTrue(repositoryObjectAcls.isEntriesInheriting());
    repositoryObjectAcls.setEntriesInheriting(false);
    assertTrue(repositoryObjectAcls.isModelDirty());
    assertFalse(repositoryObjectAcls.isRemoveEnabled());
    assertFalse(repositoryObjectAcls.isEntriesInheriting());
    repositoryObjectAcls.setHasManageAclAccess(true);
    assertTrue(repositoryObjectAcls.hasManageAclAccess());
}
Also used : RepositoryObjectAcl(org.pentaho.di.repository.pur.model.RepositoryObjectAcl) RepositoryObjectRecipient(org.pentaho.di.repository.pur.model.RepositoryObjectRecipient) Test(org.junit.Test)

Aggregations

RepositoryObjectRecipient (org.pentaho.di.repository.pur.model.RepositoryObjectRecipient)13 ObjectRecipient (org.pentaho.di.repository.ObjectRecipient)8 RepositoryObjectAce (org.pentaho.di.repository.pur.model.RepositoryObjectAce)7 RepositoryObjectAcl (org.pentaho.di.repository.pur.model.RepositoryObjectAcl)7 Test (org.junit.Test)6 ObjectAce (org.pentaho.di.repository.pur.model.ObjectAce)6 ObjectAcl (org.pentaho.di.repository.pur.model.ObjectAcl)5 KettleException (org.pentaho.di.core.exception.KettleException)4 ObjectId (org.pentaho.di.repository.ObjectId)3 AccessDeniedException (org.pentaho.di.ui.repository.repositoryexplorer.AccessDeniedException)3 ArrayList (java.util.ArrayList)2 Before (org.junit.Before)2 Ignore (org.junit.Ignore)1 JobMeta (org.pentaho.di.job.JobMeta)1 IAclService (org.pentaho.di.ui.repository.pur.services.IAclService)1 RepositoryFileAce (org.pentaho.platform.api.repository2.unified.RepositoryFileAce)1 RepositoryFileAcl (org.pentaho.platform.api.repository2.unified.RepositoryFileAcl)1 RepositoryFilePermission (org.pentaho.platform.api.repository2.unified.RepositoryFilePermission)1 RepositoryFileSid (org.pentaho.platform.api.repository2.unified.RepositoryFileSid)1