[SUCS Devel] [Git][sucs/accountmanager][master] 2 commits: Clean up /home/useradd/ when deleting people.

Imran Hussain imranh at sucs.org
Thu Apr 25 19:34:31 BST 2019


Imran Hussain pushed to branch master at sucs / accountmanager


Commits:
8dadfe40 by Imran Hussain at 2019-04-25T18:30:17Z
Clean up /home/useradd/ when deleting people.

This is no longer needed as we take a backup of thier ldap entry at that time

- - - - -
0a469832 by Imran Hussain at 2019-04-25T18:34:00Z
Remove peoples history from printer table when deleting.

- - - - -


1 changed file:

- sucsam.py


Changes:

=====================================
sucsam.py
=====================================
@@ -313,6 +313,9 @@ def deleteUser(peopleList):
 			print("Something went wrong deleting the LDAP entry, quitting! NO CHNAGES MADE")
 			sys.exit(9)
 
+		# delete their useradd ldif file
+		subprocess.call(['sudo', 'rm', "-v", "/home/useradd/useradd." + username + ".ldif"])
+
 		# move their homedir to the deleted folder
 		subprocess.call(['sudo', 'mv', "-f", userLDAPinfo[0][1]["homeDirectory"][0], persondir+"/homedir"])
 
@@ -342,6 +345,8 @@ def deleteUser(peopleList):
 		cur = DBconn.cursor()
 		# delete from doorcards first
 		cur.execute("DELETE FROM doorcards WHERE uid=%(uid)s",{"uid" : str(userDBinfo[0][0])})
+		# delete from printer table
+		cur.execute("DELETE FROM printer WHERE username=%(user)s",{"user" : username})
 		# delete from members table
 		cur.execute("DELETE FROM members WHERE username=%(user)s",{"user" : username})
 		# add their some details to the oldmembers table



View it on GitLab: https://projects.sucs.org/sucs/accountmanager/compare/1546496850581a28c5e654f5622b7e45363cf75d...0a469832920f32e737443e117b4cc9599c7d7361

-- 
View it on GitLab: https://projects.sucs.org/sucs/accountmanager/compare/1546496850581a28c5e654f5622b7e45363cf75d...0a469832920f32e737443e117b4cc9599c7d7361
You're receiving this email because of your account on projects.sucs.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sucs.org/pipermail/devel/attachments/20190425/2a17906c/attachment.html>


More information about the Devel mailing list