EditUsers: Implement --remove flag
This commit is contained in:
parent
b4d4fd9ad4
commit
7ebabbb5f6
1 changed files with 15 additions and 0 deletions
|
@ -52,6 +52,21 @@ if __name__ == "__main__":
|
|||
exit(1)
|
||||
|
||||
CurrentUser = DB.safequery("SELECT * FROM `applications` WHERE `username`=?", tuple([args.user]))[0]
|
||||
if args.remove:
|
||||
print(f"Removing {args.user} from the system and the database...")
|
||||
try:
|
||||
DB.removeApplicantFromDBperUsername(args.user)
|
||||
print(f"Purged from the DB")
|
||||
if CurrentUser["status"] == 1:
|
||||
Sysctl.remove_user(args.user)
|
||||
print(f"Purged from the system")
|
||||
else:
|
||||
print(f"{args.user} wasn't approved before, therefore not deleting from system itself.")
|
||||
except lib.UserExceptions.General as e:
|
||||
print(f"{e}")
|
||||
exit(1)
|
||||
print("Success.")
|
||||
exit(0)
|
||||
if args.sshpubkey:
|
||||
if not lib.validator.checkSSHKey(args.sshpubkey):
|
||||
print(f"Pubkey {args.sshpubkey} isn't valid.")
|
||||
|
|
Loading…
Reference in a new issue