diff --git a/lam/HISTORY b/lam/HISTORY index 33fb8f09..bb8c15a1 100644 --- a/lam/HISTORY +++ b/lam/HISTORY @@ -1,7 +1,9 @@ ??? 2.2.0 - - account lists: allow to switch sorting - - account lists: added separate configuration page and store settings in cookies - - account lists: new PDF buttons + - account lists: + -> allow to switch sorting + -> added separate configuration page and store settings in cookies + -> list size can now be set individually for each account type on the list configuration page + -> new PDF buttons - use suffix from account list as default for new accounts (patch 1823583) - Security: passwords in configuration files are now saved as hash values - improved design diff --git a/lam/config/lam.conf_sample b/lam/config/lam.conf_sample index 958adb28..92a3bcf1 100644 --- a/lam/config/lam.conf_sample +++ b/lam/config/lam.conf_sample @@ -15,9 +15,6 @@ passwd: {SSHA}RjBruJcTxZEdcBjPQdRBkDaSQeY= iueleA== # e.g. dc=yourdomain,dc=org treesuffix: dc=yourdomain,dc=org -# maximum number of rows to show in user/group/host lists -maxlistentries: 30 - # default language (a line from config/language) defaultLanguage: en_GB.utf8:UTF-8:English (Great Britain) @@ -27,6 +24,9 @@ scriptPath: # Server of external Script scriptServer: +# Access rights for home directories +scriptRights: 750 + # Number of minutes LAM caches LDAP searches. cachetimeout: 5 diff --git a/lam/docs/devel/lists.htm b/lam/docs/devel/lists.htm index 348b51f0..16d07aa1 100644 --- a/lam/docs/devel/lists.htm +++ b/lam/docs/devel/lists.htm @@ -1,17 +1,13 @@ - - - - LAM - Account lists - - - + + + + LAM - Account lists + +

Account lists


-
Account lists
+
Account lists


@@ -21,17 +17,14 @@ list of found accounts which can be restricted by LDAP filters and the LDAP OU (Organizational Unit).

