Search in sources :

Example 31 with MasterAccessControlEntry

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

the class MasterAccessControlEntryManagerTest method testUserNotAllowedToCreateOrUpdate.

@Test
public void testUserNotAllowedToCreateOrUpdate() {
    String userId = "user";
    String domain = "domain";
    DomainRoleEntryEntity domainRoleEntryEntity = new DomainRoleEntryEntity();
    domainRoleEntryEntity.setUserId(userId);
    domainRoleEntryEntity.setRole(Role.OWNER);
    domainRoleEntryEntity.setDomains(Sets.newHashSet(domain));
    entityManager.persist(domainRoleEntryEntity);
    create(userId, domain, "interfaceName", TrustLevel.HIGH, new TrustLevel[0], TrustLevel.LOW, new TrustLevel[0], "operation", Permission.YES, new Permission[0]);
    flushAndClear();
    MasterAccessControlEntry updatedData = new MasterAccessControlEntry(userId, domain, "interfaceName", TrustLevel.LOW, new TrustLevel[] { TrustLevel.HIGH }, TrustLevel.HIGH, new TrustLevel[0], "operation", Permission.ASK, new Permission[] { Permission.NO });
    CreateOrUpdateResult<MasterAccessControlEntry> result = null;
    JoynrJeeMessageContext.getInstance().activate();
    try {
        joynrCallingPrincipal.setUsername(userId);
        result = subject.createOrUpdate(updatedData, ControlEntryType.MASTER);
    } finally {
        JoynrJeeMessageContext.getInstance().deactivate();
    }
    assertNull(result);
}
Also used : DomainRoleEntryEntity(io.joynr.accesscontrol.global.jee.persistence.DomainRoleEntryEntity) MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry) Test(org.junit.Test)

Example 32 with MasterAccessControlEntry

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

the class GlobalDomainAccessControlListEditorProviderImpl method removeMediatorAccessControlEntry.

@Override
public Promise<RemoveMediatorAccessControlEntryDeferred> removeMediatorAccessControlEntry(String uid, String domain, String interfaceName, String operation) {
    RemoveMediatorAccessControlEntryDeferred deferred = new RemoveMediatorAccessControlEntryDeferred();
    boolean removeSuccess = domainAccessStore.removeMediatorAccessControlEntry(uid, domain, interfaceName, operation);
    if (removeSuccess) {
        MasterAccessControlEntry removedEntry = new MasterAccessControlEntry(uid, domain, interfaceName, null, null, null, null, operation, null, null);
        domainAccessControllerProvider.fireMediatorAccessControlEntryChanged(ChangeType.REMOVE, removedEntry);
    }
    deferred.resolve(removeSuccess);
    return new Promise<RemoveMediatorAccessControlEntryDeferred>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry)

Example 33 with MasterAccessControlEntry

use of joynr.infrastructure.DacTypes.MasterAccessControlEntry 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 34 with MasterAccessControlEntry

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

the class MyGpsProviderApplication method provisionAccessControl.

private static void provisionAccessControl(Properties properties, String domain) throws Exception {
    ObjectMapper objectMapper = new ObjectMapper();
    objectMapper.enableDefaultTypingAsProperty(DefaultTyping.JAVA_LANG_OBJECT, "_typeName");
    MasterAccessControlEntry newMasterAccessControlEntry = new MasterAccessControlEntry("*", domain, ProviderAnnotations.getInterfaceName(MyGpsProvider.class), TrustLevel.LOW, new TrustLevel[] { TrustLevel.LOW }, TrustLevel.LOW, new TrustLevel[] { TrustLevel.LOW }, "*", Permission.YES, new Permission[] { Permission.YES });
    MasterAccessControlEntry[] provisionedAccessControlEntries = { newMasterAccessControlEntry };
    String provisionedAccessControlEntriesAsJson = objectMapper.writeValueAsString(provisionedAccessControlEntries);
    properties.setProperty(StaticDomainAccessControlProvisioning.PROPERTY_PROVISIONED_MASTER_ACCESSCONTROLENTRIES, provisionedAccessControlEntriesAsJson);
}
Also used : MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 35 with MasterAccessControlEntry

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

the class MyRadioProviderApplication method provisionAccessControl.

private static void provisionAccessControl(Properties properties, String domain) throws Exception {
    ObjectMapper objectMapper = new ObjectMapper();
    objectMapper.enableDefaultTypingAsProperty(DefaultTyping.JAVA_LANG_OBJECT, "_typeName");
    MasterAccessControlEntry newMasterAccessControlEntry = new MasterAccessControlEntry("*", domain, ProviderAnnotations.getInterfaceName(MyRadioProvider.class), TrustLevel.LOW, new TrustLevel[] { TrustLevel.LOW }, TrustLevel.LOW, new TrustLevel[] { TrustLevel.LOW }, "*", Permission.YES, new Permission[] { Permission.YES });
    MasterAccessControlEntry[] provisionedAccessControlEntries = { newMasterAccessControlEntry };
    String provisionedAccessControlEntriesAsJson = objectMapper.writeValueAsString(provisionedAccessControlEntries);
    properties.setProperty(StaticDomainAccessControlProvisioning.PROPERTY_PROVISIONED_MASTER_ACCESSCONTROLENTRIES, provisionedAccessControlEntriesAsJson);
}
Also used : MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

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