blob: 22189949c7f0a7d433ac1a4f892bdaed91953fbf [file] [log] [blame]
Scott Bakeraf599eb2017-03-21 12:43:26 -07001from synchronizers.new_base.modelaccessor import *
2
Scott Bakerb63ea792016-08-11 10:24:48 -07003def handle(site_privilege):
Scott Bakerb63ea792016-08-11 10:24:48 -07004 # site_privilege = SitePrivilege.get(site_privilege_id)
5 # apply site privilage at all controllers
6 controller_site_privileges = ControllerSitePrivilege.objects.filter(
Scott Bakeraf599eb2017-03-21 12:43:26 -07007 site_privilege_id = site_privilege.id,
Scott Bakerb63ea792016-08-11 10:24:48 -07008 )
9 existing_controllers = [sp.controller for sp in controller_site_privileges]
10 all_controllers = Controller.objects.all()
11 for controller in all_controllers:
12 if controller not in existing_controllers:
13 ctrl_site_priv = ControllerSitePrivilege(controller=controller, site_privilege=site_privilege)
14 ctrl_site_priv.save()
15