Skip to content

Commit

Permalink
Merge pull request #1892 from phillxnet/1891_deleting_stale_pincard_h…
Browse files Browse the repository at this point in the history
…olding_users_fails

deleting stale pincard holding users fails. Fixes #1891
  • Loading branch information
schakrava authored Feb 12, 2018
2 parents 550505e + a874a75 commit 256c8fe
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/rockstor/system/pinmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def username_to_uid(username):

# Convert from username to user uid
try:
# retrieve the password database entry for a given username
user_uid = getpwnam(username).pw_uid
except KeyError:
# user doesn't exist
Expand Down Expand Up @@ -173,8 +174,10 @@ def generate_pincard():
def flush_pincard(uid):

# Clear all Pincard entries for selected user
Pincard.objects.filter(user=int(uid)).delete()

# But only if we have a uid, see username_to_uid() which will return None
# if called when the given user no longer exists.
if uid is not None:
Pincard.objects.filter(user=int(uid)).delete()

def save_pincard(uid):

Expand Down

0 comments on commit 256c8fe

Please sign in to comment.