blob: bca7f220cd18e62646369a22dd52d715de0cee80 [file] [log] [blame]
Tony Mackce4e2c22015-01-06 23:48:02 -05001def handle(slice_privilege):
2 from core.models import Controller, SlicePrivilege, ControllerSlicePrivilege
Sapan Bhatia485490d2015-01-17 00:56:36 +00003
4 # slice_privilege = SlicePrivilege.get(slice_privilege_id)
Tony Mackce4e2c22015-01-06 23:48:02 -05005 # apply slice privilage at all controllers
6 controller_slice_privileges = ControllerSlicePrivilege.objects.filter(
7 slice_privilege = slice_privilege,
8 )
Sapan Bhatiab6d5b872015-01-23 16:11:29 +00009 existing_controllers = [sp.controller for sp in controller_slice_privileges]
Tony Mackce4e2c22015-01-06 23:48:02 -050010 all_controllers = Controller.objects.all()
11 for controller in all_controllers:
12 if controller not in existing_controllers:
13 ctrl_slice_priv = ControllerSlicePrivilege(controller=controller, slice_privilege=slice_privilege)
14 ctrl_slice_priv.save()
15