Sapan Bhatia | 24836f1 | 2013-08-27 10:16:05 -0400 | [diff] [blame] | 1 | import os |
| 2 | import base64 |
Sapan Bhatia | 22e0ffe | 2013-10-02 01:12:10 -0400 | [diff] [blame] | 3 | import hashlib |
Tony Mack | ae7f30c | 2013-09-25 12:46:50 -0400 | [diff] [blame] | 4 | from django.db.models import F, Q |
Sapan Bhatia | 24836f1 | 2013-08-27 10:16:05 -0400 | [diff] [blame] | 5 | from planetstack.config import Config |
Sapan Bhatia | 04c94ad | 2013-09-02 18:00:28 -0400 | [diff] [blame] | 6 | from observer.openstacksyncstep import OpenStackSyncStep |
Tony Mack | 91463d9 | 2014-06-19 20:42:03 -0400 | [diff] [blame] | 7 | from core.models.user import User |
| 8 | from core.models.userdeployments import UserDeployments |
Sapan Bhatia | 24836f1 | 2013-08-27 10:16:05 -0400 | [diff] [blame] | 9 | |
| 10 | class SyncUsers(OpenStackSyncStep): |
Tony Mack | ce79de0 | 2013-09-24 10:12:33 -0400 | [diff] [blame] | 11 | provides=[User] |
| 12 | requested_interval=0 |
Tony Mack | 66646d5 | 2013-09-24 21:47:12 -0400 | [diff] [blame] | 13 | |
Tony Mack | ce79de0 | 2013-09-24 10:12:33 -0400 | [diff] [blame] | 14 | def sync_record(self, user): |
Tony Mack | d4a6429 | 2014-04-16 19:53:21 -0400 | [diff] [blame] | 15 | for user_deployment in UserDeployments.objects.filter(user=user): |
| 16 | # bump the 'updated' field so user account are updated across |
| 17 | # deployments. |
| 18 | user_deployment.save() |
Sapan Bhatia | 4f4591d | 2014-07-23 09:34:02 -0400 | [diff] [blame] | 19 | |
| 20 | def delete_record(self, user): |
| 21 | user_deployment_deleter = UserDeploymentDeleter() |
| 22 | for user_deployment in UserDeployments.objects.filter(user=user): |
| 23 | user_deployment_deleter(user_deployment.id) |