# Gebruikers

### Overzichttabel termen

| Naam                                | Type           | Verplicht bij aanmaken | Omschrijving                                                                                                                                                                                               |
| ----------------------------------- | -------------- | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| name                                | string         | Ja                     | Naam van de gebruiker                                                                                                                                                                                      |
| title                               | string         | Nee                    | Titel van de gebruiker. Bijv. Mevr. of Dhr.                                                                                                                                                                |
| firstName                           | string         | Nee                    | Voornaam van de gebruiker                                                                                                                                                                                  |
| prefix                              | string         | Nee                    | Tussenvoegsel                                                                                                                                                                                              |
| lastName                            | string         | Nee                    | Achternaam van de gebruiker                                                                                                                                                                                |
| email                               | string (email) | Ja                     | E-mailadres van de gebruiker. Hier logt de gebruiker mee in                                                                                                                                                |
| roles                               | array          | Ja                     | Je kunt rollen aan de gebruiker toevoegen. Per organisatie kan een rol verschillen. Als voorbeeld: Een gebruiker kan docent zijn bij opleiding A en functioneel kwaliteitsmanager bij een andere faculteit |
| organisations / linkedOrganisations | array          | n.v.t.                 | Naast rollen wordt er ook een lijst met organisaties meegegeven bij het ophalen van gebruiker(s). Hierin staat welke organisaties gekoppeld zijn aan de gebruiker                                          |
| additionalPermissionGroups          | array          | Nee                    | In Evalytics zijn er extra permissies mogelijk die je bij een gebruiker kan instellen. Zoals bijvoorbeeld: Evaluatiebeheer, cursusbeheer of docentbeheer.                                                  |
| noSurf                              | boolean        | nee                    | Als de docent geen gebruik kan maken van saml, kan je noSurf meegeven. De gebruiker krijgt dan een inlog en wachtwoord.                                                                                    |
| lastActivationMail                  | timestamp      | n.v.t.                 | Geeft aan wanneer er voor het laatst een activeringsmail is verstuurd                                                                                                                                      |
| activated                           | boolean        | n.v.t.                 | Geeft aan of een gebruiker geactiveerd is. De gebruiker krijgt, als je noSurf = true meegeeft, bij het aanmaken van een gebruiker een activerings e-mail. Na het activeren wordt activated op true gezet.  |
| externalId                          | string         | nee                    | Het externe id van de gebruiker                                                                                                                                                                            |

### Gebruikers en docenten

Gebruikers en docenten zijn nauw met elkaar verbonden. Op het moment dat je een docent aanmaakt binnen de opleiding, zal er automatisch ook een gebruiker aangemaakt worden. Hetzelfde geldt voor concept gebruikers. Als je een concept gebruiker omzet naar docent, zal er automatisch ook een gebruiker aangemaakt worden. De gebruiker en docent zijn met elkaar gekoppeld.

## Gebruikers ophalen (lijst)

<mark style="color:blue;">`GET`</mark> `https://api-portal.evalytics.nl/user`

Hiermee kan je zoeken op gebruikers binnen de organisatie. Bij de gebruikers zullen ook de onderliggende rollen en organisaties toegevoegd worden aan de response

#### Query Parameters

| Name                      | Type    | Description                                                                                             |
| ------------------------- | ------- | ------------------------------------------------------------------------------------------------------- |
| includeChildOrganisations | boolean | Haal ook gebruikers op uit organisaties die onder de huidige organisatie staan                          |
| role                      | array   | Filter de users op een bepaalde role. Je kunt hier de ids van de rolen meegeven waarop je wilt filteren |
| q                         | string  | Zoeken binnen gebruikers op naam, code en e-mail                                                        |

{% tabs %}
{% tab title="200 " %}

```

{
  "metadata": {
     ...
  },
  "results": [
    {
      "organisations": [
        {
          "parent": 100,
          "topOrganisation": 100,
          "name": "TestFaculteit",
          "code": "tf",
          "type": "faculty",
          "availableModules": null,
          "modules": null,
          "externalId": "ABC",
          "id": 1
        }
      ],
      "roles": [
        {
          "id": 123,
          "user": 567,
          "evaluator": null,
          "role": 13,
          "organisation": 100
        }
      ],
      "organisation": 100,
      "topOrganisation": 100,
      "name": "Example user",
      "title": "",
      "firstName": "Example",
      "prefix": "",
      "lastName": "user",
      "email": "example@evalytics.nl",
      "altId": null,
      "externalId": "ABC",
      "activated": true,
      "lastActivationMail": "2020-12-29T10:15:09.000Z",
      "id": 567
    }
  }]
}


```

{% endtab %}
{% endtabs %}

## Gebruiker ophalen (item)

<mark style="color:blue;">`GET`</mark> `https://api-portal.evalytics.nl/user/:id`