The list of LDAP attributes and thus table columns is taken from the -configuration profile (get_...listAttributes() +configuration profile (get_...listAttributes() in config.inc). Each account list has a separate list of attributes.
Only these attributes are given the LDAP search as attribute parameter.
There is also a predefined description list for the attributes in lists.inc. The user may use other values by setting them in the configuration profile.

-The number of accounts per page is limited in the configuration profile -(get_MaxListEntries() -in config.inc). There will be links at the beginning and end of the +The number of accounts per page is limited by a list option. There will be links at the beginning and end of the list if more accounts were found.

Several common helper functions for sorting and some page elements @@ -40,8 +33,7 @@ reside in lists.inc.

1. Getting accounts from LDAP

Each account list has its own LDAP suffix which is saved in the configuration profile. This is used as search base.
-The account modules provide an LDAP filter (get_ldap_filter() +The account modules provide an LDAP filter (get_ldap_filter() in modules.inc) to get only accounts of a special type.

This list can be further reduced if the user provides an additional @@ -78,8 +70,7 @@ clicking the row if Java Script is enabled.


4. Export to PDF

-The user can generate PDF files for the accounts. This is done by the createModulePDF() +The user can generate PDF files for the accounts. This is done by the createModulePDF() function from pdf.inc.


@@ -99,5 +90,4 @@ and redirects to account/edit.php for account modifying.



- - + \ No newline at end of file diff --git a/lam/help/help.inc b/lam/help/help.inc index 8c6c119b..c584f17b 100644 --- a/lam/help/help.inc +++ b/lam/help/help.inc @@ -90,8 +90,8 @@ $helpArray = array ( "

" . _("Example") . ": cn=admin,dc=yourdomain,dc=org;cn=manager,dc=yourdomain,dc=org"), - "208" => array ("ext" => "FALSE", "Headline" => _("Configuration wizard") . " - " . _("Maximum list entries"), - "Text" => _("This is the number of rows to show in the user/group/host list. If more entries are found the list will be split into several pages.")), + "208" => array ("ext" => "FALSE", "Headline" => _("Maximum list entries"), + "Text" => _("This is the number of rows to show in the account list. If more entries are found the list will be split into several pages.")), "209" => array ("ext" => "FALSE", "Headline" => _("Configuration wizard") . " - " . _("Default language"), "Text" => _("This defines the language of the login window and sets this language as the default language. Users can change the language at login.")), "210" => array ("ext" => "FALSE", "Headline" => _("Configuration wizard") . " - " . _("Script path"), diff --git a/lam/lib/config.inc b/lam/lib/config.inc index 503165cc..6b156fd5 100644 --- a/lam/lib/config.inc +++ b/lam/lib/config.inc @@ -175,9 +175,6 @@ class LAMConfig { /** LDAP suffix for tree view */ var $treesuffix; - /** Maximum number of rows shown in user/group/host lists */ - var $maxlistentries; - /** Default language */ var $defaultLanguage; @@ -218,7 +215,7 @@ class LAMConfig { var $file; /** List of all settings in config file */ - private $settings = array("ServerURL", "Passwd", "Admins", "treesuffix", "maxlistentries", + private $settings = array("ServerURL", "Passwd", "Admins", "treesuffix", "defaultLanguage", "scriptPath", "scriptServer", "scriptRights", "cachetimeout", "modules", "activeTypes", "types"); @@ -357,7 +354,6 @@ class LAMConfig { "# e.g. admins: cn=admin,dc=yourdomain,dc=org;cn=root,dc=yourdomain,dc=org\n" . "admins: " . $this->Admins . "\n"); if (!in_array("treesuffix", $saved)) array_push($file_array, "\n\n# suffix of tree view\n" . "# e.g. dc=yourdomain,dc=org\n" . "treesuffix: " . $this->treesuffix . "\n"); - if (!in_array("maxlistentries", $saved)) array_push($file_array, "\n\n# maximum number of rows to show in user/group/host lists\n" . "maxlistentries: " . $this->maxlistentries . "\n"); if (!in_array("defaultLanguage", $saved)) array_push($file_array, "\n\n# default language (a line from config/language)\n" . "defaultLanguage: " . $this->defaultLanguage . "\n"); if (!in_array("scriptPath", $saved)) array_push($file_array, "\n\n# Path to external Script\n" . "scriptPath: " . $this->scriptPath . "\n"); if (!in_array("scriptServer", $saved)) array_push($file_array, "\n\n# Servers of external script\n" . "scriptServer: " . $this->scriptServer . "\n"); @@ -580,27 +576,6 @@ class LAMConfig { } } - /** - * Returns the maximum number of rows in user/group/host lists - * - * @return integer maximum number - */ - public function get_MaxListEntries() { - return $this->maxlistentries; - } - - /** - * Sets the maximum number of rows in user/group/host lists - * - * @param integer $value new maximum value - * @return boolean true if $value has correct format - */ - public function set_MaxListEntries ($value) { - if (is_numeric($value)) $this->maxlistentries = $value; - else return false; - return true; - } - /** * Returns the default language string * diff --git a/lam/lib/lists.inc b/lam/lib/lists.inc index ee69571a..0dcdef5b 100644 --- a/lam/lib/lists.inc +++ b/lam/lib/lists.inc @@ -59,7 +59,7 @@ class lamList { protected $descArray = array(); /** maximum count of entries per page */ - protected $maxPageEntries = 10; + protected $maxPageEntries = 30; /** sort column name */ protected $sortColumn; @@ -88,6 +88,9 @@ class lamList { /** configuration options */ private $configOptions; + /** ID for list size config option */ + const LIST_SIZE_OPTION_NAME = "L_SIZE"; + /** * Constructor * @@ -786,11 +789,6 @@ class lamList { $temp_array = $this->listGetAttributeDescriptionList(); $this->attrArray = array_keys($temp_array); // list of LDAP attributes to show $this->descArray = array_values($temp_array); // list of descriptions for the attributes - // get maximum count of entries shown on one page - if ($_SESSION["config"]->get_MaxListEntries() <= 0) - $this->maxPageEntries = 10; // default setting, if not yet set - else - $this->maxPageEntries = $_SESSION["config"]->get_MaxListEntries(); // get sorting column if (isset($_GET["sort"])) { if ($_GET["sort"] == $this->sortColumn) { @@ -867,7 +865,8 @@ class lamList { * @return array list of lamListOption objects */ protected function listGetAllConfigOptions() { - return array(); + $listSizeOption = new lamSelectListOption(_("Maximum list entries"), array(10, 20, 30, 50, 75, 100), self::LIST_SIZE_OPTION_NAME); + return array($listSizeOption); } /** @@ -886,7 +885,7 @@ class lamList { $tabindex = 0; $tabindexLink = 0; for ($i = 0; $i < sizeof($this->configOptions); $i++) { - parseHtml('none', $this->configOptions[$i]->getMetaHTML(), array(), true, $tabindex, $tabindexLink, $this->type); + parseHtml('main', $this->configOptions[$i]->getMetaHTML(), array(), true, $tabindex, $tabindexLink, $this->type); } echo "
"; @@ -916,6 +915,10 @@ class lamList { * Called when the configuration options changed. */ protected function listConfigurationChanged() { + $sizeOption = $this->listGetConfigOptionByID(self::LIST_SIZE_OPTION_NAME); + if ($sizeOption->getValue() != null) { + $this->maxPageEntries = $sizeOption->getValue(); + } return; } @@ -994,7 +997,7 @@ abstract class lamListOption { /** * Creates a new config option. * - * @param String $ID + * @param String $ID unique ID * @return lamConfigOption config option */ public function lamConfigOption($ID) { @@ -1061,6 +1064,7 @@ class lamBooleanListOption extends lamListOption { * Creates a new boolean option. * * @param String $name name to show on config page + * @param String $ID unique ID * @return lamBooleanListOption config option */ public function lamBooleanListOption($name, $ID) { @@ -1107,4 +1111,70 @@ class lamBooleanListOption extends lamListOption { } +/** + * Boolean option for list configuration. + * + * @package lists + * @author Roland Gruber + */ +class lamSelectListOption extends lamListOption { + + private $name; + private $options; + private $helpID; + + /** + * Creates a new selection list option. + * + * @param String $name name to show on config page + * @param array $options list of possible values + * @param String $ID unique ID + * @return lamBooleanListOption config option + */ + public function lamSelectListOption($name, $options, $ID) { + parent::lamConfigOption($ID); + $this->name = $name; + $this->options = $options; + } + + /** + * Sets the help ID. + * + * @param Strign $id help ID + */ + public function setHelpID($id) { + $this->helpID = $id; + } + + /** + * Fills the config option from POST data. + * + * @return array list of StatusMessages (array(, , )) + */ + public function fillFromPostData() { + if (isset($_POST[$this->getID()])) { + $this->setValue($_POST[$this->getID()]); + } + else { + $this->setValue(null); + } + } + + /** + * Returns the meta HTML data to display this option. + * + * @return array meta HTML + */ + public function getMetaHTML() { + $return = array(); + $return[] = array( + array('kind' => 'text', 'text' => $this->name), + array('kind' => 'select', 'name' => $this->getID(), 'options' => $this->options, 'options_selected' => array($this->getValue())), + array('kind' => 'help', 'value' => '208') + ); + return $return; + } + +} + ?> \ No newline at end of file diff --git a/lam/lib/types/group.inc b/lam/lib/types/group.inc index 9022e0f6..13aeed2b 100644 --- a/lam/lib/types/group.inc +++ b/lam/lib/types/group.inc @@ -257,13 +257,16 @@ class lamGroupList extends lamList { * @return array list of lamListOption objects */ protected function listGetAllConfigOptions() { - return array(new lamBooleanListOption(_('Show primary group members as normal group members'), self::TRANS_PRIMARY_OPTION_NAME)); + $options = parent::listGetAllConfigOptions(); + $options[] = new lamBooleanListOption(_('Show primary group members as normal group members'), self::TRANS_PRIMARY_OPTION_NAME); + return $options; } /** * Called when the configuration options changed. */ protected function listConfigurationChanged() { + parent::listConfigurationChanged(); $tpOption = $this->listGetConfigOptionByID(self::TRANS_PRIMARY_OPTION_NAME); $use_primary = $this->include_primary; $this->include_primary = $tpOption->isSelected(); diff --git a/lam/lib/types/user.inc b/lam/lib/types/user.inc index 73da1401..f3b7199e 100644 --- a/lam/lib/types/user.inc +++ b/lam/lib/types/user.inc @@ -237,13 +237,16 @@ class lamUserList extends lamList { * @return array list of lamListOption objects */ protected function listGetAllConfigOptions() { - return array(new lamBooleanListOption(_('Translate GID number to group name'), self::TRANS_PRIMARY_OPTION_NAME)); + $options = parent::listGetAllConfigOptions(); + $options[] = new lamBooleanListOption(_('Translate GID number to group name'), self::TRANS_PRIMARY_OPTION_NAME); + return $options; } /** * Called when the configuration options changed. */ protected function listConfigurationChanged() { + parent::listConfigurationChanged(); $tpOption = $this->listGetConfigOptionByID(self::TRANS_PRIMARY_OPTION_NAME); $this->trans_primary = $tpOption->isSelected(); } diff --git a/lam/templates/config/confmain.php b/lam/templates/config/confmain.php index 35a90def..33f796dd 100644 --- a/lam/templates/config/confmain.php +++ b/lam/templates/config/confmain.php @@ -253,31 +253,6 @@ for ($i = 0; $i < sizeof($modules); $i++) { } -echo ("
" . _("List settings") . "\n"); -echo ("\n"); - -// maximum list entries -echo ("". - "\n"); -$tabindex++; -echo "\n"; - -echo ("
". - _("Maximum list entries") . ": "; -echo ""; -echo "\"""; -echo "\n"; -echo "
\n"); -echo ("
\n"); -echo ("

\n"); - echo ("
" . _("Language settings") . "\n"); echo ("\n"); @@ -498,9 +473,6 @@ function saveSettings() { if (!$conf->set_Suffix("tree", $_POST['sufftree'])) { $errors[] = array("ERROR", _("TreeSuffix is invalid!")); } - if (!$conf->set_MaxListEntries($_POST['maxlistentries'])) { - $errors[] = array("ERROR", _("Max list entries is invalid!")); - } if (!$conf->set_defaultLanguage($_POST['lang'])) { $errors[] = array("ERROR", _("Language is not defined!")); } diff --git a/lam/tests/conf-test.php b/lam/tests/conf-test.php index 0c9bbc44..24287ead 100644 --- a/lam/tests/conf-test.php +++ b/lam/tests/conf-test.php @@ -47,7 +47,6 @@ $Suff_domains = $conf->get_Suffix('smbDomain'); $userlistAttributes = $conf->get_listAttributes('user'); $grouplistAttributes = $conf->get_listAttributes('group'); $hostlistAttributes = $conf->get_listAttributes('host'); -$maxlistentries = $conf->get_maxlistentries(); $defaultlanguage = $conf->get_defaultlanguage(); $scriptpath = $conf->get_scriptPath(); $scriptServer = $conf->get_scriptServers(); @@ -67,7 +66,6 @@ $conf->set_Suffix('smbDomain', "ou=testdom,o=test,c=de"); $conf->set_listAttributes("#uid;#cn", 'user'); $conf->set_listAttributes("#gidNumber;#cn;#memberUID", 'group'); $conf->set_listAttributes("#cn;#uid;#description", 'host'); -$conf->set_maxlistentries("54"); $conf->set_defaultlanguage("de_AT:iso639_de:Deutsch (Oesterreich)"); $conf->set_scriptPath("/var/www/lam/lib/script"); $conf->set_scriptServers("127.0.0.1"); @@ -89,7 +87,6 @@ if ($conf2->get_Suffix('smbDomain') != "ou=testdom,o=test,c=de") echo ("
get_listAttributes('user') != "#uid;#cn") echo ("
Saving userlistAttributes failed!
"); if ($conf2->get_listAttributes('group') != "#gidNumber;#cn;#memberUID") echo ("
Saving grouplistAttributes failed!
"); if ($conf2->get_listAttributes('host') != "#cn;#uid;#description") echo ("
Saving hostlistAttributes failed!
"); -if ($conf2->get_maxlistentries() != "54") echo ("
Saving maxlistentries failed!
"); if ($conf2->get_defaultlanguage() != "de_AT:iso639_de:Deutsch (Oesterreich)") echo ("
Saving default language failed!
"); if ($conf2->get_scriptPath() != "/var/www/lam/lib/script") echo ("
Saving script path failed!
"); if ($conf2->get_scriptServers() != "127.0.0.1") echo ("
Saving script server failed!
"); @@ -110,7 +107,6 @@ $conf2->set_Suffix('smbDomain', $Suff_domains); $conf2->set_listAttributes($userlistAttributes, 'user'); $conf2->set_listAttributes($grouplistAttributes, 'group'); $conf2->set_listAttributes($hostlistAttributes, 'host'); -$conf2->set_maxlistentries($maxlistentries); $conf2->set_defaultLanguage($defaultlanguage); $conf2->set_scriptPath($scriptpath); $conf2->set_scriptServers($scriptServer);