Search in sources :

Example 6 with OwnerAccessControlEntryEntity

use of io.joynr.accesscontrol.global.jee.persistence.OwnerAccessControlEntryEntity in project joynr by bmwcarit.

the class OwnerAccessControlEntryManagerTest method testRemove.

@Test
public void testRemove() {
    String userId = "userId";
    String domain = "domain";
    String interfaceName = "interfaceName";
    String operation = "operation";
    OwnerAccessControlEntryEntity entity = create(userId, domain, interfaceName, TrustLevel.MID, TrustLevel.HIGH, operation, Permission.YES);
    flushAndClear();
    assertNotNull(subject.removeByUserIdDomainInterfaceNameAndOperation(userId, domain, interfaceName, operation));
    flushAndClear();
    OwnerAccessControlEntryEntity persisted = entityManager.find(OwnerAccessControlEntryEntity.class, entity.getId());
    assertNull(persisted);
}
Also used : OwnerAccessControlEntryEntity(io.joynr.accesscontrol.global.jee.persistence.OwnerAccessControlEntryEntity) Test(org.junit.Test)

Example 7 with OwnerAccessControlEntryEntity

use of io.joynr.accesscontrol.global.jee.persistence.OwnerAccessControlEntryEntity 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;
}
Also used : OwnerAccessControlEntryEntity(io.joynr.accesscontrol.global.jee.persistence.OwnerAccessControlEntryEntity) OwnerAccessControlEntry(joynr.infrastructure.DacTypes.OwnerAccessControlEntry)

Aggregations

OwnerAccessControlEntryEntity (io.joynr.accesscontrol.global.jee.persistence.OwnerAccessControlEntryEntity)7 OwnerAccessControlEntry (joynr.infrastructure.DacTypes.OwnerAccessControlEntry)3 Test (org.junit.Test)3 JoynrIllegalStateException (io.joynr.exceptions.JoynrIllegalStateException)1 Query (javax.persistence.Query)1