Skip to content

Commit e949933

Browse files
committed
Swith viewuser backend over to rely on caching user lookups by default and only
include a link at the bottom of the page to request uncached lookup. Should improve general response times for cases where vgrid/user map cache updates are slow.
1 parent 2f70f9c commit e949933

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

mig/shared/functionality/viewuser.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# --- BEGIN_HEADER ---
55
#
66
# viewuser - Display public details about a user
7-
# Copyright (C) 2003-2023 The MiG Project lead by Brian Vinter
7+
# Copyright (C) 2003-2025 The MiG Project lead by the Science HPC Center at UCPH
88
#
99
# This file is part of MiG.
1010
#
@@ -52,7 +52,8 @@
5252
def signature():
5353
"""Signature of the main function"""
5454

55-
defaults = {'cert_id': REJECT_UNSET}
55+
defaults = {'cert_id': REJECT_UNSET,
56+
'caching': ['false']}
5657
return ['user_info', defaults]
5758

5859

@@ -201,6 +202,7 @@ def main(client_id, user_arguments_dict):
201202
'text': confirm_html(configuration)})
202203

203204
user_list = accepted['cert_id']
205+
caching = (accepted['caching'][-1].lower() in ('true', 'yes'))
204206

205207
# Please note that base_dir must end in slash to avoid access to other
206208
# user dirs when own name is a prefix of another user name
@@ -214,8 +216,8 @@ def main(client_id, user_arguments_dict):
214216
output_objects.append({'object_type': 'header', 'text':
215217
'Show user details'})
216218

217-
visible_user = user_visible_user_confs(configuration, client_id)
218-
vgrid_access = user_vgrid_access(configuration, client_id)
219+
visible_user = user_visible_user_confs(configuration, client_id, caching)
220+
vgrid_access = user_vgrid_access(configuration, client_id, caching)
219221
anon_map = anon_to_real_user_map(configuration)
220222

221223
for visible_user_name in user_list:
@@ -249,4 +251,12 @@ def main(client_id, user_arguments_dict):
249251
vgrid_access)
250252
output_objects.append(user_item)
251253

254+
output_objects.append(
255+
{'object_type': 'link',
256+
'destination':
257+
'viewuser.py?%s' % '&'.join(['cert_id=%s' % i for i in user_list]),
258+
'class': 'refreshlink iconspace',
259+
'title': 'Refresh current user data - may take long time',
260+
'text': ''})
261+
252262
return (output_objects, status)

0 commit comments

Comments
 (0)