blob: 6d3825cef0928441e204e42d39e32c2d53329860 [file] [log] [blame]
Sapan Bhatia84ba65d2014-11-11 21:44:35 -05001from core.models import User, UserDeployment
Sapan Bhatia26d40bc2014-05-12 15:28:02 -04002from observer.deleter import Deleter
3
4class UserDeploymentDeleter(Deleter):
5 model='UserDeployment'
6
7 def call(self, pk):
Sapan Bhatia84ba65d2014-11-11 21:44:35 -05008 user_deployment = UserDeployment.objects.get(pk=pk)
Sapan Bhatia26d40bc2014-05-12 15:28:02 -04009 if user_deployment.user.kuser_id:
10 driver = self.driver.admin_driver(deployment=user_deployment.deployment.name)
11 driver.delete_user(user_deployment.user.kuser_id)
12 user_deployment.delete()