{% extends "authentic2/manager/base.html" %} {% load i18n gadjo static %} {% block page-title %}{{ block.super }} - {% trans "Import Users" %}{% endblock %} {% block page_title %}{% trans "Imports" %}{% endblock %} {% block breadcrumb %} {{ block.super }} {% trans 'Users' %} {% trans 'Import Users' %} {% endblock %} {% block sidebar %} {% endblock %} {% block content %}

{% trans "Imports" %}

{% if imports %} {% for import in imports %} {% endfor %} {% else %} {% endif %}
{% trans "Filename" %} {% trans "Creation date" %} {% trans "By" %} {% trans "Rows" %}
{{ import.filename }} {{ import.created }} {{ import.user }} {{ import.rows_count }}
{% csrf_token %}
{% trans "None" %}

{% trans "Help" %}

{% blocktrans trimmed %} The first line of your CSV file must be a header mapping columns to user's attributes identifier. Each user attribute name can be followed by flags separated by spaces. You can also import an external identifier to prevent creating duplicates when doing multiple import from the same source. {% endblocktrans %}

{% trans "Attributes" %}

{% for column in help_columns %} {% endfor %}
{% trans "Label" %} {% trans "Identifier" %}
{{ column.label }} {{ column.name }}

{% trans "Flags" %}

{% blocktrans trimmed %}Each column can receive flags after its name, separated by spaces. Each modifier can be prefixed by no- to set its value to false.{% endblocktrans %}

{% trans "Flag" %} {% trans "Meaning" %} {% trans "Default value" %}
key {% blocktrans trimmed %} The column is an import key, it is used to match the row with an existing user. Only one column can be an import key. {% endblocktrans %} {% trans "False" %}
create {% blocktrans trimmed %} Values will be used when creating a new user. {% endblocktrans %} {% trans "True" %}
update {% blocktrans trimmed %} Values will be used when updating an existing user. {% endblocktrans %} {% trans "True" %}
unique {% blocktrans trimmed %} Values must be unique in the target organizational unit. {% endblocktrans %} {% trans "False" %} {% blocktrans trimmed %} (default is True for the email and username columns if they are configured to be unique in the target organizational unit) {% endblocktrans %}
globally-unique {% blocktrans trimmed %} Values must be unique among all users. {% endblocktrans %} {% trans "False" %} {% blocktrans trimmed %} (default is True for the email and username columns if they are configured to be globally unique) {% endblocktrans %}
verified {% blocktrans trimmed %} Values are verified. User's attribute will be locked. {% endblocktrans %} {% trans "False" %} {% blocktrans %}(default is True for the email column){% endblocktrans %}

{% trans "External identifier" %}

{% blocktrans trimmed %} You can also use two special columns _source_name and _source_id. _source_name must be the name of the source directory from which the users are exported, it must not change between imports. _source_id is the unique identifier from the source directory from which the users are extracted, it must not change between imports and should never be reused for different users. _source_id is automatically the key column, and you cannot use another key column. {% endblocktrans %}

{% trans "Role operations" %}

{% blocktrans trimmed %} Adding existing roles to users is supported. Use either _role_name or _role_slug special columns to specify the names or the slugs that should be added to the user. In order to add multiple roles, simply add a new line, identical to the first one, except for the value of the role cell. These columns also accept special flags, as listed below. {% endblocktrans %}

{% trans "Flag" %} {% trans "Meaning" %} {% trans "Default value" %}
delete {% blocktrans trimmed %} Remove role from user instead of adding it. {% endblocktrans %} {% trans "False" %}
clear {% blocktrans trimmed %} Clear user roles beforehand, so that they will have no more roles than those specified in the import file. {% endblocktrans %} {% trans "False" %}

{% trans "Registration options" %}

{% blocktrans trimmed %} When a user is created by the import, they will have to use the "forgotten password" feature in order to log in for the first time. An alternative is to use the special column @registration with the value send-email. In this case, newly created users will receive an email, inviting them to set their password. {% endblocktrans %}

{% trans "Force Password Reset" %}

{% blocktrans trimmed %} If you want to set a default password but make the user change it after next login, you can add a @force-password-reset column in the CSV. A value of 'true' in this column will ask the user to change password after the next login. {% endblocktrans %}

{% trans "Examples" %}

{% blocktrans trimmed %}Importing first and last name of users keyed by email{% endblocktrans %}

"email key",first_name,last_name
john.doe@example.com,John,Doe

{% blocktrans trimmed %}Importing verified first and last name of users keyed by email{% endblocktrans %}

"email key","first_name verified","last_name verified"
john.doe@example.com,John,Doe

{% blocktrans trimmed %}Importing email, family_reference, first and last name of users from application app1, ensuring family_reference is unique.{% endblocktrans %}

_source_name,_source_id,email,"family_reference unique",first_name,last_name
app1,1,john.doe@example.com,1234,John,Doe

{% blocktrans trimmed %}Importing email, first and last name of users while adding roles.{% endblocktrans %}

email key,first_name,last_name,_role_name
john.doe@example.com,John,Doe,Role1
john.doe@example.com,John,Doe,Role2

{% blocktrans trimmed %}Importing email, first and last name of users and sending a password reset email to John (only if the account is created by the import).{% endblocktrans %}

email key,first_name,last_name,@registration
john.doe@example.com,John,Doe,send-email
jane.doe@example.com,Jane,Doe,

{% blocktrans trimmed %}Importing email, first and last name of users and setting a password using hash in standard Django format. Forcing password change for Jane after next login.{% endblocktrans %}

email key,first_name,last_name,password_hash,@force-password-reset
john.doe@example.com,John,Doe,pbkdf2_sha256$36000$oTHdVaoMjnCp$uTkpF7Ne6KV/L5gAerS7mngXM96DOEaLsLMZ251HJ/M=,
jane.doe@example.com,Jane,Doe,pbkdf2_sha256$36000$oTHdVaoMjnCp$uTkpF7Ne6KV/L5gAerS7mngXM96DOEaLsLMZ251HJ/M=,true
{% endblock %}