| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta content="text/html; charset=ISO-8859-15" |
| 5 | http-equiv="content-type"> |
| 6 | <title>File upload</title> |
| 7 | <link rel="stylesheet" type="text/css" href="style/layout.css"> |
| 8 | <link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico"> |
| 9 | </head> |
| 10 | <body> |
| 11 | <h1 style="text-align: center;">File upload<br> |
| 12 | </h1> |
| 13 | <br> |
| 14 | <div style="text-align: center;"><img |
| 15 | style="width: 886px; height: 162px;" alt="upload" |
| 16 | src="images/lam_upload.png"><br> |
| 17 | <div style="text-align: left;"><br> |
| 18 | <h2>Account selection (masscreate.php)<br> |
| 19 | </h2> |
| 20 | This is the initial page of the file upload. The user selects the |
| 21 | account type for the new upload.<br> |
| 22 | <br> |
| 23 | <br> |
| 24 | <h2>Attribute overview (masscreate.php)</h2> |
| 25 | After the account selection LAM will display an overview of the |
| 26 | possible and required input columns.<br> |
| 27 | The <span style="font-style: italic;">DN</span> attributes (<span |
| 28 | style="font-style: italic;">DN suffix</span> and <span |
| 29 | style="font-style: italic;">RDN</span>) are static and are always |
| 30 | displayed. The default suffix is read from config with <span |
| 31 | style="font-weight: bold;">getAccountSuffix()</span> and the list of |
| 32 | RDN possibilities is taken from modules.inc - <span |
| 33 | style="font-weight: bold;">getRDNAttributes()</span>.<br> |
| 34 | The next attributes are read from modules.inc - <span |
| 35 | style="font-weight: bold;">getUploadColumns()</span>. LAM will display |
| 36 | all attributes of one module in a separate fieldset. The <span |
| 37 | style="font-weight: bold;">getUploadColumns()</span> function also |
| 38 | returns if an attribute is required and additional information like an |
| 39 | example value.<br> |
| 40 | <br> |
| 41 | After clicking the upload button the user will be forwarded to the |
| 42 | account building page.<br> |
| 43 | <br> |
| 44 | <br> |
| 45 | <h2>Account building (massBuildAccounts.php)<br> |
| 46 | </h2> |
| 47 | This part takes the submitted <span style="font-weight: bold;">CSV file</span> |
| 48 | and generates the LDAP accounts.<br> |
| 49 | <br> |
| 50 | The scripts separates the head row from the data rows in the CSV file. |
| 51 | The head array is used to find the position of the input values. The |
| 52 | data array contains one subarray for each account.<br> |
| 53 | <br> |
| 54 | After the data has been extracted there are some basic checks done, |
| 55 | e.g. checking required and unique columns. The modules provide the |
| 56 | necessary information for this.<br> |
| 57 | <br> |
| 58 | Then all data is given to the modules with <span |
| 59 | style="font-weight: bold;">buildUploadAccounts()</span> in |
| 60 | modules.inc. They return a list of accounts which can be uploaded with <span |
| 61 | style="font-style: italic;">ldap-add()</span> and generate possible |
| 62 | error messages.<br> |
| 63 | <br> |
| 64 | If the accounts are built the script will give the user the possibility |
| 65 | to check the result with an <span style="font-style: italic;">LDIF-file</span> |
| 66 | or to do the upload.<br> |
| 67 | <br> |
| 68 | <br> |
| 69 | <h2>LDIF export (massBuildAccounts.php)<br> |
| 70 | </h2> |
| 71 | LAM simply takes the built accounts and generates an <span |
| 72 | style="font-style: italic;">LDIF-file</span> from them. This is passed |
| 73 | to the user's browser.<br> |
| 74 | The <span style="font-style: italic;">LDIF-file</span> will only |
| 75 | contain the accounts itself. If modules do additional tasks after the |
| 76 | upload (e.g. adding users to groups) this will not be covered.<br> |
| 77 | <br> |
| 78 | <br> |
| 79 | <h2>Account creation (massDoUpload.php)<br> |
| 80 | </h2> |
| 81 | This script finally uploads the LDAP accounts with <span |
| 82 | style="font-style: italic;">ldap_add()</span>.<br> |
| 83 | <br> |
| 84 | The upload can last longer than the maximum execution time of PHP. |
| 85 | Therefore the script will check regularly how much time is left and |
| 86 | pause the upload. This is resumed with a meta refresh which loads the |
| 87 | script again.<br> |
| 88 | <br> |
| 89 | After all accounts were created in LDAP the modules may do additional |
| 90 | tasks. LAM will call <span style="font-weight: bold;">doUploadPostActions()</span> |
| 91 | and also provide a list of failed accounts which can be ignored. The |
| 92 | function is called as long the returned status is <span |
| 93 | style="font-style: italic;">"inProgress"</span>. The script uses again |
| 94 | a |
| 95 | meta refresh to handle the maximum execution time.<br> |
| 96 | Typical post actions are setting quotas or adding an user to groups.<br> |
| 97 | <br> |
| 98 | A progress bar is shown for the LDAP adding and the module actions to |
| 99 | give the user a hint how long it will still take.<br> |
| 100 | </div> |
| 101 | </div> |
| 102 | </body> |
| 103 | </html> |