use of com.haulmont.cuba.core.app.ConfigStorageService in project cuba by cuba-platform.
the class NonEntityQueryTest method testIdentificationVariableDeniedSecurity.
@Test
public void testIdentificationVariableDeniedSecurity() throws Exception {
ConfigStorageService configStorageService = AppBeans.get(ConfigStorageService.class);
configStorageService.setDbProperty("cuba.disableLoadValuesIfConstraints", "true");
LoginWorker lw = AppBeans.get(LoginWorker.NAME);
UserSession userSession = lw.login(USER_NAME_1, passwordEncryption.getPlainHash(USER_PASSWORD), Locale.getDefault());
assertNotNull(userSession);
UserSessionSource uss = AppBeans.get(UserSessionSource.class);
UserSession savedUserSession = uss.getUserSession();
((TestUserSessionSource) uss).setUserSession(userSession);
try {
ValueLoadContext context = ValueLoadContext.create();
context.setQueryString("select s from sys$EntitySnapshot s");
context.addProperty("snapshot");
List result = dataManager.secure().loadValues(context);
assertTrue(result.isEmpty());
} finally {
((TestUserSessionSource) uss).setUserSession(savedUserSession);
}
}
Aggregations