def addMembershipRules(self): """ add devices to groups if they match any rules in the ruleset """ addedDevices = [] from ProfileModify import ProfileModify for device in self.getPotentialDeviceMatches(): addedDevices.append(device) for system in self.moduleSystemOrganizers: ruleApplication = ProfileModify(self.dmd,device.id,system) ruleApplication.addSystemToDevice() for group in self.moduleGroupOrganizers: ruleApplication = ProfileModify(self.dmd,device.id,group) ruleApplication.addGroupToDevice() return addedDevices
def applyRules(self,undo): """ (un)apply rules in ruleset """ mod = ProfileModify(self.dmd) if undo == False: self.updateMatches() devices = self.getPotentialDeviceMatches() else: devices = self.getRemovableDeviceMatches() for device in devices: mod.initDevice(device) mod.modifyMemberships(self,undo) if self.bindTemplates == True: mod.modifyTemplateBindings(self,undo) self.updateMatches() return devices
def addMembershipRules(self): """ add devices to groups if they match any rules in the ruleset """ addedDevices = [] from ProfileModify import ProfileModify for device in self.getPotentialDeviceMatches(): addedDevices.append(device) for system in self.moduleSystemOrganizers: ruleApplication = ProfileModify(self.dmd, device.id, system) ruleApplication.addSystemToDevice() for group in self.moduleGroupOrganizers: ruleApplication = ProfileModify(self.dmd, device.id, group) ruleApplication.addGroupToDevice() return addedDevices
def removeMembershipRules(self): """ remove devices from rules if the toRemove flag is True for a given rule """ from ProfileModify import ProfileModify removedDevices = [] for rule in self.rules(): if rule.toRemove == True: for device in self.dmd.Devices.getSubDevices(): remove = False if device not in rule.ruleCurrentMatches: remove = True elif device not in rule.rulePotentialMatches: remove = True if remove == True: removedDevices.append(device) for system in self.moduleSystemOrganizers: ruleApplication = ProfileModify(self.dmd,device.id,system) ruleApplication.removeSystemFromDevice() for group in self.moduleGroupOrganizers: ruleApplication = ProfileModify(self.dmd,device.id,group) ruleApplication.removeGroupFromDevice() return removedDevices
def removeMembershipRules(self): """ remove devices from rules if the toRemove flag is True for a given rule """ from ProfileModify import ProfileModify removedDevices = [] for rule in self.rules(): if rule.toRemove == True: for device in self.dmd.Devices.getSubDevices(): remove = False if device not in rule.ruleCurrentMatches: remove = True elif device not in rule.rulePotentialMatches: remove = True if remove == True: removedDevices.append(device) for system in self.moduleSystemOrganizers: ruleApplication = ProfileModify(self.dmd, device.id, system) ruleApplication.removeSystemFromDevice() for group in self.moduleGroupOrganizers: ruleApplication = ProfileModify(self.dmd, device.id, group) ruleApplication.removeGroupFromDevice() return removedDevices