Skip to content
Open
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
4 changes: 2 additions & 2 deletions mig/shared/useradm.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
return True
try:
os.remove(link_path)
except:

Check warning on line 150 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

do not use bare 'except'

Check warning on line 150 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

do not use bare 'except'
raise Exception('could not remove symlink: %s' % link_path)
return True

Expand Down Expand Up @@ -369,7 +369,7 @@
regex_patterns = ['distinguished_name']
else:
regex_patterns = []
(_, hits) = search_users(search_filter, configuration, db_path, force, verbose,

Check warning on line 372 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (83 > 80 characters)

Check warning on line 372 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (83 > 80 characters)
regex_match=regex_patterns)
peer_notes = []
if not hits:
Expand Down Expand Up @@ -610,16 +610,16 @@
reset_auth_type,
req_timestamp)
if valid_reset:
_logger.info("%r requested and authorized password reset"

Check warning on line 613 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (81 > 80 characters)

Check warning on line 613 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (81 > 80 characters)
% client_id)
if verbose:
print("User requested and authorized password reset")

Check warning on line 616 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (81 > 80 characters)

Check warning on line 616 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (81 > 80 characters)
authorized = True
else:
_logger.warning("%r requested password reset with bad token"

Check warning on line 619 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (84 > 80 characters)

Check warning on line 619 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (84 > 80 characters)
% client_id)
if verbose:
print("User requested password reset with bad token")

Check warning on line 622 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (81 > 80 characters)

Check warning on line 622 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (81 > 80 characters)

if authorized:
_logger.info("%r authorized password update" % client_id)
Expand Down Expand Up @@ -650,7 +650,7 @@
if verbose:
print("""Renewal request supplied a different
password and you didn't accept change anyway - nothing more to do""")
err = """Cannot renew account using a new password!

Check failure on line 653 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Assignment to variable "err" outside except: block [misc]

Check failure on line 653 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Assignment to variable "err" outside except: block [misc]
Please tell user to use the original password, request password reset or go
through renewal using Xgi-bin with proper authentication to authorize the
change."""
Expand All @@ -667,7 +667,7 @@
not isinstance(val, basestring) and \
isinstance(val, list):
val_list = updated_user.get(key, [])
val_list += [i for i in val if not i in val_list]

Check warning on line 670 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

test for membership should be 'not in'

Check warning on line 670 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

test for membership should be 'not in'
updated_user[key] = val_list
elif val:
updated_user[key] = val
Expand All @@ -688,7 +688,7 @@
short_id = user.get('short_id', '')
# For cert users short_id is the full DN so we should ignore then
if short_id and short_id != client_id and short_id.find(' ') == -1 and \
not short_id in openid_names:

Check warning on line 691 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

test for membership should be 'not in'

Check warning on line 691 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

test for membership should be 'not in'
openid_names.append(short_id)
add_names = []

