blob: 0e9d681e51ec813f42134b46a01346ec3bf29bd5 [file] [log] [blame]
Sapan Bhatia24836f12013-08-27 10:16:05 -04001import os
2import base64
3from planetstack.config import Config
Sapan Bhatia04c94ad2013-09-02 18:00:28 -04004from observer.openstacksyncstep import OpenStackSyncStep
5from core.models.slice import *
Sapan Bhatia24836f12013-08-27 10:16:05 -04006
7class SyncSliceMemberships(OpenStackSyncStep):
Tony Mackce79de02013-09-24 10:12:33 -04008 requested_interval=0
Tony Mack66646d52013-09-24 21:47:12 -04009 provides=[SlicePrivilege]
10
11 def fetch_pending(self):
12 return SlicePrivilege.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
13
Tony Mackce79de02013-09-24 10:12:33 -040014 def sync_record(self, user):
15 if slice_memb.user.kuser_id and slice_memb.slice.tenant_id:
16 self.driver.add_user_role(slice_memb.user.kuser_id,
17 slice_memb.slice.tenant_id,
18 slice_memb.role.role_type)