From 6f9b2af11226665e6ec4ceeca9e4a651d2bd2403 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 27 Feb 2010 19:14:15 +0000 Subject: [PATCH] allow to disable file uploads for account types --- lam/docs/devel/upgrade.htm | 7 +++++-- lam/lib/baseType.inc | 12 ++++++++++-- lam/templates/masscreate.php | 12 ++++++++++-- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/lam/docs/devel/upgrade.htm b/lam/docs/devel/upgrade.htm index 5ccde682..331f9caa 100644 --- a/lam/docs/devel/upgrade.htm +++ b/lam/docs/devel/upgrade.htm @@ -1,6 +1,7 @@ + Upgrade notes @@ -29,9 +30,11 @@ There is a new log level LOG_DEBUG available for logNewMessage(). The function build_uploadAccounts() has a new parameter -$selectedModules -.
+$selectedModules.
+

Type interface:

+ +The new function supportsFileUpload() specifies if file uploads are supported (default true).


diff --git a/lam/lib/baseType.inc b/lam/lib/baseType.inc index 8c7f1e7a..fc4a4a75 100644 --- a/lam/lib/baseType.inc +++ b/lam/lib/baseType.inc @@ -3,7 +3,7 @@ $Id$ This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) - Copyright (C) 2005 - 2006 Roland Gruber + Copyright (C) 2005 - 2010 Roland Gruber This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -94,7 +94,15 @@ class baseType { public function getListAttributeDescriptions() { return array(); } - + + /** + * Returns if entries of this type may be created via file upload. + * + * @return boolean true, if file upload is supported + */ + public function supportsFileUpload() { + return true; + } } diff --git a/lam/templates/masscreate.php b/lam/templates/masscreate.php index 666f19b6..d35eba95 100644 --- a/lam/templates/masscreate.php +++ b/lam/templates/masscreate.php @@ -67,10 +67,18 @@ if (isset($_GET['getCSV'])) { exit; } -$types = $_SESSION['config']->get_ActiveTypes(); - include 'main_header.php'; +// get possible types and remove those which do not support file upload +$types = $_SESSION['config']->get_ActiveTypes(); +for ($i = 0; $i < sizeof($types); $i++) { + $myType = new $types[$i](); + if (!$myType->supportsFileUpload()) { + unset($types[$i]); + } +} +$types = array_values($types); + // check if account specific page should be shown if (isset($_POST['type'])) { // get selected type