Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regex deleted user #349

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
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
21 changes: 9 additions & 12 deletions roles/ood_user_reg_cloud/templates/user_auth_py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ import rc_util
default_state = "ok"
regex = "{{ ood_user_regex }}"

# Enable for migration phase
# e.g. not all users has entry in user_state db
migration = True

# Print empty if no remote_user is passed
if len(sys.argv) < 2:
print()
Expand All @@ -30,18 +26,19 @@ else:
else:
username = match.group(1)

# As a workaround for deleted user showing in user state db
# and being redirected to dashboard
rc = subprocess.run(
["getent", "passwd", username], stdout=subprocess.DEVNULL
).returncode
if rc != 0:
print()
sys.exit()

# Check state from db
result = rc_util.check_state(username)

if result == "ok" or result == "pre_certification":
print(username)
else:
if migration and result == "no-account":
rc = subprocess.run(
["getent", "passwd", username], stdout=subprocess.DEVNULL
).returncode
if rc == 0:
rc_util.update_state(username, default_state)
print(username)
sys.exit()
print()