Skip to content

Commit 3cac362

Browse files
committed
Manually merge PR170: Always show Add VGrid/Workgroup section on vgridman page with brief explanatory warning if user does not have permission to create.
git-svn-id: svn+ssh://svn.code.sf.net/p/migrid/code/trunk@6192 b75ad72c-e7d7-11dd-a971-7dbc132099af
1 parent 5f96eaa commit 3cac362

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

mig/shared/functionality/vgridman.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# --- BEGIN_HEADER ---
55
#
66
# vgridman - backend to manage vgrids
7-
# Copyright (C) 2003-2024 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
#
@@ -64,6 +64,7 @@ def main(client_id, user_arguments_dict):
6464
defaults = signature()[1]
6565
title_entry = find_entry(output_objects, 'title')
6666
label = "%s" % configuration.site_vgrid_label
67+
support_email = "%s" % configuration.support_email
6768
title_entry['text'] = "%s Management" % label
6869
(validate_status, accepted) = validate_input_and_cert(
6970
user_arguments_dict,
@@ -106,6 +107,7 @@ def main(client_id, user_arguments_dict):
106107
form_method = 'post'
107108
csrf_limit = get_csrf_limit(configuration)
108109
fill_helpers = {'vgrid_label': label,
110+
'support_email': support_email,
109111
'form_method': form_method,
110112
'csrf_field': csrf_field,
111113
'csrf_limit': csrf_limit}
@@ -488,11 +490,11 @@ def main(client_id, user_arguments_dict):
488490
if operation in show_operations:
489491
user_map = get_full_user_map(configuration)
490492
user_dict = user_map.get(client_id, None)
493+
output_objects.append({'object_type': 'sectionheader', 'text':
494+
'Additional %ss' % label})
495+
491496
# Optional limitation of create vgrid permission
492497
if user_dict and vgrid_create_allowed(configuration, user_dict):
493-
output_objects.append({'object_type': 'sectionheader', 'text':
494-
'Additional %ss' % label})
495-
496498
output_objects.append(
497499
{'object_type': 'text', 'text':
498500
'''Please enter a name for the new %(vgrid_label)s to add,
@@ -515,6 +517,15 @@ def main(client_id, user_arguments_dict):
515517
<input type="submit" value="Create %(vgrid_label)s" />
516518
</form>
517519
''' % fill_helpers})
520+
else:
521+
output_objects.append(
522+
{'object_type': 'warning', 'text':
523+
"""You don't have permission to create %(vgrid_label)ss on
524+
this site.""" % fill_helpers})
525+
output_objects.append(
526+
{'object_type': 'text', 'text':
527+
"""Please contact support at %(support_email)s if you think
528+
that you qualify for it.""" % fill_helpers})
518529

519530
output_objects.append({'object_type': 'sectionheader', 'text':
520531
'Request Access to %ss' % label})

0 commit comments

Comments
 (0)