Search in sources :

Example 1 with OwnerAccessControlEntry

use of joynr.infrastructure.DacTypes.OwnerAccessControlEntry in project joynr by bmwcarit.

the class AccessControlAlgorithmTest method setup.

@Before
public void setup() {
    this.accessControlAlgorithm = new AccessControlAlgorithm();
    masterAce = new MasterAccessControlEntry(UID, DOMAIN, INTERFACE, TrustLevel.LOW, allTrustLevels, TrustLevel.LOW, allTrustLevels, null, Permission.NO, allPermissions);
    mediatorAce = new MasterAccessControlEntry(UID, DOMAIN, INTERFACE, TrustLevel.LOW, allTrustLevels, TrustLevel.LOW, allTrustLevels, null, Permission.NO, allPermissions);
    ownerAce = new OwnerAccessControlEntry(UID, DOMAIN, INTERFACE, TrustLevel.LOW, TrustLevel.LOW, null, Permission.NO);
}
Also used : MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry) OwnerAccessControlEntry(joynr.infrastructure.DacTypes.OwnerAccessControlEntry) Before(org.junit.Before)

Example 2 with OwnerAccessControlEntry

use of joynr.infrastructure.DacTypes.OwnerAccessControlEntry in project joynr by bmwcarit.

the class GlobalDomainAccessControlListEditorBean method updateOwnerAccessControlEntry.

@Override
public Boolean updateOwnerAccessControlEntry(OwnerAccessControlEntry updatedOwnerAce) {
    CreateOrUpdateResult<OwnerAccessControlEntry> result = ownerAccessControlEntryManager.createOrUpdate(updatedOwnerAce);
    if (result != null) {
        OwnerAccessControlEntry entry = result.getEntry();
        globalDomainAccessControllerBean.doFireOwnerAccessControlEntryChanged(result.getChangeType(), entry);
        return true;
    }
    return false;
}
Also used : OwnerAccessControlEntry(joynr.infrastructure.DacTypes.OwnerAccessControlEntry)

Example 3 with OwnerAccessControlEntry

use of joynr.infrastructure.DacTypes.OwnerAccessControlEntry in project joynr by bmwcarit.

the class GlobalDomainAccessControlListEditorBeanTest method testCreateOwnerAccessControlEntry.

@Test
public void testCreateOwnerAccessControlEntry() {
    OwnerAccessControlEntry oace = new OwnerAccessControlEntry(USER_ID, DOMAIN, INTERFACE_NAME, TrustLevel.HIGH, TrustLevel.LOW, OPERATION, Permission.YES);
    CreateOrUpdateResult<OwnerAccessControlEntry> createResult = new CreateOrUpdateResult<>(oace, ChangeType.ADD);
    when(ownerAccessControlEntryManagerMock.createOrUpdate(oace)).thenReturn(createResult);
    Boolean result = globalDomainAccessControlListEditorSubject.updateOwnerAccessControlEntry(oace);
    assertEquals(Boolean.TRUE, result);
    verify(ownerAccessControlEntryManagerMock).createOrUpdate(eq(oace));
    verify(globalDomainAccessControllerBeanMock).doFireOwnerAccessControlEntryChanged(eq(ChangeType.ADD), eq(oace));
}
Also used : OwnerAccessControlEntry(joynr.infrastructure.DacTypes.OwnerAccessControlEntry) Test(org.junit.Test)

Example 4 with OwnerAccessControlEntry

use of joynr.infrastructure.DacTypes.OwnerAccessControlEntry in project joynr by bmwcarit.

the class GlobalDomainAccessControlListEditorBeanTest method testUpdateOwnerAccessControlEntry.

