blob: 4cb1a26370555da3857fc346596dd9b5628d2f56 [file] [log] [blame]
Sapan Bhatia24836f12013-08-27 10:16:05 -04001import os
2import base64
Sapan Bhatia22e0ffe2013-10-02 01:12:10 -04003import hashlib
Tony Mackae7f30c2013-09-25 12:46:50 -04004from django.db.models import F, Q
Sapan Bhatia24836f12013-08-27 10:16:05 -04005from planetstack.config import Config
Sapan Bhatia04c94ad2013-09-02 18:00:28 -04006from observer.openstacksyncstep import OpenStackSyncStep
Tony Mack91463d92014-06-19 20:42:03 -04007from core.models.user import User
Tony Macka7dbd422015-01-05 22:48:11 -05008from core.models.controllerusers import ControllerUser
9from observer.steps.sync_controller_users import SyncControllerUser
Sapan Bhatia24836f12013-08-27 10:16:05 -040010
11class SyncUsers(OpenStackSyncStep):
Tony Mackce79de02013-09-24 10:12:33 -040012 provides=[User]
13 requested_interval=0
Tony Mack66646d52013-09-24 21:47:12 -040014
Tony Mackce79de02013-09-24 10:12:33 -040015 def sync_record(self, user):
Tony Macka7dbd422015-01-05 22:48:11 -050016 for controller_user in ControllerUser.objects.filter(user=user):
Tony Mackd4a64292014-04-16 19:53:21 -040017 # bump the 'updated' field so user account are updated across
Tony Mack336e0f92014-11-30 15:53:08 -050018 # controllers.
19 controller_user.save()
Sapan Bhatia4f4591d2014-07-23 09:34:02 -040020
21 def delete_record(self, user):
Tony Macka7dbd422015-01-05 22:48:11 -050022 controller_user_deleter = SyncControllerUser().delete_record
23 for controller_user in ControllerUser.objects.filter(user=user):
Tony Mack336e0f92014-11-30 15:53:08 -050024 controller_user_deleter(controller_user)