Haal een enkele gebruiker op. Organisaties en rollen waar de gebruiker aan gekoppeld is worden ook toegevoegd.

#### Path Parameters

| Name                | Type    | Description                                                                                                                        |
| ------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| id                  | string  | Intern id of extern id van de gebruiker                                                                                            |
| showPropagatedRoles | boolean | Indien het nieuwe gebruikersbeheer actief is: hiermee krijg je alle individuele rollen terug die uit `propagate` zijn voortgekomen |

{% tabs %}
{% tab title="200 " %}

```
{
  "linkedOrganisations": [
    {
      "parent": 100,
      "topOrganisation": 100,
      "name": "TestFaculteit",
      "code": "tf",
      "type": "faculty",
      "availableModules": null,
      "modules": null,
      "externalId": "ABC",
      "id": 1
    }
  ],
  "roles": [
    {
      "id": 123,
      "user": 567,
      "evaluator": null,
      "role": 13,
      "organisation": 100
     
      // Indien het nieuwe gebruikersbeheer actief is: geeft de status van de toegang aan. Kan enkel gebruikt worden i.c.m. `role` "3" (teacher)
      "enabled": true
      // Indien het nieuwe gebruikersbeheer actief is: voert de rol door op alle onderliggende organisaties. Kan gebruikt worden i.c.m. `role` anders dan "3" (teacher)
      "propagate": false
      // Indien het nieuwe gebruikersbeheer actief is: geeft aan of de rol voortkomt uit een andere rol waar `propagate: true`. Kan gebruikt worden i.c.m. `role` anders dan "3" (teacher).
      "propagated": false
    }
  ],
  "organisation": 100,
  "topOrganisation": 100,
  "name": "Example user",
  "title": "",
  "firstName": "Example",
  "prefix": "",
  "lastName": "user",
  "email": "example@evalytics.nl",
  "altId": null,
  "activated": true,
  "lastActivationMail": "2020-12-29T10:15:09.000Z",
  "id": 567
}
```

{% endtab %}
{% endtabs %}

## Gebruiker aanmaken

<mark style="color:green;">`POST`</mark> `https://api-portal.evalytics.nl/user`

Als je een gebruiker aanmaakt moet het e-mailadres uniek zijn. Het is niet mogelijk om meerdere gebruikers aan te maken met hetzelfde e-mailadres

{% tabs %}
{% tab title="200 " %}

```
{
  "deleted": false,
  "createdBy": "3",
  "modifiedBy": "3",
  "name": "pascal api docs",
  "title": "",
  "firstName": "Pascal",
  "prefix": "",
  "lastName": "api docs",
  "email": "pascal+apidocs@evalytics.nl",
  "altId": null,
  "activated": false,
  "lastActivationMail": "2021-02-25T10:21:39.000Z",
  "organisation": 100,
  "topOrganisation": 100,
  "id": 123
}
```

{% endtab %}
{% endtabs %}

```
{
  "name": (string - deprecated),
  "title": "(string)",
  "firstName": "(string - required when you do not use the name field)",
  "prefix": "(string)",
  "lastName": "(string - required when you do not use the name field)",
  "email": (string - required),
  "noSurf":(boolean),
  "externalId: (string),
  "additionalPermissionGroups":[
    {
      “organisation”: (integer),
      “additionalPermissionGroup”:  (integer)
      
      // Indien het nieuwe gebruikersbeheer actief is: geeft aan of de rol gekoppeld is aan `role` "3" (teacher).
      "isTeacher": (boolean)
    }
  ],
  “roles”: [
    {
      “organisation”: (integer - at least one role required),
      “role”: (integer)
     
      // Indien het nieuwe gebruikersbeheer actief is: geeft de status van de toegang aan. Kan enkel gebruikt worden i.c.m. `role` "3" (teacher)
      "enabled": (boolean)
      // Indien het nieuwe gebruikersbeheer actief is: voert de rol door op alle onderliggende organisaties. Kan gebruikt worden i.c.m. `role` anders dan "3" (teacher)
      "propagate": (boolean)
    }
  ]
}
```

## Gebruiker bijwerken

<mark style="color:green;">`POST`</mark> `https://api-portal.evalytics.nl/user/:id`

Het is mogelijk om een gebruiker bij te werken. Je kunt de gebruiker bijvoorbeeld extra rollen geven of de naam aanpassen. Het aanpassen van het e-mailadres is niet mogelijk.

#### Path Parameters

| Name | Type   | Description                             |
| ---- | ------ | --------------------------------------- |
| id   | string | Intern id of extern id van de gebruiker |

{% tabs %}
{% tab title="200 " %}

```
{
  "deleted": false,
  "createdBy": "3",
  "modifiedBy": "3",
  "name": "pascal api docs updated name",
  "title": "",
  "firstName": "Pascal",
  "prefix": "",
  "lastName": "api docs updated name",
  "email": "pascal+apidocs@evalytics.nl",
  "altId": null,
  "activated": false,
  "lastActivationMail": "2021-02-25T10:21:39.000Z",
  "organisation": 100,
  "topOrganisation": 100,
  "id": 123
}
```

