# Supervisor Import

Goal is to import/synchronize bigger sets of supervisor-to-users relations. `Content-Type` header defines the requested import format:

Supported content types:

- `application/json`
- `application/xml`
- `text/csv`

#### Configuration Possibilities

Different importing-modes can be applied which define what will happen to entries that are available in the database, but are not available via the given import file anymore (deprecation).

- **None**  
    In mode none - nothing will happen to the existing entries in our database if it's missing in the current file
- **Delete**  
    Before the import we will remove all existing supervisor-user relations and recreate this from the provided file. This is the default setting

The other way round, if there are entries in the provided file that do not exist in our database, the entries are simply ignored, the import is not stopped and runs normally.

#### Supported content-types / hierarchy

JSON, XML and CSV are supportet filetypes. They all contain a simple list of **supervisor&lt;-&gt;user** relation - the matching happens based on **USERNAME**.  
A supervisor can have multiple users whereas a user only has one supervisor.

##### application/json

**Example**

```json
[
  {
    "supervisor": "chefa",
    "user": "usera"
  },
  {
    "supervisor": "chefb",
    "user": ""
  }
]
```

##### application/xml

**Example**

```xml
<?xml version="1.0" encoding="utf-8"?>
<supervisors>
    <supervisor>
        <supervisor>chefa</supervisor>
        <user>usera</user>
    </supervisor>
    <supervisor>
        <supervisor>chefb</supervisor>
        <user/>
    </supervisor>
</supervisors>
```

##### text/csv

**Example**

```markdown
supervisor,user
chefa,usera
chefb,
```

#### Fields

While the field `supervisor` is mandatory, the field `user` can be omitted (see examples above).

<table id="bkmrk-field-mandatory-info" style="width: 99.5062%;"><thead><tr><th class="align-left" style="width: 19.5031%;">Field</th><th class="align-left" style="width: 17.764%;">Mandatory</th><th class="align-left" style="width: 62.7329%;">Info</th></tr></thead><tbody><tr><td style="width: 19.5031%;">`supervisor`</td><td style="width: 17.764%;">yes</td><td style="width: 62.7329%;">Marks user as supervisor and gives permissions</td></tr><tr><td style="width: 19.5031%;">`user`</td><td style="width: 17.764%;">no</td><td style="width: 62.7329%;">Attaches user as member of supervisor</td></tr></tbody></table>

#### Process time

The process time can be determined individually (usually once a day at night), but must be coordinated with other processes by SLH.