blob: 90280a35c8888cea6b7d0f9a48b615bdb4244e57 [file] [log] [blame]
Tony Mackce4e2c22015-01-06 23:48:02 -05001def handle(site_privilege):
2 from core.models import Controller, SitePrivilege, ControllerSitePrivilege
3
4 # apply site privilage at all controllers
5 controller_site_privileges = ControllerSitePrivilege.objects.filter(
6 site_privilege = site_privilege,
7 )
8 existing_controllers = [csp.controller for sp in controller_site_privileges]
9 all_controllers = Controller.objects.all()
10 for controller in all_controllers:
11 if controller not in existing_controllers:
12 ctrl_site_priv = ControllerSitePrivilege(controller=controller, site_privilege=site_privilege)
13 ctrl_site_priv.save()
14