{% endtab %}
{% endtabs %}

```
{
  "externalId": (string),
  "name": (string - deprecated),
  "title": "(string)",
  "firstName": "(string - required when you do not use the name field)",
  "prefix": "(string)",
  "lastName": "(string - required when you do not use the name field)",
  "noSurf":(boolean),
  "additionalPermissionGroups":[
    {
      “organisation”: (integer),
      “additionalPermissionGroup”:  (integer)
    
      // Indien het nieuwe gebruikersbeheer actief is: geeft aan of de rol gekoppeld is aan `role` "3" (teacher).
      "isTeacher": (boolean)
    }
  ],
  “roles”: [
    {
      “organisation”: (number),
      “role”: (number)
     
      // Indien het nieuwe gebruikersbeheer actief is: geeft de status van de toegang aan. Kan enkel gebruikt worden i.c.m. `role` "3" (teacher)
      "enabled": true
      // Indien het nieuwe gebruikersbeheer actief is: voert de rol door op alle onderliggende organisaties. Kan gebruikt worden i.c.m. `role` anders dan "3" (teacher)
      "propagate": false
    }
  ]
}
```

## Gebruiker verwijderen

<mark style="color:red;">`DELETE`</mark> `https://api-portal.evalytics.nl/user/:id`

#### Path Parameters

| Name | Type   | Description                             |
| ---- | ------ | --------------------------------------- |
| id   | string | Intern id of extern id van de gebruiker |

#### Query Parameters

| Name | Type    | Description                          |
| ---- | ------- | ------------------------------------ |
| undo | boolean | Maakt de verwijderingsactie ongedaan |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Als je een gebruiker verwijderd, kan de gebruiker daarna ook niet meer inloggen in het systeem
{% endhint %}

## Block user

<mark style="color:green;">`POST`</mark> `https://api-portal.evalytics.nl/user/:id/block`

Block a user in Evalytics. When a user is blocked:\
\- The user is not able to login\
\- The user will not receive notifications in the period the user is blocked\
\- The linked organisations and roles will not be removed

#### Path Parameters

| Name | Type   | Description             |
| ---- | ------ | ----------------------- |
| id   | string | Internal or external id |

#### Query Parameters

| Name | Type    | Description           |
| ---- | ------- | --------------------- |
| undo | boolean | Undo the block action |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Upgrading to User Management 2.0

On 09-07-2025 a new update was released which introduced User Mangement 2.0. Most notably the feature to apply (propagate) roles and permissions to underlying organisations was introduced. To accomodate this change the API underwent a couple of slight changes, which is why 2.0 is opt-in for the next 3 months. The following changes have been made:

* Teacher-roles should no longer be added through the `/user` endpoints, since these are of no value when no teacher is created through `POST /teacher` . Instead, retrieve the user beforehand to find out where the teacher role is applicable and disable (or omit) it if necessary
* New attributes have been added to `POST /user` and `PUT /user` :
  * `additionalPermissionGroups[].isTeacher` describes if the additional permissions should be linked to the teacher role, this is reflected on the frontend since teacher roles and permissions are now managed in a separate step in the user form
  * `roles[].enabled` in case the role is the teacher-role. This marks a teacher role as enabled or disabled.
  * `roles[].propagate` applies all roles and additional permissions to the organisation itself and all child organisations, including new child organisations which can be added later. Note that this applies all given roles for the organisation, you can not partially (e.g. one role for the parent org, another for the child). This also applies possible `additionalPermissionGroups` for the organisation. Note that this function can only be used by a user with the *administrator* role
* New attributes and a data flag have been added to `GET /user/:id` :
  * The three attributes from above.
  * `roles[].propagated` describes if a role is propagated from a parent organisation, which means the role is locked on this level
  * A flag `showPropagatedRoles=false` can be given to `GET /user/:id` which removes possible propagated roles, only returning normal or propagating roles instead
  * Note that you may receive more teacher roles than expected when retrieving a user: if a teacher role was previously removed but the teacher-object is still available, a role is added to the response with `enabled` set to `false`
* The `name` attribute has been deprecated. Instead, use at least `firstName` and `lastName`.

To migrate, in short:

* Do not add new teacher roles though the user endpoints
* When adding `additionalPermissionGroups` to a teacher role, ensure `isTeacher` is set to `true`&#x20;
* Implement propagation logic, keep in mind that an administrator can use this functionality at any time on the Evalytics portal. For instance errors can be thrown when trying to add a role to an organisation where `propagated`  is set to `true`&#x20;

We want to make sure everyone is at the latest version before removing deprecated logic, so please contact us in case you encounter any issues during your migration!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.evalytics.nl/onderdelen/gebruikers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
