Search in sources :

Example 1 with MasterAccessControlEntry

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);
}
Also used : MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry) OwnerAccessControlEntry(joynr.infrastructure.DacTypes.OwnerAccessControlEntry) Before(org.junit.Before)

Example 2 with MasterAccessControlEntry

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);
    }
}
Also used : MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry) ArrayList(java.util.ArrayList) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 3 with MasterAccessControlEntry

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;
}
Also used : MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry)

Example 4 with MasterAccessControlEntry

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;
}
Also used : MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry) TrustLevel(joynr.infrastructure.DacTypes.TrustLevel) Permission(joynr.infrastructure.DacTypes.Permission)

Example 5 with MasterAccessControlEntry

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()]);
}
Also used : MasterAccessControlEntryEntity(io.joynr.accesscontrol.global.jee.persistence.MasterAccessControlEntryEntity) Query(javax.persistence.Query) MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry)

Aggregations

MasterAccessControlEntry (joynr.infrastructure.DacTypes.MasterAccessControlEntry)41 Test (org.junit.Test)14 OwnerAccessControlEntry (joynr.infrastructure.DacTypes.OwnerAccessControlEntry)9 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)8 DomainRoleEntry (joynr.infrastructure.DacTypes.DomainRoleEntry)7 Permission (joynr.infrastructure.DacTypes.Permission)6 TrustLevel (joynr.infrastructure.DacTypes.TrustLevel)6 Before (org.junit.Before)6 MasterAccessControlEntryEntity (io.joynr.accesscontrol.global.jee.persistence.MasterAccessControlEntryEntity)5 ArrayList (java.util.ArrayList)4 Query (javax.persistence.Query)3 DomainRoleEntryEntity (io.joynr.accesscontrol.global.jee.persistence.DomainRoleEntryEntity)2 UserDomainInterfaceOperationKey (io.joynr.accesscontrol.primarykey.UserDomainInterfaceOperationKey)2 DiscoveryQos (io.joynr.arbitration.DiscoveryQos)2 MessagingQos (io.joynr.messaging.MessagingQos)2 Promise (io.joynr.provider.Promise)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 DomainAccessControlStoreEhCache (io.joynr.accesscontrol.DomainAccessControlStoreEhCache)1 ControlEntryType (io.joynr.accesscontrol.global.jee.persistence.ControlEntryType)1 ProxyBuilderFactoryImpl (io.joynr.proxy.ProxyBuilderFactoryImpl)1