Tony Mack | ce4e2c2 | 2015-01-06 23:48:02 -0500 | [diff] [blame] | 1 | def 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 | |