diff --git a/CHANGELOG b/CHANGELOG index 19d90e506..5470b1c83 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -242,6 +242,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 diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index 9e83b0cd1..82003811d 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -2129,8 +2129,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)) { @@ -2217,12 +2217,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: @@ -2326,7 +2328,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 = []; @@ -2349,7 +2351,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)) { @@ -2571,12 +2573,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: 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++; diff --git a/inc/inc.ClassLdapAuthentication.php b/inc/inc.ClassLdapAuthentication.php index 8513d50b4..f3e9245a3 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, "", 3); } diff --git a/views/bootstrap/class.AttributeMgr.php b/views/bootstrap/class.AttributeMgr.php index 0ad48991b..03aaa3005 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) { diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index c57174bac..1eed820d0 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -1960,11 +1960,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()) { @@ -2010,7 +2010,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 .= ""; @@ -2049,13 +2049,13 @@ $(document).ready(function() { if($valueset = $attrdef->getValueSetAsArray()) { $content .= "getId()."]\" value=\"\"/>"; $content .= "getId()."]".($allowmultiple ? '[]' : '')."\"".($allowmultiple ? " multiple" : "")." data-placeholder=\"".getMLText("select_user")."\">"; if($allowempty) $content .= ""; @@ -1997,7 +1997,7 @@ $(document).ready(function() { $groups = $dms->getAllGroups(); if($groups) { $allowempty = $attrdef->getMinValues() == 0; - $allowmultiple = $attrdef->getMultipleValues(); + $allowmultiple = $attrdef->getMultipleValues() || $alwaysmultiple; $content .= "getId()."]\" value=\"\"/>"; $content .= "