use of joynr.infrastructure.DacTypes.MasterAccessControlEntry in project joynr by bmwcarit.
the class GlobalDomainAccessControlListEditorBean method updateMasterAccessControlEntry.
@Override
public Boolean updateMasterAccessControlEntry(MasterAccessControlEntry updatedMasterAce) {
CreateOrUpdateResult<MasterAccessControlEntry> result = masterAccessControlEntryManager.createOrUpdate(updatedMasterAce, MASTER);
if (result != null) {
MasterAccessControlEntry persistedAce = result.getEntry();
globalDomainAccessControllerBean.doFireMasterAccessControlEntryChanged(result.getChangeType(), persistedAce);
return true;
}
return false;
}
use of joynr.infrastructure.DacTypes.MasterAccessControlEntry in project joynr by bmwcarit.
the class MasterAccessControlEntryManager method findByUserIdThatAreEditable.
public MasterAccessControlEntry[] findByUserIdThatAreEditable(String userId, ControlEntryType type) {
Query query = entityManager.createQuery("select mace from MasterAccessControlEntryEntity mace, " + "DomainRoleEntryEntity dre, in(dre.domains) dds where mace.userId = :userId and mace.type = :type " + "and mace.domain = dds and dre.userId = :userId and dre.role = :role");
query.setParameter("userId", userId);
query.setParameter("type", type);
query.setParameter("role", Role.MASTER);
List<MasterAccessControlEntryEntity> resultList = query.getResultList();
Set<MasterAccessControlEntry> resultSet = resultList.stream().map(this::mapEntityToJoynrType).collect(toSet());
return resultSet.toArray(new MasterAccessControlEntry[resultSet.size()]);
}
use of joynr.infrastructure.DacTypes.MasterAccessControlEntry in project joynr by bmwcarit.
the class MasterAccessControlEntryManager method findByUserId.
public MasterAccessControlEntry[] findByUserId(String userId, ControlEntryType type) {
Query query = entityManager.createQuery("select mace from MasterAccessControlEntryEntity mace where mace.userId = :userId and mace.type = :type", MasterAccessControlEntryEntity.class);
query.setParameter("userId", userId);
query.setParameter("type", type);
List<MasterAccessControlEntryEntity> resultList = query.getResultList();
Set<MasterAccessControlEntry> resultSet = resultList.stream().map(this::mapEntityToJoynrType).collect(toSet());
return resultSet.toArray(new MasterAccessControlEntry[resultSet.size()]);
}
use of joynr.infrastructure.DacTypes.MasterAccessControlEntry 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.MasterAccessControlEntry 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