use of joynr.infrastructure.DacTypes.MasterAccessControlEntry 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);
}
use of joynr.infrastructure.DacTypes.MasterAccessControlEntry in project joynr by bmwcarit.
the class DefaultJoynrRuntimeFactory method provisionAccessControl.
private void provisionAccessControl(Properties properties, String domain, String[] interfaceNames) {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.enableDefaultTypingAsProperty(DefaultTyping.JAVA_LANG_OBJECT, "_typeName");
List<MasterAccessControlEntry> allEntries = new ArrayList<>();
for (String interfaceName : interfaceNames) {
MasterAccessControlEntry newMasterAccessControlEntry = new MasterAccessControlEntry("*", domain, interfaceName, TrustLevel.LOW, new TrustLevel[] { TrustLevel.LOW }, TrustLevel.LOW, new TrustLevel[] { TrustLevel.LOW }, "*", Permission.YES, new Permission[] { joynr.infrastructure.DacTypes.Permission.YES });
allEntries.add(newMasterAccessControlEntry);
}
MasterAccessControlEntry[] provisionedAccessControlEntries = allEntries.toArray(new MasterAccessControlEntry[allEntries.size()]);
String provisionedAccessControlEntriesAsJson;
try {
provisionedAccessControlEntriesAsJson = objectMapper.writeValueAsString(provisionedAccessControlEntries);
properties.setProperty(StaticDomainAccessControlProvisioning.PROPERTY_PROVISIONED_MASTER_ACCESSCONTROLENTRIES, provisionedAccessControlEntriesAsJson);
} catch (JsonProcessingException e) {
LOG.error("Error parsing JSON.", e);
}
}
use of joynr.infrastructure.DacTypes.MasterAccessControlEntry in project joynr by bmwcarit.
the class GlobalDomainAccessControlListEditorBean method updateMediatorAccessControlEntry.
@Override
public Boolean updateMediatorAccessControlEntry(MasterAccessControlEntry updatedMediatorAce) {
CreateOrUpdateResult<MasterAccessControlEntry> result = masterAccessControlEntryManager.createOrUpdate(updatedMediatorAce, MEDIATOR);
if (result != null) {
MasterAccessControlEntry persistedEntry = result.getEntry();
globalDomainAccessControllerBean.doFireMediatorAccessControlEntryChanged(result.getChangeType(), persistedEntry);
return true;
}
return false;
}
use of joynr.infrastructure.DacTypes.MasterAccessControlEntry in project joynr by bmwcarit.
the class MasterAccessControlEntryManager method mapEntityToJoynrType.
private MasterAccessControlEntry mapEntityToJoynrType(MasterAccessControlEntryEntity entity) {
MasterAccessControlEntry result = new MasterAccessControlEntry();
result.setUid(entity.getUserId());
result.setDomain(entity.getDomain());
result.setInterfaceName(entity.getInterfaceName());
result.setDefaultRequiredTrustLevel(entity.getDefaultRequiredTrustLevel());
result.setPossibleRequiredTrustLevels(entity.getPossibleRequiredTrustLevels().toArray(new TrustLevel[entity.getPossibleRequiredTrustLevels().size()]));
result.setDefaultRequiredControlEntryChangeTrustLevel(entity.getDefaultRequiredControlEntryChangeTrustLevel());
result.setPossibleRequiredControlEntryChangeTrustLevels(entity.getPossibleRequiredControlEntryChangeTrustLevels().toArray(new TrustLevel[entity.getPossibleRequiredControlEntryChangeTrustLevels().size()]));
result.setOperation(entity.getOperation());
result.setDefaultConsumerPermission(entity.getDefaultConsumerPermission());
result.setPossibleConsumerPermissions(entity.getPossibleConsumerPermissions().toArray(new Permission[entity.getPossibleConsumerPermissions().size()]));
return result;
}
use of joynr.infrastructure.DacTypes.MasterAccessControlEntry in project joynr by bmwcarit.
the class MasterAccessControlEntryManager method findByDomainAndInterfaceName.
public MasterAccessControlEntry[] findByDomainAndInterfaceName(String domain, String interfaceName, ControlEntryType type) {
Query query = entityManager.createQuery("select mace from MasterAccessControlEntryEntity mace " + "where mace.domain = :domain and mace.interfaceName = :interfaceName and mace.type = :type", MasterAccessControlEntryEntity.class);
query.setParameter("domain", domain);
query.setParameter("interfaceName", interfaceName);
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()]);
}
Aggregations