Compare commits

..

No commits in common. "db491f51e767497bb9d783d39bf3147f55c5bcd5" and "48e5d45d325bf8ad59bab8b31474f1224d338366" have entirely different histories.

5 changed files with 13 additions and 53 deletions

View file

@ -137,21 +137,12 @@ function sortLogEntriesByDate(&$a, &$b) {
return ($astart === $bstart) ? 0 : ($astart < $bstart) ? -1 : 1;
}
function getEntryAccessLog($dn, $start_date=null, $include_ldapsaisie=true) {
function getEntryAccessLog($dn, $start_date=null) {
$filter = Net_LDAP2_Filter::create('reqDn', 'equals', $dn);
if ($start_date) {
$date_filter = Net_LDAP2_Filter::create('reqStart', 'greaterOrEqual', $start_date);
$filter = Net_LDAP2_Filter::combine('and', array($filter, $date_filter));
}
if (!$include_ldapsaisie) {
$not_ldapsaisie_filter = Net_LDAP2_Filter::combine('not', array(
Net_LDAP2_Filter::create(
'reqAuthzID', 'equals',
LSconfig::get('ldap_servers.'.LSsession::get('ldap_server_id').'.ldap_config.binddn')
)
));
$filter = Net_LDAP2_Filter::combine('and', array($filter, $not_ldapsaisie_filter));
}
$entries = LSldap::search(
$filter,
LS_ACCESSLOG_BASEDN,
@ -188,20 +179,19 @@ function getEntryAccessLog($dn, $start_date=null, $include_ldapsaisie=true) {
}
}
if ($new_dn) {
$next_logs = getEntryAccessLog($new_dn, $rename_date, $include_ldapsaisie);
$next_logs = getEntryAccessLog($new_dn, $rename_date);
if (is_array($next_logs))
$logs = array_merge($logs, $next_logs);
}
return $start_date?$logs:array_reverse($logs);
}
function getEntryAccessLogPage($dn, $page = false, $refresh=false, $include_ldapsaisie=true, $nbByPage = null) {
$nbByPage = is_null($nbByPage)?30:intval($nbByPage);
function getEntryAccessLogPage($dn, $page = false, $nbByPage = 30) {
if (!isset($_SESSION['entryAccessLogPages'])) {
$_SESSION['entryAccessLogPages'] = array();
}
if (!isset($_SESSION['entryAccessLogPages'][$dn]) || $refresh) {
$_SESSION['entryAccessLogPages'][$dn] = getEntryAccessLog($dn, null, $include_ldapsaisie);
if (!isset($_SESSION['entryAccessLogPages'][$dn]) || isset($_REQUEST['refresh'])) {
$_SESSION['entryAccessLogPages'][$dn] = getEntryAccessLog($dn);
}
if (!is_int($page)) {
$page = 1;
@ -218,28 +208,14 @@ function getEntryAccessLogPage($dn, $page = false, $refresh=false, $include_ldap
}
function showObjectAccessLogs($obj) {
$refresh = isset($_REQUEST['refresh']);
$include_ldapsaisie = !LS_ACCESSLOG_LOG_WRITE_EVENTS;
if (isset($_REQUEST['include_ldapsaisie'])) {
$include_ldapsaisie = boolval($_REQUEST['include_ldapsaisie']);
$refresh = true;
}
elseif (isset($_SESSION['accesslog_include_ldapsaisie']))
$include_ldapsaisie = $_SESSION['accesslog_include_ldapsaisie'];
$_SESSION['accesslog_include_ldapsaisie'] = $include_ldapsaisie;
$pageNb = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1;
$dn = $obj->getDn();
$page = getEntryAccessLogPage($dn, $pageNb, $refresh, $include_ldapsaisie);
$page = getEntryAccessLogPage($dn, $pageNb);
if (!is_array($page)) {
return;
}
LStemplate::assign('page', $page);
$LSview_actions = array();
$LSview_actions['include_ldapsaisie'] = array (
'label' => $include_ldapsaisie?_('Hide LdapSaisie modifications'):_('Show LdapSaisie modifications'),
'url' => 'object/'.$obj->getType().'/'.urlencode($dn).'/customAction/showObjectAccessLogs?include_ldapsaisie='.intval(!$include_ldapsaisie),
'action' => $include_ldapsaisie?'hide':'view',
);
$LSview_actions['refresh'] = array (
'label' => _('Refresh'),
'url' => 'object/'.$obj->getType().'/'.urlencode($dn).'/customAction/showObjectAccessLogs?refresh',
@ -377,7 +353,7 @@ function hashPasswordForLogs($password) {
if(defined('MHASH_SHA512') && function_exists('mhash') && function_exists('mhash_keygen_s2k')) {
mt_srand( (double) microtime() * 1000000 );
$salt = mhash_keygen_s2k(MHASH_SHA512, $password, substr( pack( "h*", md5( mt_rand() ) ), 0, 8 ), 4 );
return "{SSHA512}".base64_encode(mhash(MHASH_SHA512, $password.$salt).$salt);
return "{SSHA512}".base64_encode(mhash($mhash_type, $password.$salt).$salt);
}
return '[not logged]';
}

View file

@ -485,7 +485,7 @@ class LScli extends LSlog_staticLoggerClass {
self :: unquote_word($ldap_server_subDn);
self :: need_ldap_con();
if(!LSsession :: setSubDn($ldap_server_subDn))
self :: usage(_("Fail to select sub DN '%s'."), $ldap_server_subDn);
self :: usage(_("Fail to select sub DN '%s'.", $ldap_server_subDn));
break;
case '-L':
case '--load-class':

View file

@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: LdapSaisie\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2023-03-28 12:20+0200\n"
"PO-Revision-Date: 2023-03-21 12:59+0100\n"
"Last-Translator: Benjamin Renard <brenard@easter-eggs.com>\n"
"Language-Team: LdapSaisie <ldapsaisie-users@lists.labs.libre-entreprise."
"org>\n"
@ -278,7 +278,7 @@ msgid "Download"
msgstr "Télécharger"
#: includes/addons/LSaddons.showSupportInfo.php:78
#: includes/addons/LSaddons.accesslog.php:249
#: includes/addons/LSaddons.accesslog.php:225
#: includes/addons/LSaddons.showTechInfo.php:117
msgid "Go back"
msgstr "Retour"
@ -426,15 +426,7 @@ msgstr "Remplacer"
msgid "Increment"
msgstr "Incrémenter"
#: includes/addons/LSaddons.accesslog.php:239
msgid "Hide LdapSaisie modifications"
msgstr "Cacher les modifications d'LdapSaisie"
#: includes/addons/LSaddons.accesslog.php:239
msgid "Show LdapSaisie modifications"
msgstr "Voir les modifications d'LdapSaisie"
#: includes/addons/LSaddons.accesslog.php:244
#: includes/addons/LSaddons.accesslog.php:220
#: includes/class/class.LSsession.php:1855 includes/routes.php:157
#: includes/routes.php:470 templates/default/select.tpl:29
msgid "Refresh"

View file

@ -217,7 +217,7 @@ msgid "Download"
msgstr ""
#: includes/addons/LSaddons.showSupportInfo.php:78
#: includes/addons/LSaddons.accesslog.php:249
#: includes/addons/LSaddons.accesslog.php:225
#: includes/addons/LSaddons.showTechInfo.php:117
msgid "Go back"
msgstr ""
@ -350,15 +350,7 @@ msgstr ""
msgid "Increment"
msgstr ""
#: includes/addons/LSaddons.accesslog.php:239
msgid "Hide LdapSaisie modifications"
msgstr ""
#: includes/addons/LSaddons.accesslog.php:239
msgid "Show LdapSaisie modifications"
msgstr ""
#: includes/addons/LSaddons.accesslog.php:244
#: includes/addons/LSaddons.accesslog.php:220
#: includes/class/class.LSsession.php:1855 includes/routes.php:157
#: includes/routes.php:470 templates/default/select.tpl:29
msgid "Refresh"