Scott Baker | af599eb | 2017-03-21 12:43:26 -0700 | [diff] [blame] | 1 | from synchronizers.new_base.modelaccessor import * |
| 2 | |
Scott Baker | b63ea79 | 2016-08-11 10:24:48 -0700 | [diff] [blame] | 3 | def handle(site_privilege): |
Scott Baker | b63ea79 | 2016-08-11 10:24:48 -0700 | [diff] [blame] | 4 | # site_privilege = SitePrivilege.get(site_privilege_id) |
| 5 | # apply site privilage at all controllers |
| 6 | controller_site_privileges = ControllerSitePrivilege.objects.filter( |
Scott Baker | af599eb | 2017-03-21 12:43:26 -0700 | [diff] [blame] | 7 | site_privilege_id = site_privilege.id, |
Scott Baker | b63ea79 | 2016-08-11 10:24:48 -0700 | [diff] [blame] | 8 | ) |
| 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 | |