blob: de8976d19d981fc35114ccdf09ddc9c43df43fa0 [file] [log] [blame]
Sapan Bhatia24836f12013-08-27 10:16:05 -04001import os
2import base64
Tony Mackae7f30c2013-09-25 12:46:50 -04003from django.db.models import F, Q
Sapan Bhatia24836f12013-08-27 10:16:05 -04004from planetstack.config import Config
Sapan Bhatia04c94ad2013-09-02 18:00:28 -04005from observer.openstacksyncstep import OpenStackSyncStep
6from core.models.site import *
Sapan Bhatia24836f12013-08-27 10:16:05 -04007
8class SyncSitePrivileges(OpenStackSyncStep):
Tony Mackdacfb982013-09-24 21:57:16 -04009 requested_interval=0
10 provides=[SitePrivilege]
Tony Mack66646d52013-09-24 21:47:12 -040011
12 def fetch_pending(self):
13 return Network.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
14
Tony Mackdacfb982013-09-24 21:57:16 -040015 def sync_record(self, user):
16 if site_priv.user.kuser_id and site_priv.site.tenant_id:
17 self.driver.add_user_role(site_priv.user.kuser_id,
18 site_priv.site.tenant_id,
19 site_priv.role.role_type)