use of joynr.infrastructure.DacTypes.MasterAccessControlEntry in project joynr by bmwcarit.
the class MasterAccessControlEntryManagerTest method testFindByUserIdAndIsEditable.
@Test
public void testFindByUserIdAndIsEditable() {
String userId = "user";
create(userId, "domain1", "interface1", TrustLevel.HIGH, new TrustLevel[] {}, TrustLevel.LOW, new TrustLevel[] {}, "operation1", Permission.YES, new Permission[] {});
create(userId, "domain2", "interface2", TrustLevel.HIGH, new TrustLevel[] {}, TrustLevel.LOW, new TrustLevel[] {}, "operation2", Permission.YES, new Permission[] {});
DomainRoleEntryEntity role1 = new DomainRoleEntryEntity();
role1.setUserId(userId);
role1.setRole(Role.MASTER);
role1.setDomains(Sets.newHashSet("domain1", "domain4", "domain5"));
entityManager.persist(role1);
flushAndClear();
MasterAccessControlEntry[] result = subject.findByUserIdThatAreEditable(userId, MASTER);
assertNotNull(result);
assertEquals(1, result.length);
assertEquals("domain1", result[0].getDomain());
assertEquals("interface1", result[0].getInterfaceName());
}
use of joynr.infrastructure.DacTypes.MasterAccessControlEntry in project joynr by bmwcarit.
the class GlobalDomainAccessControlListEditorProviderImpl method removeMasterAccessControlEntry.
@Override
public Promise<RemoveMasterAccessControlEntryDeferred> removeMasterAccessControlEntry(String uid, String domain, String interfaceName, String operation) {
RemoveMasterAccessControlEntryDeferred deferred = new RemoveMasterAccessControlEntryDeferred();
boolean removeSuccess = domainAccessStore.removeMasterAccessControlEntry(uid, domain, interfaceName, operation);
if (removeSuccess) {
MasterAccessControlEntry removedEntry = new MasterAccessControlEntry(uid, domain, interfaceName, null, null, null, null, operation, null, null);
domainAccessControllerProvider.fireMasterAccessControlEntryChanged(ChangeType.REMOVE, removedEntry);
}
deferred.resolve(removeSuccess);
return new Promise<RemoveMasterAccessControlEntryDeferred>(deferred);
}
use of joynr.infrastructure.DacTypes.MasterAccessControlEntry in project joynr by bmwcarit.
the class DomainAccessControlStoreEhCache method updateOwnerAccessControlEntry.
@Override
public Boolean updateOwnerAccessControlEntry(OwnerAccessControlEntry updatedOwnerAce) {
boolean updateSuccess = false;
MasterAccessControlEntry masterAce = getMasterAccessControlEntry(updatedOwnerAce.getUid(), updatedOwnerAce.getDomain(), updatedOwnerAce.getInterfaceName(), updatedOwnerAce.getOperation());
MasterAccessControlEntry mediatorAce = getMediatorAccessControlEntry(updatedOwnerAce.getUid(), updatedOwnerAce.getDomain(), updatedOwnerAce.getInterfaceName(), updatedOwnerAce.getOperation());
AceValidator aceValidator = new AceValidator(masterAce, mediatorAce, updatedOwnerAce);
if (aceValidator.isOwnerValid()) {
UserDomainInterfaceOperationKey aceKey = new UserDomainInterfaceOperationKey(updatedOwnerAce.getUid(), updatedOwnerAce.getDomain(), updatedOwnerAce.getInterfaceName(), updatedOwnerAce.getOperation());
updateSuccess = updateAce(updatedOwnerAce, CacheId.OWNER_ACL, aceKey);
}
return updateSuccess;
}
use of joynr.infrastructure.DacTypes.MasterAccessControlEntry in project joynr by bmwcarit.
the class DomainAccessControlStoreEhCache method updateMediatorAccessControlEntry.
@Override
public Boolean updateMediatorAccessControlEntry(MasterAccessControlEntry updatedMediatorAce) {
boolean updateSuccess = false;
MasterAccessControlEntry masterAce = getMasterAccessControlEntry(updatedMediatorAce.getUid(), updatedMediatorAce.getDomain(), updatedMediatorAce.getInterfaceName(), updatedMediatorAce.getOperation());
AceValidator aceValidator = new AceValidator(masterAce, updatedMediatorAce, null);
if (aceValidator.isMediatorValid()) {
UserDomainInterfaceOperationKey aceKey = new UserDomainInterfaceOperationKey(updatedMediatorAce.getUid(), updatedMediatorAce.getDomain(), updatedMediatorAce.getInterfaceName(), updatedMediatorAce.getOperation());
updateSuccess = updateAce(updatedMediatorAce, CacheId.MASTER_ACL, aceKey);
}
return updateSuccess;
}
use of joynr.infrastructure.DacTypes.MasterAccessControlEntry in project joynr by bmwcarit.
the class DomainAccessControlStoreTest method testGetMasterAce.
@Test
public void testGetMasterAce() throws Exception {
store.updateMasterAccessControlEntry(expectedMasterAccessControlEntry);
assertEquals("Master ACE associated to UID1 from Master ACL should be the same as expectedMasterAccessControlEntry", expectedMasterAccessControlEntry, store.getMasterAccessControlEntries(UID1).get(0));
assertEquals("Master ACE associated to DOMAIN1 and INTERFACE1 should be the same as expectedMasterAccessControlEntry", expectedMasterAccessControlEntry, store.getMasterAccessControlEntries(DOMAIN1, INTERFACE1).get(0));
assertEquals("Master ACE associated to UID1, DOMAIN1 and INTERFACE1 should be the same as expectedMasterAccessControlEntry", expectedMasterAccessControlEntry, store.getMasterAccessControlEntries(UID1, DOMAIN1, INTERFACE1).get(0));
MasterAccessControlEntry masterAceWithWildcardOperation = new MasterAccessControlEntry(expectedMasterAccessControlEntry);
masterAceWithWildcardOperation.setOperation(WILDCARD);
store.updateMasterAccessControlEntry(masterAceWithWildcardOperation);
int expectedAceCount = 2;
assertEquals("There are two (2) master ACEs associated to UID1, DOMAIN1 and INTERFACE1", expectedAceCount, store.getMasterAccessControlEntries(UID1, DOMAIN1, INTERFACE1).size());
MasterAccessControlEntry returnedMasterAce = store.getMasterAccessControlEntry(UID1, DOMAIN1, INTERFACE1, OPERATION1);
assertEquals("Master ACE associated to UID1, DOMAIN1, INTERFACE1 and OPERATION1 should be the same as expectedMasterAccessControlEntry", expectedMasterAccessControlEntry, returnedMasterAce);
}
Aggregations