diff --git a/README.md b/README.md index 13d7fba..2689181 100644 --- a/README.md +++ b/README.md @@ -344,11 +344,13 @@ LDAP_ACCOUNT_ADDITIONAL_ATTRIBUTES=mailAlias+:Email aliases" ### Binary attributes -If you have an attribute that stores the contents of a binary file (for example, a JPEG) then you can add a `^` to the end of the attribute name. This will modify the form so that this attribute has an upload button. If a file has already been uploaded then a link to view or download the file will be shown. For example, to allow you to set a user's photo: +If you have an attribute that stores the contents of a binary file (for example, a JPEG) then you can add a `^` to the end of the attribute name. This will modify the form so that this attribute has an upload button. If a JPEG has already been uploaded then it will display the image. Otherwise the mime-type is displayed and there's a link for downloading the file. For example, to allow you to set a user's photo: ``` LDAP_ACCOUNT_ADDITIONAL_ATTRIBUTES=jpegPhoto^:Photograph" ``` +The maximum filesize you can upload is 2MB. + ### Caveat diff --git a/www/account_manager/download.php b/www/account_manager/download.php new file mode 100644 index 0000000..04734b4 --- /dev/null +++ b/www/account_manager/download.php @@ -0,0 +1,41 @@ + diff --git a/www/account_manager/new_user.php b/www/account_manager/new_user.php index 545dcb8..6ea5502 100644 --- a/www/account_manager/new_user.php +++ b/www/account_manager/new_user.php @@ -13,26 +13,27 @@ if (! array_key_exists($LDAP['account_attribute'], $attribute_map)) { } if ( isset($_POST['setup_admin_account']) ) { - $admin_setup = TRUE; - validate_setup_cookie(); - set_page_access("setup"); + $admin_setup = TRUE; - $completed_action="${SERVER_PATH}log_in"; - $page_title="New administrator account"; + validate_setup_cookie(); + set_page_access("setup"); - render_header("$ORGANISATION_NAME account manager - setup administrator account", FALSE); + $completed_action="${SERVER_PATH}log_in"; + $page_title="New administrator account"; + + render_header("$ORGANISATION_NAME account manager - setup administrator account", FALSE); } else { - set_page_access("admin"); + set_page_access("admin"); - $completed_action="${THIS_MODULE_PATH}/"; - $page_title="New account"; - $admin_setup = FALSE; + $completed_action="${THIS_MODULE_PATH}/"; + $page_title="New account"; + $admin_setup = FALSE; - render_header("$ORGANISATION_NAME account manager"); - render_submenu(); + render_header("$ORGANISATION_NAME account manager"); + render_submenu(); } $invalid_password = FALSE; @@ -49,6 +50,17 @@ $new_account_r = array(); foreach ($attribute_map as $attribute => $attr_r) { + if (isset($_FILES[$attribute]['size']) and $_FILES[$attribute]['size'] > 0) { + + $this_attribute = array(); + $this_attribute['count'] = 1; + $this_attribute[0] = file_get_contents($_FILES[$attribute]['tmp_name']); + $$attribute = $this_attribute; + $new_account_r[$attribute] = $this_attribute; + unset($new_account_r[$attribute]['count']); + + } + if (isset($_POST[$attribute])) { $this_attribute = array(); @@ -323,7 +335,7 @@ $tabindex=1;