Search in sources :

Example 6 with OwnerAccessControlEntry

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

the class OwnerAccessControlEntryManagerTest method testUpdate.

@Test
public void testUpdate() {
    OwnerAccessControlEntryEntity entity = create("user", "domain", "interfaceName", TrustLevel.HIGH, TrustLevel.LOW, "operation", Permission.ASK);
    entityManager.persist(entity);
    flushAndClear();
    OwnerAccessControlEntry updateData = new OwnerAccessControlEntry("user", "domain", "interfaceName", TrustLevel.MID, TrustLevel.HIGH, "operation", Permission.YES);
    CreateOrUpdateResult<OwnerAccessControlEntry> result = subject.createOrUpdate(updateData);
    assertNotNull(result);
    assertEquals(ChangeType.UPDATE, result.getChangeType());
    assertNotNull(result.getEntry());
    assertEquals("user", result.getEntry().getUid());
    flushAndClear();
    entity = entityManager.find(OwnerAccessControlEntryEntity.class, entity.getId());
    assertNotNull(entity);
    assertEquals(TrustLevel.MID, entity.getRequiredTrustLevel());
    assertEquals(TrustLevel.HIGH, entity.getRequiredAceChangeTrustLevel());
    assertEquals(Permission.YES, entity.getConsumerPermission());
}
Also used : OwnerAccessControlEntryEntity(io.joynr.accesscontrol.global.jee.persistence.OwnerAccessControlEntryEntity) OwnerAccessControlEntry(joynr.infrastructure.DacTypes.OwnerAccessControlEntry) Test(org.junit.Test)

Example 7 with OwnerAccessControlEntry

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

the class DomainAccessControlStoreTest method testGetWildcardUser.

@Test
public void testGetWildcardUser() throws Exception {
    OwnerAccessControlEntry expectedOwnerAccessControlEntryWildcard = new OwnerAccessControlEntry(WILDCARD, DOMAIN1, INTERFACEX, TrustLevel.HIGH, TrustLevel.HIGH, OPERATIONX, Permission.YES);
    store.updateOwnerAccessControlEntry(expectedOwnerAccessControlEntryWildcard);
    assertTrue("Exactly one owner ACE for WILDCARD user should be in Owner ACL", store.getOwnerAccessControlEntries(WILDCARD).size() == 1);
    assertTrue("In case no USER2_ID ACE found, WILDCARD user ACE should be returned", store.getOwnerAccessControlEntries(UID2).get(0).getUid().equals(WILDCARD));
    assertTrue("Uid of returned owner ACEs associated to DOMAIN1 and INTERFACEX should be WILDCARD", store.getOwnerAccessControlEntries(DOMAIN1, INTERFACEX).get(0).getUid().equals(WILDCARD));
}
Also used : OwnerAccessControlEntry(joynr.infrastructure.DacTypes.OwnerAccessControlEntry) Test(org.junit.Test)

Example 8 with OwnerAccessControlEntry

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

the class DomainAccessControlStoreTest method setup.

@Before
public void setup() {
    // instantiate some template objects
    expectedUserDomainRoleEntry = new DomainRoleEntry(UID1, new String[0], Role.OWNER);
    expectedMasterAccessControlEntry = new MasterAccessControlEntry(UID1, DOMAIN1, INTERFACE1, TrustLevel.LOW, new TrustLevel[] { TrustLevel.MID, TrustLevel.LOW }, TrustLevel.LOW, new TrustLevel[] { TrustLevel.MID, TrustLevel.LOW }, OPERATION1, Permission.NO, new Permission[] { Permission.ASK, Permission.NO });
    expectedOwnerAccessControlEntry = new OwnerAccessControlEntry(UID1, DOMAIN1, INTERFACE1, TrustLevel.LOW, TrustLevel.LOW, OPERATION1, Permission.NO);
}
Also used : MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry) TrustLevel(joynr.infrastructure.DacTypes.TrustLevel) OwnerAccessControlEntry(joynr.infrastructure.DacTypes.OwnerAccessControlEntry) DomainRoleEntry(joynr.infrastructure.DacTypes.DomainRoleEntry) Permission(joynr.infrastructure.DacTypes.Permission) Before(org.junit.Before)

