blob: 4bc7619cc12d786a5e0ca7f0a3685083136673b5 [file] [log] [blame]
Sapan Bhatia3f879692014-11-19 15:10:51 -05001from core.models import User, UserDeployments
Sapan Bhatia26d40bc2014-05-12 15:28:02 -04002from observer.deleter import Deleter
3
Sapan Bhatia3f879692014-11-19 15:10:51 -05004class UserDeploymentsDeleter(Deleter):
5 model='UserDeployments'
Sapan Bhatia26d40bc2014-05-12 15:28:02 -04006
7 def call(self, pk):
Sapan Bhatia3f879692014-11-19 15:10:51 -05008 user_deployment = UserDeployments.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()