Expand Down Expand Up @@ -722,10 +722,10 @@
# NOTE: bail out here on edit/renewal as IDs are not unique
if do_lock:
unlock_user_db(flock)
raise ValueError("unique ID for %s (%r) has a collission!" %
raise ValueError("unique ID for %s (%r) has a collision!" %
(client_id, user['unique_id']))
else:
_logger.warning("retry unique ID for %s (%r) - collission" %
_logger.warning("retry unique ID for %s (%r) - collision" %
(client_id, user['unique_id']))
user['unique_id'] = generate_random_ascii(unique_id_length,
unique_id_charset)
Expand Down Expand Up @@ -767,7 +767,7 @@
return user


def create_user_in_fs(configuration, client_id, user, now, renew, force, verbose):

Check warning on line 770 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (82 > 80 characters)

Check warning on line 770 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (82 > 80 characters)
"""Handle all the parts of user creation or renewal relating to making
directories and writing default files.
"""
Expand Down Expand Up @@ -807,7 +807,7 @@
required_dir_links = _get_required_user_dir_links(configuration, real_dir,
link_dir)
required_dirs = [path[0] for path in required_dir_links] + [ssh_dir,
davs_dir, ftps_dir]

Check warning on line 810 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (83 > 80 characters)

Check warning on line 810 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (83 > 80 characters)

# Make sure we set permissions tight enough for e.g. ssh auth keys to work
os.umask(0o22)
Expand Down Expand Up @@ -1182,7 +1182,7 @@
for (share_id, share_dict) in sharelinks.items():
# Update owner and use generic update helper to replace symlink
share_dict['owner'] = client_id
(mod_status, err) = update_share_link(share_dict, client_id,

Check failure on line 1185 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Assignment to variable "err" outside except: block [misc]

Check failure on line 1185 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Assignment to variable "err" outside except: block [misc]
configuration, sharelinks)
if verbose:
if mod_status:
Expand Down Expand Up @@ -1470,14 +1470,14 @@
res_map = get_resource_map(configuration)
for (res_id, res) in res_map.items():
if client_id in res[OWNERS]:
(add_status, err) = resource_add_owners(configuration, res_id,

Check failure on line 1473 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Assignment to variable "err" outside except: block [misc]

Check failure on line 1473 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Assignment to variable "err" outside except: block [misc]
[new_id])
if not add_status:
if verbose:
print('Could not add new %s owner of %s: %s'
% (new_id, res_id, err))
continue
(del_status, err) = resource_remove_owners(configuration, res_id,

Check failure on line 1480 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Assignment to variable "err" outside except: block [misc]

Check failure on line 1480 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Assignment to variable "err" outside except: block [misc]
[client_id])
if not del_status:
if verbose:
Expand All @@ -1498,14 +1498,14 @@
for (vgrid_name, vgrid) in vgrid_map[VGRIDS].items():
if client_id in vgrid[OWNERS]:

(add_status, err) = vgrid_add_owners(configuration, vgrid_name,

Check failure on line 1501 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Assignment to variable "err" outside except: block [misc]

Check failure on line 1501 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Assignment to variable "err" outside except: block [misc]
[new_id])
if not add_status:
if verbose:
print('Could not add new %s owner of %s: %s'
% (new_id, vgrid_name, err))
continue
(del_status, err) = vgrid_remove_owners(configuration, vgrid_name,

Check failure on line 1508 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Assignment to variable "err" outside except: block [misc]

Check failure on line 1508 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Assignment to variable "err" outside except: block [misc]
[client_id])
if not del_status:
if verbose:
Expand All @@ -1517,14 +1517,14 @@
client_id,
new_id))
elif client_id in vgrid[MEMBERS]:
(add_status, err) = vgrid_add_members(configuration, vgrid_name,

Check failure on line 1520 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Assignment to variable "err" outside except: block [misc]

Check failure on line 1520 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Assignment to variable "err" outside except: block [misc]
[new_id])
if not add_status:
if verbose:
print('Could not add new %s member of %s: %s'
% (new_id, vgrid_name, err))
continue
(del_status, err) = vgrid_remove_members(configuration, vgrid_name,

Check failure on line 1527 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Assignment to variable "err" outside except: block [misc]

Check failure on line 1527 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Assignment to variable "err" outside except: block [misc]
[client_id])
if not del_status:
if verbose:
Expand All @@ -1541,7 +1541,7 @@
(re_status, re_list) = list_runtime_environments(configuration)
if re_status:
for re_name in re_list:
(re_status, err) = update_runtimeenv_owner(re_name, client_id,

Check failure on line 1544 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Assignment to variable "err" outside except: block [misc]

Check failure on line 1544 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Assignment to variable "err" outside except: block [misc]
new_id, configuration)
if verbose:
if re_status:
Expand All @@ -1563,7 +1563,7 @@
for (share_id, share_dict) in sharelinks.items():
# Update owner and use generic update helper to replace symlink
share_dict['owner'] = new_id
(mod_status, err) = update_share_link(share_dict, new_id,

Check failure on line 1566 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Assignment to variable "err" outside except: block [misc]

Check failure on line 1566 in mig/shared/useradm.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

Assignment to variable "err" outside except: block [misc]
configuration, sharelinks)
if verbose:
if mod_status:
Expand Down
Loading