{{ :blocks:logo-apl.png?nolink |}} ===== Tool sync: User creation/update file format ===== ====Introduction==== Each line of the file contains one record. The first line of the file contains the names of the fields that make up the records, and thus determines the structure of the rest of the file. ====File format==== ^ Field ^Value ^ Default ^ | username(*) | String(variable) | - | | firstname (*) | String(10) | - | | lastname (*) | String(10) | - | | idnumber | String(255) | - | | email (*) | String(255) | - | | auth | In('manual', 'cas, 'ldap', ...) | manual | | icq | String(255) | - | | maildisplay | 0 or 1 | 1 | | mailformat | 0 (text) or 1 (html) | 1 | | maildigest | 0 or 1 | 0 | | autosubscribe | 0 or 1 | 0 | | trackforums | 0 or 1 | 0 | | phone1 | String(32) | - | | phone2 | String(32) | - | | address | String(255) | - | | institution | String(255) | - | | departement | String(255) | - | | city | String(64) | Site default value (*) | | country | String(2) | Site default value (**) | | lang | String(2) | Site default value (***) | | timezone | Timezone code (integer) | Site default value (****), 99 for the server's local time | | description | String(255) | - | | cohort | Cohort name. String(16). | The cohort will be created | | cohortid | Cohort identification in the database |The cohort must already exist with the id concerned, not to be confused with the ID number, which is optional and visible at the front of the cohorts | |cohortidnumber | Cohort ID number |The cohort must already exist with the idnumber concerned | | course | Course short name (shortname) | | | enrol | Enrolment plugin | - | | group | Group name | Example group1 | | type | OBSOLETE | - | | role | Role short name (e.g. student, editingteacher) | - | | start | Unix Timestamp | - | | end | Unix Timestamp | - | | wwwroot | Url of the remote Moodle if the account is not local (requires VMoodle) | - | | password | String (compliant with the site's security rules) | - | (*) Can be configured through the menu ''Site administration > Location > Location settings (Default city)'' (**) Can be configured through the menu ''Site administration > Location > Location settings (Default country)'' (***) Can be configured through the menu ''Site administration > Language > Language settings (Default language)'' (****) Can be configured through the menu ''Site administration > Location > Location settings (Default timezone)''. The timezone codes are those [[http://en.wikipedia.org/wiki/Tz_database|standardised by IANA]] === Using the creation/update file for enrolment and group assignment === The import function reproduces and extends the standard Moodle version by simultaneously allowing: - creating/updating the user - enrolling them in one or more courses - adding them to an existing group in these courses - assigning them a role (with or without an associated enrolment) To do so, simply add groups of columns to the file (indexed columns of the previous table): ^ Field ^ Value ^ ^ | course |Course shortname | Mandatory in the column group | | group |Group name | Optional | | type |OBSOLETE| Obsolete, but tolerated | | role |Role short name | Mandatory, the role short name (student) | | role |Enrolment type| Optional, default "without role" | | start |Unix Timestamp | Optional, default "now" | | end |Unix Timestamp | Optional, default 0 (no end) | | wwwroot |Url of the remote Moodle if the account is not local (requires VMoodle)| Optional | In the Sync tool, enrolment can be done on "remote" courses, if the VMoodle component is installed to drive the installation's Moodle instances. ====Additional fields with special effects==== ^ Field ^Value ^ Default ^ | deleted | 0/1 | 0 | | suspended | 0/1 | 0 | | oldusername | String | | === 'deleted' === If the "deleted" column is present and marked with 1s, then the user will be deleted from Moodle if they exist (through the same procedure as an administrative deletion). The file can be reduced to the set: ;username;firstname;lastname;deleted === 'suspended' === If the "suspended" column is present and set to 1, then the user profile is marked suspended, with no other change to the user data. The file can be reduced to the set: ;username;firstname;lastname;suspended === 'oldusername' === This field is used to change a user's primary identifier (login). It uses a simplified file with only two columns: oldusername;username;firstname;lastname Make sure the primary identifier is the login identifier. ====File example==== {{:tool:sync:files:sample_users_en.csv|}} --------------- [[:Tool:Sync|Back to the component index]] - [[:start|Back to catalogue]]