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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations