Search in sources :

Example 6 with ListQueryParameterObject

use of org.camunda.bpm.engine.impl.db.ListQueryParameterObject in project camunda-bpm-platform by camunda.

the class AuthorizationCheckRevokesCfgTest method shouldCheckDbForCfgCaseInsensitive.

@Test
public void shouldCheckDbForCfgCaseInsensitive() {
    final ListQueryParameterObject query = new ListQueryParameterObject();
    final AuthorizationCheck authCheck = query.getAuthCheck();
    final HashMap<String, Object> expectedQueryParams = new HashMap<String, Object>();
    expectedQueryParams.put("userId", AUTHENTICATED_USER_ID);
    expectedQueryParams.put("authGroupIds", AUTHENTICATED_GROUPS);
    // given
    when(mockedConfiguration.getAuthorizationCheckRevokes()).thenReturn("AuTo");
    when(mockedEntityManager.selectBoolean(eq("selectRevokeAuthorization"), eq(expectedQueryParams))).thenReturn(true);
    // if
    authorizationManager.configureQuery(query);
    // then
    assertEquals(true, authCheck.isRevokeAuthorizationCheckEnabled());
    verify(mockedEntityManager, times(1)).selectBoolean(eq("selectRevokeAuthorization"), eq(expectedQueryParams));
}
Also used : ListQueryParameterObject(org.camunda.bpm.engine.impl.db.ListQueryParameterObject) HashMap(java.util.HashMap) ListQueryParameterObject(org.camunda.bpm.engine.impl.db.ListQueryParameterObject) AuthorizationCheck(org.camunda.bpm.engine.impl.db.AuthorizationCheck) Test(org.junit.Test)

Example 7 with ListQueryParameterObject

use of org.camunda.bpm.engine.impl.db.ListQueryParameterObject in project camunda-bpm-platform by camunda.

the class AuthorizationCheckRevokesCfgTest method shouldUseCfgValue_never.

@Test
public void shouldUseCfgValue_never() {
    final ListQueryParameterObject query = new ListQueryParameterObject();
    final AuthorizationCheck authCheck = query.getAuthCheck();
    // given
    when(mockedConfiguration.getAuthorizationCheckRevokes()).thenReturn(ProcessEngineConfiguration.AUTHORIZATION_CHECK_REVOKE_NEVER);
    // if
    authorizationManager.configureQuery(query);
    // then
    assertEquals(false, authCheck.isRevokeAuthorizationCheckEnabled());
    verify(mockedEntityManager, never()).selectBoolean(eq("selectRevokeAuthorization"), any());
    verifyNoMoreInteractions(mockedEntityManager);
}
Also used : ListQueryParameterObject(org.camunda.bpm.engine.impl.db.ListQueryParameterObject) AuthorizationCheck(org.camunda.bpm.engine.impl.db.AuthorizationCheck) Test(org.junit.Test)

Example 8 with ListQueryParameterObject

use of org.camunda.bpm.engine.impl.db.ListQueryParameterObject in project camunda-bpm-platform by camunda.

the class TenantManager method configureQuery.

public ListQueryParameterObject configureQuery(Object parameters) {
    ListQueryParameterObject queryObject = new ListQueryParameterObject();
    queryObject.setParameter(parameters);
    return configureQuery(queryObject);
}
Also used : ListQueryParameterObject(org.camunda.bpm.engine.impl.db.ListQueryParameterObject)

Example 9 with ListQueryParameterObject

use of org.camunda.bpm.engine.impl.db.ListQueryParameterObject in project camunda-bpm-platform by camunda.

the class AuthorizationCheckRevokesCfgTest method shouldCacheCheck.

@Test
public void shouldCacheCheck() {
    final ListQueryParameterObject query = new ListQueryParameterObject();
    final AuthorizationCheck authCheck = query.getAuthCheck();
    final HashMap<String, Object> expectedQueryParams = new HashMap<String, Object>();
    expectedQueryParams.put("userId", AUTHENTICATED_USER_ID);
    expectedQueryParams.put("authGroupIds", AUTHENTICATED_GROUPS);
    // given
    when(mockedConfiguration.getAuthorizationCheckRevokes()).thenReturn(ProcessEngineConfiguration.AUTHORIZATION_CHECK_REVOKE_AUTO);
    when(mockedEntityManager.selectBoolean(eq("selectRevokeAuthorization"), eq(expectedQueryParams))).thenReturn(true);
    // if
    authorizationManager.configureQuery(query);
    authorizationManager.configureQuery(query);
    // then
    assertEquals(true, authCheck.isRevokeAuthorizationCheckEnabled());
    verify(mockedEntityManager, times(1)).selectBoolean(eq("selectRevokeAuthorization"), eq(expectedQueryParams));
}
Also used : ListQueryParameterObject(org.camunda.bpm.engine.impl.db.ListQueryParameterObject) HashMap(java.util.HashMap) ListQueryParameterObject(org.camunda.bpm.engine.impl.db.ListQueryParameterObject) AuthorizationCheck(org.camunda.bpm.engine.impl.db.AuthorizationCheck) Test(org.junit.Test)

Example 10 with ListQueryParameterObject

use of org.camunda.bpm.engine.impl.db.ListQueryParameterObject in project camunda-bpm-platform by camunda.

the class AuthorizationCheckRevokesCfgTest method shouldUseCfgValue_always.

@Test
public void shouldUseCfgValue_always() {
    final ListQueryParameterObject query = new ListQueryParameterObject();
    final AuthorizationCheck authCheck = query.getAuthCheck();
    // given
    when(mockedConfiguration.getAuthorizationCheckRevokes()).thenReturn(ProcessEngineConfiguration.AUTHORIZATION_CHECK_REVOKE_ALWAYS);
    // if
    authorizationManager.configureQuery(query);
    // then
    assertEquals(true, authCheck.isRevokeAuthorizationCheckEnabled());
    verifyNoMoreInteractions(mockedEntityManager);
}
Also used : ListQueryParameterObject(org.camunda.bpm.engine.impl.db.ListQueryParameterObject) AuthorizationCheck(org.camunda.bpm.engine.impl.db.AuthorizationCheck) Test(org.junit.Test)

Aggregations

ListQueryParameterObject (org.camunda.bpm.engine.impl.db.ListQueryParameterObject)12 HashMap (java.util.HashMap)6 AuthorizationCheck (org.camunda.bpm.engine.impl.db.AuthorizationCheck)6 Test (org.junit.Test)6 QueryOrderingProperty (org.camunda.bpm.engine.impl.QueryOrderingProperty)3 QueryPropertyImpl (org.camunda.bpm.engine.impl.QueryPropertyImpl)2 List (java.util.List)1 DbEntityManager (org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager)1