Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions mig/shared/functionality/peers.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# --- BEGIN_HEADER ---
#
# peers - manage external collaboration partners, etc.
# Copyright (C) 2003-2021 The MiG Project lead by Brian Vinter
# Copyright (C) 2003-2025 The MiG Project by the Science HPC Center at UCPH
#
# This file is part of MiG.
#
Expand All @@ -20,7 +20,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Check warning on line 23 in mig/shared/functionality/peers.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (81 > 80 characters)
#
# -- END_HEADER ---
#
Expand All @@ -33,12 +33,12 @@
from __future__ import absolute_import

from builtins import range
import datetime

Check failure on line 36 in mig/shared/functionality/peers.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused import 'datetime' (90% confidence)
import os

from mig.shared import returnvalues
from mig.shared.accountreq import peers_permit_allowed, list_country_codes
from mig.shared.base import pretty_format_user, fill_distinguished_name, \

Check failure on line 41 in mig/shared/functionality/peers.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused import 'pretty_format_user' (90% confidence)
client_id_dir, force_native_str_rec
from mig.shared.defaults import csrf_field, peers_filename, \
pending_peers_filename, peers_fields, peer_kinds, default_pager_entries
Expand Down Expand Up @@ -68,7 +68,7 @@
return ['peers', defaults]


def main(client_id, user_arguments_dict):

Check failure on line 71 in mig/shared/functionality/peers.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused function 'main' (60% confidence)
"""Main function used by front end"""

(configuration, logger, output_objects, op_name) = \
Expand All @@ -91,7 +91,7 @@
logger.info("%s begin for %s" % (op_name, client_id))

# IMPORTANT: single line here to avoid breaking javascript inlining
expire_help = "For security reasons peer accounts should be closed when no longer required. Expire is used to limit account access time for that purpose, and you can always extend it later if needed. For courses and workshops a few weeks or months should usually suffice, while projects and long-term collaboration often extend to months or years. Peer accounts still need to be renewed at least annually, but the peer users can do so themselves without your repeated explicit acceptance, as long as it does not exceed your provided expire date."
expire_help = "For security reasons peer accounts should be closed when no longer required. End date is used to limit account access time for that purpose, and you can always extend it later if needed. For courses and workshops a few weeks or months should usually suffice, while projects and long-term collaboration often extend to months or years. Peer accounts still need to be renewed at least annually, but the peer users can do so themselves without your repeated explicit acceptance, as long as it does not exceed your provided end date."

Check warning on line 94 in mig/shared/functionality/peers.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (549 > 80 characters)

# jquery support for tablesorter and confirmation on delete
# table initially sorted by col. 5 (kind), then 0 (name)
Expand Down Expand Up @@ -136,7 +136,7 @@
var group = $(this);
peer_id = '';
var full_name = $(group).find("input.entry-field.full_name").val();
var organization = $(group).find("input.entry-field.organization").val();

Check warning on line 139 in mig/shared/functionality/peers.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (81 > 80 characters)
var email = $(group).find("input.entry-field.email").val();
var country = $(group).find(".entry-field.country").val();
var state = $(group).find("input.entry-field.state").val();
Expand All @@ -151,7 +151,7 @@
}
/* Always set peer_id to reset empty rows */
$(group).find("input.id-collector").val(peer_id);
console.log("set collected peer_id: "+$(group).find("input.id-collector").val());

Check warning on line 154 in mig/shared/functionality/peers.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (89 > 80 characters)
});
if (peer_count > 0) {
return true;
Expand All @@ -170,8 +170,8 @@
heightStyle: "content"
});
/* fix and reduce accordion spacing */
$(".peers-tabs .accordion .ui-accordion-header").css("padding-top", 0).css("padding-bottom", 0).css("margin", 0);

Check warning on line 173 in mig/shared/functionality/peers.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (121 > 80 characters)
$(".peers-tabs .init-expanded.accordion ").accordion("option", "active", 0);