@Test
public void testUpdateOwnerAccessControlEntry() {
    OwnerAccessControlEntry oace = new OwnerAccessControlEntry(USER_ID, DOMAIN, INTERFACE_NAME, TrustLevel.HIGH, TrustLevel.LOW, OPERATION, Permission.YES);
    CreateOrUpdateResult<OwnerAccessControlEntry> createResult = new CreateOrUpdateResult<>(oace, ChangeType.UPDATE);
    when(ownerAccessControlEntryManagerMock.createOrUpdate(oace)).thenReturn(createResult);
    Boolean result = globalDomainAccessControlListEditorSubject.updateOwnerAccessControlEntry(oace);
    assertEquals(Boolean.TRUE, result);
    verify(ownerAccessControlEntryManagerMock).createOrUpdate(eq(oace));
    verify(globalDomainAccessControllerBeanMock).doFireOwnerAccessControlEntryChanged(eq(ChangeType.UPDATE), eq(oace));
}
Also used : OwnerAccessControlEntry(joynr.infrastructure.DacTypes.OwnerAccessControlEntry) Test(org.junit.Test)

Example 5 with OwnerAccessControlEntry

use of joynr.infrastructure.DacTypes.OwnerAccessControlEntry in project joynr by bmwcarit.

the class OwnerAccessControlEntryManagerTest method testRemoveNotAllowed.

@Test
public void testRemoveNotAllowed() {
    String userId = "userId";
    String domain = "domain";
    String interfaceName = "interfaceName";
    String operation = "operation";
    OwnerAccessControlEntryEntity entity = create(userId, domain, interfaceName, TrustLevel.MID, TrustLevel.HIGH, operation, Permission.YES);
    flushAndClear();
    OwnerAccessControlEntry result = null;
    JoynrJeeMessageContext.getInstance().activate();
    try {
        joynrCallingPrincipal.setUsername(userId);
        result = subject.removeByUserIdDomainInterfaceNameAndOperation(userId, domain, interfaceName, operation);
    } finally {
        JoynrJeeMessageContext.getInstance().deactivate();
    }
    assertNull(result);
    flushAndClear();
    OwnerAccessControlEntryEntity persisted = entityManager.find(OwnerAccessControlEntryEntity.class, entity.getId());
    assertNotNull(persisted);
}
Also used : OwnerAccessControlEntryEntity(io.joynr.accesscontrol.global.jee.persistence.OwnerAccessControlEntryEntity) OwnerAccessControlEntry(joynr.infrastructure.DacTypes.OwnerAccessControlEntry) Test(org.junit.Test)

Aggregations

OwnerAccessControlEntry (joynr.infrastructure.DacTypes.OwnerAccessControlEntry)21 MasterAccessControlEntry (joynr.infrastructure.DacTypes.MasterAccessControlEntry)9 Test (org.junit.Test)9 DomainRoleEntry (joynr.infrastructure.DacTypes.DomainRoleEntry)6 Before (org.junit.Before)5 Permission (joynr.infrastructure.DacTypes.Permission)4 TrustLevel (joynr.infrastructure.DacTypes.TrustLevel)4 OwnerAccessControlEntryEntity (io.joynr.accesscontrol.global.jee.persistence.OwnerAccessControlEntryEntity)3 DomainRoleEntryEntity (io.joynr.accesscontrol.global.jee.persistence.DomainRoleEntryEntity)2 DiscoveryQos (io.joynr.arbitration.DiscoveryQos)2 MessagingQos (io.joynr.messaging.MessagingQos)2 ArrayList (java.util.ArrayList)2 DomainAccessControlStoreEhCache (io.joynr.accesscontrol.DomainAccessControlStoreEhCache)1 Promise (io.joynr.provider.Promise)1 ProxyBuilderFactoryImpl (io.joynr.proxy.ProxyBuilderFactoryImpl)1 Map (java.util.Map)1 Set (java.util.Set)1 GlobalDomainAccessControlListEditorProxy (joynr.infrastructure.GlobalDomainAccessControlListEditorProxy)1 GlobalDomainRoleControllerProxy (joynr.infrastructure.GlobalDomainRoleControllerProxy)1 GlobalDiscoveryEntry (joynr.types.GlobalDiscoveryEntry)1