blob: 0f772cbd99e1c9e9b002ab9a032dcf97de7a63d5 [file] [log] [blame]
Tony Mackce4e2c22015-01-06 23:48:02 -05001def handle(slice_privilege):
2 from core.models import Controller, SlicePrivilege, ControllerSlicePrivilege
3
4 # apply slice privilage at all controllers
5 controller_slice_privileges = ControllerSlicePrivilege.objects.filter(
6 slice_privilege = slice_privilege,
7 )
8 existing_controllers = [csp.controller for sp in controller_slice_privileges]
9 all_controllers = Controller.objects.all()
10 for controller in all_controllers:
11 if controller not in existing_controllers:
12 ctrl_slice_priv = ControllerSlicePrivilege(controller=controller, slice_privilege=slice_privilege)
13 ctrl_slice_priv.save()
14