Search in sources :

Example 6 with RepositoryObjectAcl

use of org.pentaho.di.repository.pur.model.RepositoryObjectAcl 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 7 with RepositoryObjectAcl

use of org.pentaho.di.repository.pur.model.RepositoryObjectAcl 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

RepositoryObjectAcl (org.pentaho.di.repository.pur.model.RepositoryObjectAcl)7 RepositoryObjectRecipient (org.pentaho.di.repository.pur.model.RepositoryObjectRecipient)7 Test (org.junit.Test)4 KettleException (org.pentaho.di.core.exception.KettleException)4 ObjectRecipient (org.pentaho.di.repository.ObjectRecipient)4 ObjectAcl (org.pentaho.di.repository.pur.model.ObjectAcl)4 ObjectId (org.pentaho.di.repository.ObjectId)3 AccessDeniedException (org.pentaho.di.ui.repository.repositoryexplorer.AccessDeniedException)3 Before (org.junit.Before)2 ArrayList (java.util.ArrayList)1 ObjectAce (org.pentaho.di.repository.pur.model.ObjectAce)1 RepositoryObjectAce (org.pentaho.di.repository.pur.model.RepositoryObjectAce)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