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;
}
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);
}
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);
}
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);
}
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);
}
Aggregations