From b545cdc8e1ab4773afaae8d293b4843b02d515d7 Mon Sep 17 00:00:00 2001 From: kakwa Date: Sun, 19 Jul 2015 18:10:50 +0200 Subject: [PATCH] add documentation for attributes.yml --- docs/deploy.rst | 172 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 165 insertions(+), 7 deletions(-) diff --git a/docs/deploy.rst b/docs/deploy.rst index c0e8218..3553d55 100644 --- a/docs/deploy.rst +++ b/docs/deploy.rst @@ -33,17 +33,175 @@ Entry point in main configuration The main configuration file (ldapcherry.ini by default) contains two parameters locating the roles and attributes configuration files: -+-----------------+------------+-------------------------------+-------------------+---------+ -| Parameter | Section | Description | Values | Comment | -+=================+============+===============================+===================+=========+ -| attributes.file | attributes | Attributes configuration file | Path to conf file | | -+-----------------+------------+-------------------------------+-------------------+---------+ -| roles.file | roles | Roles configuration file | Path to conf file | | -+-----------------+------------+-------------------------------+-------------------+---------+ ++-----------------+------------+-------------------------------+-------------------+ +| Parameter | Section | Description | Values | ++=================+============+===============================+===================+ +| attributes.file | attributes | Attributes configuration file | Path to conf file | ++-----------------+------------+-------------------------------+-------------------+ +| roles.file | roles | Roles configuration file | Path to conf file | ++-----------------+------------+-------------------------------+-------------------+ Attributes Configuration ~~~~~~~~~~~~~~~~~~~~~~~~ +The attributes configuration is done in a yaml file (attributes.yml by default). + +Mandatory parameters +^^^^^^^^^^^^^^^^^^^^ + +The mandatory parameters for an attribute, and their format are the following: + +.. sourcecode:: yaml + + : + description: # (free text) + display_name: # (free text) + weight: # (integer) + type: # (in ['int', 'string', 'email', 'stringlist', 'fix']) + backends: # (list of backend attributes name) + - : + - : + +.. warning:: + + (the attribute id) must be unique, LdapCherry won't start if it's not. + +.. warning:: + + (the backend id) must be defined in main configuration + (ldapcherry.ini by default). LdapCherry won't start if it's not. + +Type stringlist values +^^^^^^^^^^^^^^^^^^^^^^ + +If **type** is set to **stringlist** the parameter **values** must be filled with the list of possible values: + +.. sourcecode:: yaml + + : + description: + display_name: + weight: : + +Authorize self modification +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +A user can modify some of it's attributes (self modification). +In such case, the parameter **self** must set to **True**: + +.. sourcecode:: yaml + + : + description: + display_name: + weight: + + self: True + + backends: + - : + - : + +Autofill +^^^^^^^^ + +LdapCherry has the possibility to autofill fields from other fields, +to use this functionnality **autofill** must be set. + +Example: + +.. sourcecode:: yaml + + gidNumber: + description: "Group ID Number of the user" + display_name: "GID Number" + weight: 70 + type: int + + autofill: + function: lcUidNumber # name of the function to call + args: # list of arguments + - $first-name # + - $name + - '10000' + - '40000' + + backends: + ldap: gidNumber + +Arguments of the autofill function work as follow: + +* if argument starts with **$**, for example **$my_field**, the value of form input **my_field** will be passed to the function. +* otherwise, it will be treated as a fixed argument. + +Available autofill functions: + +* lcUid: generate 8 characters uid from 2 other fields (first letter of the first field, 7 first letters of the second): + +.. sourcecode:: yaml + + autofill: + function: lcUid + args: + - $first-name + - $name + + +* lcDisplayName: concatenate two fields + +.. sourcecode:: yaml + + autofill: + function: lcDisplayName + args: + - $first-name + - $name + +* lcMail: generate an email address from 2 other fields and a domain (+domain) + +.. sourcecode:: yaml + + autofill: + function: lcMail + args: + - $first-name + - $name + - '@example.com' + + +* lcUidNumber: generate an uid number from 2 other fields and between a minimum and maximum value + +.. sourcecode:: yaml + + autofill: + function: lcUidNumber + args: + - $first-name + - $name + - '10000' + - '40000' + +* lcHomeDir: generate an home directory from 2 other fields and a root (+) + +.. sourcecode:: yaml + + autofill: + function: lcHomeDir + args: + - $first-name + - $name + - /home/ + Roles Configuration ~~~~~~~~~~~~~~~~~~~