Search in sources :

Example 16 with OwnerAccessControlEntry

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

the class OwnerAccessControlEntryManager method removeByUserIdDomainInterfaceNameAndOperation.

public OwnerAccessControlEntry removeByUserIdDomainInterfaceNameAndOperation(String userId, String domain, String interfaceName, String operation) {
    if (!domainRoleEntryManager.hasCurrentUserGotRoleForDomain(Role.MASTER, domain)) {
        return null;
    }
    OwnerAccessControlEntryEntity entity = findByUserIdDomainInterfaceNameAndOperation(userId, domain, interfaceName, operation);
    OwnerAccessControlEntry removedEntry = null;
    if (entity != null) {
        entityManager.remove(entity);
        removedEntry = mapEntityToJoynrType(entity);
    }
    return removedEntry;
}
Also used : OwnerAccessControlEntryEntity(io.joynr.accesscontrol.global.jee.persistence.OwnerAccessControlEntryEntity) OwnerAccessControlEntry(joynr.infrastructure.DacTypes.OwnerAccessControlEntry)

Example 17 with OwnerAccessControlEntry

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

the class DomainAccessControlStoreTest method testGetOwnerAccessControlEntry.

@Test
public void testGetOwnerAccessControlEntry() throws Exception {
    store.updateOwnerAccessControlEntry(expectedOwnerAccessControlEntry);
    assertEquals("Owner ACE for UID1 should be equal to expectedOwnerAccessControlEntry", expectedOwnerAccessControlEntry, store.getOwnerAccessControlEntries(UID1).get(0));
    assertEquals("Owner ACE associated to DOMAIN1 and INTERFACE1 should be the same as expectedOwnerAccessControlEntry", expectedOwnerAccessControlEntry, store.getOwnerAccessControlEntries(DOMAIN1, INTERFACE1).get(0));
    assertEquals("Owner ACE associated to UID1, DOMAIN1 and INTERFACE1 should be the same as expectedOwnerAccessControlEntry", expectedOwnerAccessControlEntry, store.getOwnerAccessControlEntries(UID1, DOMAIN1, INTERFACE1).get(0));
    OwnerAccessControlEntry returnedOwnerAce = store.getOwnerAccessControlEntry(UID1, DOMAIN1, INTERFACE1, OPERATION1);
    assertEquals("Owner ACE associated to UID1, DOMAIN1, INTERFACE1 and OPERATION1 should be the same as expectedOwnerAccessControlEntry", expectedOwnerAccessControlEntry, returnedOwnerAce);
}
Also used : OwnerAccessControlEntry(joynr.infrastructure.DacTypes.OwnerAccessControlEntry) Test(org.junit.Test)

Example 18 with OwnerAccessControlEntry

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

the class AceValidatorTest method setup.

@Before
public void setup() {
    masterAce = new MasterAccessControlEntry(null, null, null, TrustLevel.LOW, new TrustLevel[] { TrustLevel.MID, TrustLevel.LOW }, TrustLevel.LOW, new TrustLevel[] { TrustLevel.MID, TrustLevel.HIGH }, null, Permission.NO, new Permission[] { Permission.ASK, Permission.NO });
    mediatorAce = new MasterAccessControlEntry(null, null, null, TrustLevel.LOW, new TrustLevel[] { TrustLevel.MID, TrustLevel.LOW }, TrustLevel.LOW, new TrustLevel[] { TrustLevel.MID, TrustLevel.HIGH }, null, Permission.NO, new Permission[] { Permission.ASK, Permission.NO });
    ownerAce = new OwnerAccessControlEntry(null, null, null, TrustLevel.MID, TrustLevel.HIGH, null, Permission.ASK);
}
Also used : MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry) TrustLevel(joynr.infrastructure.DacTypes.TrustLevel) OwnerAccessControlEntry(joynr.infrastructure.DacTypes.OwnerAccessControlEntry) Permission(joynr.infrastructure.DacTypes.Permission) Before(org.junit.Before)

Example 19 with OwnerAccessControlEntry

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

the class LocalDomainAccessControllerTest method setup.

@SuppressWarnings("unchecked")
@Before
public void setup() {
    cacheManager = CacheManager.create();
    domainAccessControlStore = new DomainAccessControlStoreEhCache(cacheManager, new DefaultDomainAccessControlProvisioning());
    when(proxyInvocationHandlerFactoryMock.create(any(Set.class), any(String.class), any(String.class), any(DiscoveryQos.class), any(MessagingQos.class))).thenReturn(proxyInvocationHandlerMock);
    GlobalDiscoveryEntry accessControlDomain = mock(GlobalDiscoveryEntry.class);
    when(accessControlDomain.getDomain()).thenReturn("accessControlDomain");
    localDomainAccessController = new LocalDomainAccessControllerImpl(accessControlDomain, domainAccessControlStore, new ProxyBuilderFactoryImpl(localDiscoveryAggregator, proxyInvocationHandlerFactoryMock, MAX_TTL, DISCOVERY_TIMEOUT_MS, RETRY_INTERVAL_MS), "systemServiceDomain");
    // instantiate some template objects
    userDre = new DomainRoleEntry(UID1, new String[] { DOMAIN1 }, Role.OWNER);
    masterAce = new MasterAccessControlEntry(UID1, DOMAIN1, INTERFACE1, TrustLevel.LOW, new TrustLevel[] { TrustLevel.MID, TrustLevel.LOW }, TrustLevel.LOW, new TrustLevel[] { TrustLevel.MID, TrustLevel.LOW }, OPEARATION1, Permission.NO, new Permission[] { Permission.ASK, Permission.NO });
    ownerAce = new OwnerAccessControlEntry(UID1, DOMAIN1, INTERFACE1, TrustLevel.LOW, TrustLevel.LOW, OPEARATION1, Permission.YES);
}
Also used : Set(java.util.Set) ProxyBuilderFactoryImpl(io.joynr.proxy.ProxyBuilderFactoryImpl) GlobalDiscoveryEntry(joynr.types.GlobalDiscoveryEntry) DomainRoleEntry(joynr.infrastructure.DacTypes.DomainRoleEntry) DiscoveryQos(io.joynr.arbitration.DiscoveryQos) MessagingQos(io.joynr.messaging.MessagingQos) MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry) TrustLevel(joynr.infrastructure.DacTypes.TrustLevel) OwnerAccessControlEntry(joynr.infrastructure.DacTypes.OwnerAccessControlEntry) Permission(joynr.infrastructure.DacTypes.Permission) Before(org.junit.Before)

Example 20 with OwnerAccessControlEntry

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

the class LocalDomainAccessControllerImpl method getConsumerPermission.

@Override
public Permission getConsumerPermission(String userId, String domain, String interfaceName, String operation, TrustLevel trustLevel) {
    LOG.debug("getConsumerPermission on domain {}, interface {}", domain, interfaceName);
    MasterAccessControlEntry masterAce;
    MasterAccessControlEntry mediatorAce;
    OwnerAccessControlEntry ownerAce;
    synchronized (localDomainAccessStore) {
        masterAce = localDomainAccessStore.getMasterAccessControlEntry(userId, domain, interfaceName, operation);
        mediatorAce = localDomainAccessStore.getMediatorAccessControlEntry(userId, domain, interfaceName, operation);
        ownerAce = localDomainAccessStore.getOwnerAccessControlEntry(userId, domain, interfaceName, operation);
    }
    return accessControlAlgorithm.getConsumerPermission(masterAce, mediatorAce, ownerAce, trustLevel);
}
Also used : MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry) OwnerAccessControlEntry(joynr.infrastructure.DacTypes.OwnerAccessControlEntry)

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