Searching users by equal and Inverse startsWith functions

This functionality is deprecated.

🌐 This document is available in both English and Ukrainian. Use the language toggle in the top right corner to switch between versions.

1. Overview

The business name of the integration extension: Keycloak Get Officer Users By Attributes Equals And Start With

The system name of the integration extension: ${keycloakGetOfficerUsersByAttributesEqualsAndStartWith}

The file name in the extensions library: keycloakGetOfficerUsersByAttributesEqualsAndStartWith.json

The delegate is needed to get a list of users with the officer system role by specific attributes from the Keycloak service when executing a business process.

The following attributes are required for all registries: edrpou, drfo, and fullName.

Registries may also use custom attributes, such as KATOTTG.

In this topic, we’ll use the attributes mentioned above as search examples.

The Keycloak API receives GET requests with the specified parameters and returns an array of usernames that can be used in the business process.

The system searches the edrpou, drfo, and fullName attributes using the equal function, which returns values that exactly match the one you provide.

The KATOTTG attribute is searched using the Inverse startsWith function, which returns values with the specified prefix—​that is, those that "start with" the specified condition.

The startsWith () function:

Searches for users whose specific Keycloak attribute value "starts with" the query specified in the UI form in the user portal. At the same time, Keycloak contains the full value of this attribute. For example, edrpou = 88888888.

The Inverse startsWith () function:

Works the same as the startsWith () function, but the Keycloak value of the attribute is not full. For example, KATOTTG = UA0510003 when the full value of the attribute in the codifier is UA05100030000051497.

Before configuring the template in Camunda Modeler, ensure the resources/element-templates folder of the application contains the keycloakGetOfficerUsersByAttributesEqualsAndStartWith.json file.

2. Configuring the template in the business process

  1. Open the business process modeling interface.

  2. Model a new task.

  3. Click the key icon and select Service Task from the dropdown menu.

    search by katottg attr 01

  4. In the settings panel on the right, click the Open Catalog button and select the Keycloak Get Officer Users By Attributes Equals And Start With delegate from the list. Click Apply to confirm your action.

    search by katottg attr 02

    search by katottg attr 3

  5. Configure the following settings:

  • Name: Specify the task name. For example, Find users by attributes.

  • Attributes Equals: Specify the value to search by EDRPOU, and/or DRFO, and/or full name: ${attributesEquals}.

  • Attribute Inverse Start With: Specify the value to search by KATOTTG: ${attributesStartsWith}.

    Keys and attribute values can only be passed as variables.

    In our example, we use the following variables to search by attributes: ${attributesEquals} and ${attributesStartsWith}.

    The objects, or key-value pairs, for the search attributes are generated by a script in the previous task of the business process. Task data is passed from a corresponding user UI form and processed by the script. The result of the script is stored in search variables, which are used to configure the delegate template.

    search by katottg attr 2

  • Result variable: Specify the search result variable to store the list of retrieved users: usersByAttributes.

    search by katottg attr 1

For details on using the delegate, download the BPMN schema of a test business process and open it in the modeler.

3. Using search parameters in the officer portal

The system allows searching by one attribute or a combination of attributes: KATOTTG, edrpou, drfo, and fullName.

3.1. Prerequisites

  1. The system contains three users with the following EDRPOU and KATOTTG attributes:

    • Ivanov, EDRPOU 11111111, KATOTTG UA0502 (Vinnytsia district).

    • Petrov, EDRPOU 22222222, KATOTTG UA05 (Vinnytsia region).

    • Sydorenko, EDRPOU 34554362, KATOTTG UA05 (Vinnytsia region).

  2. Let’s consider three search scenarios:

    • By the EDRPOU attribute value 34554362.

    • By the KATOTTG attribute value UA05100030000051497 (Vapnyarska territorial community, Tulchyn district, Vinnytsia region).

    • By a combination of attributes: EDRPOU=34554362 та KATOTTG=UA05100030000051497.

3.2. Search process

  1. Sign in to the officer portal using your digital signature.

    officer portal overview 01

    For details on user authentication, see Registry user authentication.
  2. Go to All services and start the business process of searching users by attributes.

  3. In the task’s UI form, enter 34554362 into the EDRPOU field and click Search.

    search by katottg attr 4

    As a result, the system finds one user who matches the search criteria.

    search by katottg attr 5

  4. Restart the task and enter UA05100030000051497 into the KATOTTG field. Click Search.

    search by katottg attr 6

    As a result, the system finds two users who match the search criteria.

    search by katottg attr 7

  5. Restart the task and enter a combination of attributes: 34554362 for EDRPOU and UA05100030000051497 for KATOTTG. Click Search.

    search by katottg attr 8

    As a result, the system finds one user who matches the search criteria.

    search by katottg attr 9