congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
ListQueryParameterObject.getAuthCheck
Code IndexAdd Tabnine to your IDE (free)

How to use
getAuthCheck
method
in
org.camunda.bpm.engine.impl.db.ListQueryParameterObject

Best Java code snippets using org.camunda.bpm.engine.impl.db.ListQueryParameterObject.getAuthCheck (Showing top 20 results out of 315)

origin: camunda/camunda-bpm-platform

@Test
public void shouldCheckDbForCfgValue_auto() {
 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);
 // then
 assertEquals(true, authCheck.isRevokeAuthorizationCheckEnabled());
 verify(mockedEntityManager, times(1)).selectBoolean(eq("selectRevokeAuthorization"), eq(expectedQueryParams));
}
origin: camunda/camunda-bpm-platform

@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);
}
origin: camunda/camunda-bpm-platform

@Test
public void shouldCheckDbForCfgValueWithNoRevokes_auto() {
 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(false);
 // if
 authorizationManager.configureQuery(query);
 // then
 assertEquals(false, authCheck.isRevokeAuthorizationCheckEnabled());
 verify(mockedEntityManager, times(1)).selectBoolean(eq("selectRevokeAuthorization"), eq(expectedQueryParams));
}
origin: camunda/camunda-bpm-platform

@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));
}
origin: camunda/camunda-bpm-platform

@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));
}
origin: camunda/camunda-bpm-platform

public void configureQueryHistoricFinishedInstanceReport(ListQueryParameterObject query, Resource resource) {
 configureQuery(query);
 CompositePermissionCheck compositePermissionCheck = new PermissionCheckBuilder()
  .conjunctive()
   .atomicCheck(resource, "RES.KEY_", READ)
   .atomicCheck(resource, "RES.KEY_", READ_HISTORY)
  .build();
 query.getAuthCheck().setPermissionChecks(compositePermissionCheck);
}
origin: camunda/camunda-bpm-platform

@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);
}
origin: camunda/camunda-bpm-platform

public void configureQueryHistoricFinishedInstanceReport(ListQueryParameterObject query, Resource resource) {
 configureQuery(query);
 CompositePermissionCheck compositePermissionCheck = new PermissionCheckBuilder()
  .conjunctive()
   .atomicCheck(resource, "RES.KEY_", READ)
   .atomicCheck(resource, "RES.KEY_", READ_HISTORY)
  .build();
 query.getAuthCheck().setPermissionChecks(compositePermissionCheck);
}
origin: camunda/camunda-bpm-platform

protected void addPermissionCheck(ListQueryParameterObject query, Resource resource, String queryParam, Permission permission) {
 CommandContext commandContext = getCommandContext();
 if (isAuthorizationEnabled() && getCurrentAuthentication() != null && commandContext.isAuthorizationCheckEnabled()) {
  PermissionCheck permCheck = newPermissionCheck();
  permCheck.setResource(resource);
  permCheck.setResourceIdQueryParam(queryParam);
  permCheck.setPermission(permission);
  query.getAuthCheck().addAtomicPermissionCheck(permCheck);
 }
}
origin: camunda/camunda-bpm-platform

protected void addPermissionCheck(ListQueryParameterObject query, Resource resource, String queryParam, Permission permission) {
 CommandContext commandContext = getCommandContext();
 if (isAuthorizationEnabled() && getCurrentAuthentication() != null && commandContext.isAuthorizationCheckEnabled()) {
  PermissionCheck permCheck = newPermissionCheck();
  permCheck.setResource(resource);
  permCheck.setResourceIdQueryParam(queryParam);
  permCheck.setPermission(permission);
  query.getAuthCheck().addAtomicPermissionCheck(permCheck);
 }
}
origin: camunda/camunda-bpm-platform

public void configureQuery(ListQueryParameterObject query) {
 AuthorizationCheck authCheck = query.getAuthCheck();
 authCheck.getPermissionChecks().clear();
 if(isAuthCheckExecuted()) {
  Authentication currentAuthentication = getCurrentAuthentication();
  authCheck.setAuthUserId(currentAuthentication.getUserId());
  authCheck.setAuthGroupIds(currentAuthentication.getGroupIds());
  enableQueryAuthCheck(authCheck);
 }
 else {
  authCheck.setAuthorizationCheckEnabled(false);
  authCheck.setAuthUserId(null);
  authCheck.setAuthGroupIds(null);
 }
}
origin: camunda/camunda-bpm-platform

public void configureQuery(ListQueryParameterObject query) {
 AuthorizationCheck authCheck = query.getAuthCheck();
 authCheck.getPermissionChecks().clear();
 if(isAuthCheckExecuted()) {
  Authentication currentAuthentication = getCurrentAuthentication();
  authCheck.setAuthUserId(currentAuthentication.getUserId());
  authCheck.setAuthGroupIds(currentAuthentication.getGroupIds());
  enableQueryAuthCheck(authCheck);
 }
 else {
  authCheck.setAuthorizationCheckEnabled(false);
  authCheck.setAuthUserId(null);
  authCheck.setAuthGroupIds(null);
 }
}
origin: camunda/camunda-bpm-platform