Check warning on line 174 in mig/shared/functionality/peers.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (84 > 80 characters)
$("#fields-tab .save_peers").on("submit", transfer_id_fields);
$("#info_dialog").dialog(
{ autoOpen: false,
Expand Down Expand Up @@ -241,7 +241,7 @@
</div>
<div class="col-md-4 mb-3 form-cell">
<label for="peers_kind">Kind</label>
<select class="form-control themed-select html-select" name="peers_kind">

Check warning on line 244 in mig/shared/functionality/peers.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (83 > 80 characters)
'''
for name in peer_kinds:
shared_peer_html += '''
Expand All @@ -251,13 +251,13 @@
</select>
</div>
<div class="col-md-4 mb-3 form-cell">
<label for="peers_expire">Expire&nbsp;
<label for="peers_expire">End Date&nbsp;
<span class="info leftpad iconspace" title="%(expire_help)s"
onClick="show_info(\'Expire Help\', \'%(expire_help)s\');"/>
onClick="show_info(\'End Date Help\', \'%(expire_help)s\');"/>
</label>
<input class="form-control themed-select html-select fill-width"
type="date" name="peers_expire" required pattern="[0-9/-]+"
title="Access expiry date" />
title="Access end date" />
</div>
</div>
'''
Expand Down Expand Up @@ -291,11 +291,11 @@
<div id="wrap-tabs" class="peers-tabs">
<ul>
<li><a href="#show-tab">Show Peers</a></li>
<li class="%(peers_permit_class)s"><a href="#requests-tab">Requested Peers</a></li>

Check warning on line 294 in mig/shared/functionality/peers.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (83 > 80 characters)
<li class="%(peers_permit_class)s"><a href="#fields-tab">Enter Peers</a></li>
<li class="%(peers_permit_class)s"><a href="#import-tab">Import Peers</a></li>
<!-- TODO: enable additional methods when ready? -->
<li class="%(peers_permit_class)s hidden"><a href="#urlfetch-tab">Fetch Peers From URL</a></li>

Check warning on line 298 in mig/shared/functionality/peers.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (95 > 80 characters)
</ul>

<div id="show-tab">
Expand All @@ -305,7 +305,7 @@
vouched for to get an account on %(site)s because they need it for a particular
course/workshop, research project or for general long term collaboration with
you. The site admins will use this information to accept account requests and
extensions from your peers until the given time of expiry.
extensions from your peers until the given end date.
</p>
<div class="peer_entries">
'''
Expand All @@ -332,11 +332,11 @@
'object_type': 'link',
'destination':
"javascript: confirmDialog(%s, '%s', '%s', %s);" %
('peer_action', 'Update %(full_name)s (%(email)s) expire date (YYYY-MM-DD)?' % filled_entry,
('peer_action', 'Update %(full_name)s (%(email)s) end date (YYYY-MM-DD)?' % filled_entry,

Check warning on line 335 in mig/shared/functionality/peers.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (101 > 80 characters)
'peers_expire',
"{action: 'update', peers_label: '%(label)s', peers_kind: '%(kind)s', peers_content: '%(distinguished_name)s', peers_invite: false}" % filled_entry),
'class': 'editlink iconspace',
'title': 'Update %(distinguished_name)s Expire value in peers' % filled_entry,
'title': 'Update %(distinguished_name)s End date value in peers' % filled_entry,
'text': ''}
filled_entry['invitepeerlink'] = {
'object_type': 'link',
Expand Down Expand Up @@ -376,10 +376,10 @@
<div id="fields-tab">
<p>
You may enter your individual peers in the form fields below and assign a
shared kind and account expiry time for all entries. Just leave the Action
field to <em>Add</em> unless you want to <em>Update</em> or <em>Remove</em>
existing peers. You are free to leave rows empty, but each field in a peer row
MUST be filled for the row to be treated.
shared kind and account end date for all entries. Just leave the Action field
to <em>Add</em> unless you want to <em>Update</em> or <em>Remove</em> existing
peers. You are free to leave rows empty, but each field in a peer row MUST be
filled for the row to be treated.
</p>
<div class="enter-form form_container">
%(form_prefix_html)s
Expand Down Expand Up @@ -533,10 +533,10 @@
<div id="requests-tab" >
<p>
If someone requests an external user account on %(site)s and explicitly
references you as peers contact person the site admins will generally forward
the request, so that it shows up here for you to confirm. You can then accept
or reject the individual requests below to let the site admins proceed with
account creation or rejection. Please select an expire date to provide limited
references you among contact persons (peers) the site admins will generally
forward the request, so that it shows up here for you to confirm. You can then
accept or reject the individual requests below to let the site admins proceed
with account creation or rejection. Please select an end date to provide limited
but sufficiently long account access - it can always be extended later.
</p>
'''
Expand Down
2 changes: 1 addition & 1 deletion mig/shared/output.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
Expand Down Expand Up @@ -47,9 +47,9 @@
from mig.shared.bailout import bailout_title, crash_helper, \
filter_output_objects
from mig.shared.base import force_native_str, hexlify
from mig.shared.defaults import file_dest_sep, keyword_any, keyword_updating

Check failure on line 50 in mig/shared/output.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused import 'keyword_any' (90% confidence)
from mig.shared.base import hexlify
from mig.shared.defaults import file_dest_sep, keyword_any, keyword_updating

Check failure on line 52 in mig/shared/output.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused import 'keyword_any' (90% confidence)
from mig.shared.htmlgen import get_xgi_html_header, get_xgi_html_footer, \
vgrid_items, html_post_helper, tablesorter_pager
from mig.shared.init import find_entry
Expand All @@ -64,7 +64,7 @@
'yaml', 'xmlrpc', 'resource', 'json', 'file']


def reject_main(client_id, user_arguments_dict):

Check failure on line 67 in mig/shared/output.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused function 'reject_main' (60% confidence)
"""A simple main-function to use if functionality backend is disabled"""
output_objs = [bailout_title(None, 'Access Error'),
{'object_type': 'header', 'text': 'Access Error'},
Expand All @@ -73,7 +73,7 @@
return (output_objs, returnvalues.CLIENT_ERROR)


def dummy_main(client_id, user_arguments_dict):

Check failure on line 76 in mig/shared/output.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused function 'dummy_main' (60% confidence)
"""Dummy main-function to override with backend import"""
output_objs = [bailout_title(None, 'Internal Error'),
{'object_type': 'header', 'text': 'Internal Error'},
Expand Down Expand Up @@ -144,7 +144,7 @@
return table


def txt_link(obj):

Check failure on line 147 in mig/shared/output.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused function 'txt_link' (60% confidence)
"""Text format link"""

return '(Link: __%s__) -> __%s__' % (obj['destination'], obj['text'])
Expand Down Expand Up @@ -1530,7 +1530,7 @@
<th>State</th>
<th>Kind</th>
<th>Label</th>
<th>Expire</th>
<th>End Date</th>
<th>Actions</th>
</tr>
</thead>
Expand Down