Example 9 with OwnerAccessControlEntry

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

the class GlobalDomainAccessStoreAdminEhCache method getAllOwnerAclEntries.

@Override
public List<OwnerAccessControlEntry> getAllOwnerAclEntries() {
    List<OwnerAccessControlEntry> result = new ArrayList<OwnerAccessControlEntry>();
    Cache aclCache = getCache(CacheId.OWNER_ACL);
    Map<Object, Element> aclMap = aclCache.getAll(aclCache.getKeys());
    Iterator<Map.Entry<Object, Element>> iterator = aclMap.entrySet().iterator();
    while (iterator.hasNext()) {
        Map.Entry<Object, Element> thisMapEntry = iterator.next();
        Element thisElement = thisMapEntry.getValue();
        OwnerAccessControlEntry objectValue = getElementValue(thisElement);
        result.add(objectValue);
    }
    return result;
}
Also used : DomainRoleEntry(joynr.infrastructure.DacTypes.DomainRoleEntry) MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry) OwnerAccessControlEntry(joynr.infrastructure.DacTypes.OwnerAccessControlEntry) OwnerAccessControlEntry(joynr.infrastructure.DacTypes.OwnerAccessControlEntry) Element(net.sf.ehcache.Element) ArrayList(java.util.ArrayList) Map(java.util.Map) DomainAccessControlStoreEhCache(io.joynr.accesscontrol.DomainAccessControlStoreEhCache) Cache(net.sf.ehcache.Cache)

Example 10 with OwnerAccessControlEntry

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

the class AccessControllerEnd2EndTest method sendProvisionedEntriesToGDAC.

private void sendProvisionedEntriesToGDAC(List<DomainRoleEntry> domainRoleEntries, List<MasterAccessControlEntry> masterAccessControlEntries, List<MasterAccessControlEntry> mediatorAccessControlEntries, List<OwnerAccessControlEntry> ownerAccessControlEntries) {
    DiscoveryQos discoveryQos = new DiscoveryQos();
    discoveryQos.setDiscoveryScope(DiscoveryScope.GLOBAL_ONLY);
    discoveryQos.setArbitrationStrategy(ArbitrationStrategy.HighestPriority);
    discoveryQos.setDiscoveryTimeoutMs(DISCOVERY_TIMEOUT);
    MessagingQos messagingQos = new MessagingQos();
    messagingQos.setTtl_ms(MESSAGING_TTL);
    GlobalDomainAccessControlListEditorProxy gdacListEditorProxy = runtime.getProxyBuilder(GDAC_DOMAIN, GlobalDomainAccessControlListEditorProxy.class).setDiscoveryQos(discoveryQos).setMessagingQos(messagingQos).build();
    GlobalDomainRoleControllerProxy gdrcProxy = runtime.getProxyBuilder(GDAC_DOMAIN, GlobalDomainRoleControllerProxy.class).setDiscoveryQos(discoveryQos).setMessagingQos(messagingQos).build();
    for (DomainRoleEntry entry : domainRoleEntries) {
        assertTrue(gdrcProxy.updateDomainRole(entry));
    }
    for (MasterAccessControlEntry entry : masterAccessControlEntries) {
        assertTrue(gdacListEditorProxy.updateMasterAccessControlEntry(entry));
    }
    for (MasterAccessControlEntry entry : mediatorAccessControlEntries) {
        assertTrue(gdacListEditorProxy.updateMediatorAccessControlEntry(entry));
    }
    for (OwnerAccessControlEntry entry : ownerAccessControlEntries) {
        assertTrue(gdacListEditorProxy.updateOwnerAccessControlEntry(entry));
    }
}
Also used : MessagingQos(io.joynr.messaging.MessagingQos) GlobalDomainAccessControlListEditorProxy(joynr.infrastructure.GlobalDomainAccessControlListEditorProxy) MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry) OwnerAccessControlEntry(joynr.infrastructure.DacTypes.OwnerAccessControlEntry) DomainRoleEntry(joynr.infrastructure.DacTypes.DomainRoleEntry) GlobalDomainRoleControllerProxy(joynr.infrastructure.GlobalDomainRoleControllerProxy) DiscoveryQos(io.joynr.arbitration.DiscoveryQos)

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