From 3fd63b98d97130a3b5e8aed5c0dcbff14f25ec46 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 25 Aug 2022 08:23:29 +0200 Subject: [PATCH 1/9] add missing column in header of attribute values list --- views/bootstrap/class.AttributeMgr.php | 1 + 1 file changed, 1 insertion(+) diff --git a/views/bootstrap/class.AttributeMgr.php b/views/bootstrap/class.AttributeMgr.php index 16934ddb5..3bf0a9d43 100644 --- a/views/bootstrap/class.AttributeMgr.php +++ b/views/bootstrap/class.AttributeMgr.php @@ -93,6 +93,7 @@ $(document).ready( function() { $content .= "".getMLText("attribute_value")."\n"; $content .= "".getMLText("attribute_count")."\n"; $content .= "\n"; + $content .= "\n"; $content .= "\n\n"; $separator = $selattrdef->getValueSetSeparator(); foreach($res['frequencies'][$type] as $entry) { From 8f4c2f454b462dfed99d542794459644d80d2b1b Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 30 Aug 2022 18:11:00 +0200 Subject: [PATCH 2/9] user uid instead of cn in distinguished name to auth. user --- inc/inc.ClassLdapAuthentication.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inc/inc.ClassLdapAuthentication.php b/inc/inc.ClassLdapAuthentication.php index 402347f18..a62ff280d 100644 --- a/inc/inc.ClassLdapAuthentication.php +++ b/inc/inc.ClassLdapAuthentication.php @@ -55,7 +55,7 @@ class SeedDMS_LdapAuthentication extends SeedDMS_Authentication { /* Check if ldap base dn is set, and use ldap server if it is */ if (isset($settings->_ldapBaseDN)) { $ldapSearchAttribut = "uid="; - $tmpDN = "cn=".$username.",".$settings->_ldapBaseDN; + $tmpDN = "uid=".$username.",".$settings->_ldapBaseDN; } /* Active directory has a different base dn */ @@ -127,6 +127,7 @@ class SeedDMS_LdapAuthentication extends SeedDMS_Authentication { if (!is_bool($search)) { $info = ldap_get_entries($ds, $search); + if (!is_bool($info) && $info["count"]==1 && $info[0]["count"]>0) { $user = $dms->addUser($username, null, $info[0]['cn'][0], $info[0]['mail'][0], $settings->_language, $settings->_theme, "", 0); } From 16d068e43077f6c764e26156527858d30509ae1e Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 30 Aug 2022 18:14:15 +0200 Subject: [PATCH 3/9] add changes for 5.1.27 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 7b32f7c12..2c22f2514 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -10,6 +10,9 @@ - move attributes for documents and folders on search page into own accordion - search page uses conversion mgr for preview images - backport export of search result from seeddms 6.0.x +- ldap authentication used 'uid' instead 'cn' in distinguished name if + the initial bind failed and a second bind with the user's credentials + is done -------------------------------------------------------------------------------- Changes in version 5.1.26 From 107d9a86840fb5f1b66f2ac1084cf95800462618 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 31 Aug 2022 08:38:51 +0200 Subject: [PATCH 4/9] check if file in drop folder is readable --- views/bootstrap/class.DropFolderChooser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/bootstrap/class.DropFolderChooser.php b/views/bootstrap/class.DropFolderChooser.php index f96c0cf31..bae2b04da 100644 --- a/views/bootstrap/class.DropFolderChooser.php +++ b/views/bootstrap/class.DropFolderChooser.php @@ -79,7 +79,7 @@ $('.folderselect').click(function(ev) { $finfo = finfo_open(FILEINFO_MIME_TYPE); while (false !== ($entry = $d->read())) { if($entry != '..' && $entry != '.') { - if($showfolders == 0 && !is_dir($dir.'/'.$entry)) { + if($showfolders == 0 && !is_dir($dir.'/'.$entry) && is_readable($dir.'/'.$entry)) { $c++; $subitem = array('label'=>'', 'attributes'=>array(array('title', getMLText('menu_upload_from_dropfolder')))); if($folder) From f2a211b1bf2aaff8d980323bff5a1f8b7130f86b Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 31 Aug 2022 20:31:59 +0200 Subject: [PATCH 5/9] allow to search for multiple attribute values --- SeedDMS_Core/Core/inc.ClassDMS.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index de4e37330..8c695767a 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -1542,8 +1542,8 @@ class SeedDMS_Core_DMS { if(is_string($attribute)) $attribute = array($attribute); $searchAttributes[] = "EXISTS (SELECT NULL FROM `tblFolderAttributes` WHERE `tblFolderAttributes`.`attrdef`=".$attrdefid." AND (`tblFolderAttributes`.`value` like '%".$valueset[0].implode("%' OR `tblFolderAttributes`.`value` like '%".$valueset[0], $attribute)."%') AND `tblFolderAttributes`.`folder`=`tblFolders`.`id`)"; - } elseif(is_string($attribute)) { - $searchAttributes[] = "EXISTS (SELECT NULL FROM `tblFolderAttributes` WHERE `tblFolderAttributes`.`attrdef`=".$attrdefid." AND `tblFolderAttributes`.`value`='".$attribute."' AND `tblFolderAttributes`.`folder`=`tblFolders`.`id`)"; + } else { + $searchAttributes[] = "EXISTS (SELECT NULL FROM `tblFolderAttributes` WHERE `tblFolderAttributes`.`attrdef`=".$attrdefid." AND (`tblFolderAttributes`.`value`='".(is_array($attribute) ? implode("' OR `tblFolderAttributes`.`value` = '", $attribute) : $attribute)."') AND `tblFolderAttributes`.`folder`=`tblFolders`.`id`)"; } } else { if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date && is_array($attribute)) { @@ -1739,7 +1739,7 @@ class SeedDMS_Core_DMS { $attribute = array($attribute); $lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentAttributes` WHERE `tblDocumentAttributes`.`attrdef`=".$attrdefid." AND (`tblDocumentAttributes`.`value` like '%".$valueset[0].implode("%' OR `tblDocumentAttributes`.`value` like '%".$valueset[0], $attribute)."%') AND `tblDocumentAttributes`.`document` = `tblDocuments`.`id`)"; } else - $lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentAttributes` WHERE `tblDocumentAttributes`.`attrdef`=".$attrdefid." AND `tblDocumentAttributes`.`value`='".$attribute."' AND `tblDocumentAttributes`.`document` = `tblDocuments`.`id`)"; + $lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentAttributes` WHERE `tblDocumentAttributes`.`attrdef`=".$attrdefid." AND (`tblDocumentAttributes`.`value`='".(is_array($attribute) ? implode("' OR `tblDocumentAttributes`.`value` = '", $attribute) : $attribute)."') AND `tblDocumentAttributes`.`document` = `tblDocuments`.`id`)"; } else { if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date && is_array($attribute)) { $kkll = []; @@ -1762,7 +1762,7 @@ class SeedDMS_Core_DMS { $attribute = array($attribute); $lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentContentAttributes` WHERE `tblDocumentContentAttributes`.`attrdef`=".$attrdefid." AND (`tblDocumentContentAttributes`.`value` like '%".$valueset[0].implode("%' OR `tblDocumentContentAttributes`.`value` like '%".$valueset[0], $attribute)."%') AND `tblDocumentContentAttributes`.`content` = `tblDocumentContent`.`id`)"; } else { - $lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentContentAttributes` WHERE `tblDocumentContentAttributes`.`attrdef`=".$attrdefid." AND `tblDocumentContentAttributes`.`value`='".$attribute."' AND `tblDocumentContentAttributes`.content = `tblDocumentContent`.id)"; + $lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentContentAttributes` WHERE `tblDocumentContentAttributes`.`attrdef`=".$attrdefid." AND (`tblDocumentContentAttributes`.`value`='".(is_array($attribute) ? implode("' OR `tblDocumentContentAttributes`.`value` = '", $attribute) : $attribute)."') AND `tblDocumentContentAttributes`.content = `tblDocumentContent`.id)"; } } else { if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date && is_array($attribute)) { From c981129a4bac934d4523df79360f438e303fab7b Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 31 Aug 2022 20:32:32 +0200 Subject: [PATCH 6/9] sort by 'i' or 'n' is like 'ia' or 'na' --- SeedDMS_Core/Core/inc.ClassDMS.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index 8c695767a..bfda37984 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -1630,12 +1630,14 @@ class SeedDMS_Core_DMS { $searchQuery .= " ORDER BY `tblFolders`.`name` DESC"; break; case 'na': + case 'n': $searchQuery .= " ORDER BY `tblFolders`.`name`"; break; case 'id': $searchQuery .= " ORDER BY `tblFolders`.`id` DESC"; break; case 'ia': + case 'i': $searchQuery .= " ORDER BY `tblFolders`.`id`"; break; default: @@ -1934,12 +1936,14 @@ class SeedDMS_Core_DMS { $orderbyQuery = " ORDER BY `tblDocuments`.`name` DESC"; break; case 'na': + case 'n': $orderbyQuery = " ORDER BY `tblDocuments`.`name`"; break; case 'id': $orderbyQuery = " ORDER BY `tblDocuments`.`id` DESC"; break; case 'ia': + case 'i': $orderbyQuery = " ORDER BY `tblDocuments`.`id`"; break; default: From 4ac560c8d1abdee1689bac66e379e4013f765e2d Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 31 Aug 2022 20:32:51 +0200 Subject: [PATCH 7/9] value of extracols can be an array --- inc/inc.ClassDownloadMgr.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/inc.ClassDownloadMgr.php b/inc/inc.ClassDownloadMgr.php index e6636ab0e..1958e652e 100644 --- a/inc/inc.ClassDownloadMgr.php +++ b/inc/inc.ClassDownloadMgr.php @@ -170,7 +170,7 @@ class SeedDMS_Download_Mgr { $col += 4; if(isset($this->extracols[$item->getID()]) && $this->extracols[$item->getID()]) { foreach($this->extracols[$item->getID()] as $column) - $sheet->setCellValueByColumnAndRow($col++, $i, $column); + $sheet->setCellValueByColumnAndRow($col++, $i, is_array($column) ? implode("\n", $column) : $column ); } $i = max($l, $k); $i++; From f6d0fb85fdd05a30e5e2d2ebaac79886672b0c5e Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 31 Aug 2022 20:38:20 +0200 Subject: [PATCH 8/9] add parameter $alwaysmultiple getAttributeEditField() which makes select fields always multiple --- views/bootstrap/class.Bootstrap.php | 14 +++++++------- views/bootstrap4/class.Bootstrap4.php | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index e0d831487..f690b777b 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -1830,11 +1830,11 @@ $(document).ready(function() { } } /* }}} */ - function printAttributeEditField($attrdef, $attribute, $fieldname='attributes', $norequire=false, $namepostfix='') { /* {{{ */ - echo self::getAttributeEditField($attrdef, $attribute, $fieldname, $norequire, $namepostfix); + function printAttributeEditField($attrdef, $attribute, $fieldname='attributes', $norequire=false, $namepostfix='', $alwaysmultiple=false) { /* {{{ */ + echo self::getAttributeEditField($attrdef, $attribute, $fieldname, $norequire, $namepostfix, $alwaysmultiple); } /* }}} */ - function getAttributeEditField($attrdef, $attribute, $fieldname='attributes', $norequire=false, $namepostfix='') { /* {{{ */ + function getAttributeEditField($attrdef, $attribute, $fieldname='attributes', $norequire=false, $namepostfix='', $alwaysmultiple=false) { /* {{{ */ $dms = $this->params['dms']; $content = ''; switch($attrdef->getType()) { @@ -1880,7 +1880,7 @@ $(document).ready(function() { $users = $dms->getAllUsers(); if($users) { $allowempty = $attrdef->getMinValues() == 0; - $allowmultiple = $attrdef->getMultipleValues(); + $allowmultiple = $attrdef->getMultipleValues() || $alwaysmultiple; $content .= "getId()."]".($allowmultiple ? '[]' : '')."\"".($allowmultiple ? " multiple" : "")." data-placeholder=\"".getMLText("select_group")."\">"; if($allowempty) $content .= ""; @@ -1919,13 +1919,13 @@ $(document).ready(function() { if($valueset = $attrdef->getValueSetAsArray()) { $content .= "getId()."]\" value=\"\"/>"; $content .= "getId()."]".($allowmultiple ? '[]' : '')."\"".($allowmultiple ? " multiple" : "")." data-placeholder=\"".getMLText("select_user")."\">"; if($allowempty) $content .= ""; @@ -1948,7 +1948,7 @@ $(document).ready(function() { $groups = $dms->getAllGroups(); if($groups) { $allowempty = $attrdef->getMinValues() == 0; - $allowmultiple = $attrdef->getMultipleValues(); + $allowmultiple = $attrdef->getMultipleValues() || $alwaysmultiple; $content .= "getId()."]\" value=\"\"/>"; $content .= "