public void configureExternalTaskFetch(ListQueryParameterObject parameter) {
 configureQuery(parameter);
 CompositePermissionCheck permissionCheck = newPermissionCheckBuilder()
  .conjunctive()
  .composite()
   .disjunctive()
   .atomicCheck(PROCESS_INSTANCE, "RES.PROC_INST_ID_", READ)
   .atomicCheck(PROCESS_DEFINITION, "RES.PROC_DEF_KEY_", READ_INSTANCE)
   .done()
  .composite()
   .disjunctive()
   .atomicCheck(PROCESS_INSTANCE, "RES.PROC_INST_ID_", UPDATE)
   .atomicCheck(PROCESS_DEFINITION, "RES.PROC_DEF_KEY_", UPDATE_INSTANCE)
   .done()
  .build();
 addPermissionCheck(parameter.getAuthCheck(), permissionCheck);
}
origin: camunda/camunda-bpm-platform

public void configureExternalTaskFetch(ListQueryParameterObject parameter) {
 configureQuery(parameter);
 CompositePermissionCheck permissionCheck = newPermissionCheckBuilder()
  .conjunctive()
  .composite()
   .disjunctive()
   .atomicCheck(PROCESS_INSTANCE, "RES.PROC_INST_ID_", READ)
   .atomicCheck(PROCESS_DEFINITION, "RES.PROC_DEF_KEY_", READ_INSTANCE)
   .done()
  .composite()
   .disjunctive()
   .atomicCheck(PROCESS_INSTANCE, "RES.PROC_INST_ID_", UPDATE)
   .atomicCheck(PROCESS_DEFINITION, "RES.PROC_DEF_KEY_", UPDATE_INSTANCE)
   .done()
  .build();
 addPermissionCheck(parameter.getAuthCheck(), permissionCheck);
}
origin: org.camunda.bpm/camunda-engine

@Test
public void shouldCheckDbForCfgValue_auto() {
 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);
 // then
 assertEquals(true, authCheck.isRevokeAuthorizationCheckEnabled());
 verify(mockedEntityManager, times(1)).selectBoolean(eq("selectRevokeAuthorization"), eq(expectedQueryParams));
}
origin: org.camunda.bpm/camunda-engine

@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);
}
origin: org.camunda.bpm/camunda-engine

@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);
}
origin: org.camunda.bpm/camunda-engine

public void configureQueryHistoricFinishedInstanceReport(ListQueryParameterObject query, Resource resource) {
 configureQuery(query);
 CompositePermissionCheck compositePermissionCheck = new PermissionCheckBuilder()
  .conjunctive()
   .atomicCheck(resource, "RES.KEY_", READ)
   .atomicCheck(resource, "RES.KEY_", READ_HISTORY)
  .build();
 query.getAuthCheck().setPermissionChecks(compositePermissionCheck);
}
origin: org.camunda.bpm/camunda-engine

protected void addPermissionCheck(ListQueryParameterObject query, Resource resource, String queryParam, Permission permission) {
 CommandContext commandContext = getCommandContext();
 if (isAuthorizationEnabled() && getCurrentAuthentication() != null && commandContext.isAuthorizationCheckEnabled()) {
  PermissionCheck permCheck = newPermissionCheck();
  permCheck.setResource(resource);
  permCheck.setResourceIdQueryParam(queryParam);
  permCheck.setPermission(permission);
  query.getAuthCheck().addAtomicPermissionCheck(permCheck);
 }
}
origin: org.camunda.bpm/camunda-engine

public void configureQuery(ListQueryParameterObject query) {
 AuthorizationCheck authCheck = query.getAuthCheck();
 authCheck.getPermissionChecks().clear();
 if(isAuthCheckExecuted()) {
  Authentication currentAuthentication = getCurrentAuthentication();
  authCheck.setAuthUserId(currentAuthentication.getUserId());
  authCheck.setAuthGroupIds(currentAuthentication.getGroupIds());
  enableQueryAuthCheck(authCheck);
 }
 else {
  authCheck.setAuthorizationCheckEnabled(false);
  authCheck.setAuthUserId(null);
  authCheck.setAuthGroupIds(null);
 }
}
org.camunda.bpm.engine.impl.dbListQueryParameterObjectgetAuthCheck

Popular methods of ListQueryParameterObject

  • <init>
  • getMaxResults
  • getFirstResult
  • getOrderingProperties
  • getTenantCheck
  • setParameter
  • getOrderBy
  • getParameter

Popular in Java

  • Parsing JSON documents to java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • getSystemService (Context)
  • onCreateOptionsMenu (Activity)
  • Path (java.nio.file)
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • ImageIO (javax.imageio)
  • BoxLayout (javax.swing)
  • Top 17 PhpStorm Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now