fixes #1838 ability to hide connections from activities with a config setting

This commit is contained in:
plegall 2022-12-21 17:18:31 +01:00
parent 80b64e32fa
commit 3b36ff0a91
2 changed files with 28 additions and 23 deletions

View file

@ -750,6 +750,12 @@ $conf['dashboard_check_for_updates'] = true;
// Number Weeks displayed on activity chart on the dashboard
$conf['dashboard_activity_nb_weeks'] = 4;
// On the Admin>Users>Activity page, should we display the connection/disconnections?
// 'all' = do not filter, display all
// 'admins_only' = only display connections of admin users
// 'none' = don't even display connections of admin users
$conf['activity_display_connections'] = 'admins_only';
// On album mover page, number of seconds before auto openning album when
// dragging an album. In milliseconds. 3 seconds by default.
$conf['album_move_delay_before_auto_opening'] = 3*1000;

View file

@ -434,7 +434,6 @@ function ws_getActivityList($param, &$service)
$user_ids = array();
if (isset($param['uid'])) {
$query = '
SELECT
activity_id,
@ -447,29 +446,29 @@ SELECT
occured_on,
details,
user_agent
FROM '.ACTIVITY_TABLE.'
WHERE performed_by = '.$param['uid'].'
ORDER BY activity_id DESC LIMIT '.$page_size.' OFFSET '.$page_offset.';
;';
}
else
FROM '.ACTIVITY_TABLE;
if (isset($param['uid']))
{
$query = '
SELECT
activity_id,
performed_by,
object,
object_id,
action,
session_idx,
ip_address,
occured_on,
details,
user_agent
FROM '.ACTIVITY_TABLE.'
ORDER BY activity_id DESC LIMIT '.$page_size.' OFFSET '.$page_offset.';
;';
$query.= '
WHERE performed_by = '.$param['uid'];
}
elseif ('none' == $conf['activity_display_connections'])
{
$query.= '
WHERE action NOT IN (\'login\', \'logout\')';
}
elseif ('admins_only' == $conf['activity_display_connections'])
{
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
$query.= '
WHERE NOT (action IN (\'login\', \'logout\') AND object_id NOT IN ('.implode(',', get_admins()).'))';
}
$query.= '
ORDER BY activity_id DESC
LIMIT '.$page_size.' OFFSET '.$page_offset.'
;';
$line_id = 0;
$result = pwg_query($query);