573 | | action = self.checkGroupPQuota(grouppquota) |
574 | | if action.startswith("POLICY_") : |
575 | | action = action[7:] |
576 | | if action == "DENY" : |
577 | | adminmessage = _("Print Quota exceeded for group %s on printer %s") % (group.Name, printer.Name) |
578 | | self.printInfo(adminmessage) |
579 | | if mailto in [ "BOTH", "ADMIN" ] : |
580 | | self.sendMessageToAdmin(adminmail, _("Print Quota"), adminmessage) |
581 | | if mailto in [ "BOTH", "USER", "EXTERNAL" ] : |
582 | | for user in self.storage.getGroupMembers(group) : |
583 | | if mailto != "EXTERNAL" : |
584 | | self.sendMessageToUser(admin, adminmail, user, _("Print Quota Exceeded"), self.config.getHardWarn(printer.Name)) |
585 | | else : |
586 | | self.externalMailTo(arguments, action, user, printer, self.config.getHardWarn(printer.Name)) |
587 | | elif action == "WARN" : |
588 | | adminmessage = _("Print Quota low for group %s on printer %s") % (group.Name, printer.Name) |
589 | | self.printInfo(adminmessage) |
590 | | if mailto in [ "BOTH", "ADMIN" ] : |
591 | | self.sendMessageToAdmin(adminmail, _("Print Quota"), adminmessage) |
592 | | if group.LimitBy and (group.LimitBy.lower() == "balance") : |
593 | | message = self.config.getPoorWarn() |
594 | | else : |
595 | | message = self.config.getSoftWarn(printer.Name) |
596 | | if mailto in [ "BOTH", "USER", "EXTERNAL" ] : |
597 | | for user in self.storage.getGroupMembers(group) : |
598 | | if mailto != "EXTERNAL" : |
599 | | self.sendMessageToUser(admin, adminmail, user, _("Print Quota Exceeded"), message) |
600 | | else : |
601 | | self.externalMailTo(arguments, action, user, printer, message) |
| 573 | if group.LimitBy in ("noquota", "nochange") : |
| 574 | action = "ALLOW" |
| 575 | else : |
| 576 | action = self.checkGroupPQuota(grouppquota) |
| 577 | if action.startswith("POLICY_") : |
| 578 | action = action[7:] |
| 579 | if action == "DENY" : |
| 580 | adminmessage = _("Print Quota exceeded for group %s on printer %s") % (group.Name, printer.Name) |
| 581 | self.printInfo(adminmessage) |
| 582 | if mailto in [ "BOTH", "ADMIN" ] : |
| 583 | self.sendMessageToAdmin(adminmail, _("Print Quota"), adminmessage) |
| 584 | if mailto in [ "BOTH", "USER", "EXTERNAL" ] : |
| 585 | for user in self.storage.getGroupMembers(group) : |
| 586 | if mailto != "EXTERNAL" : |
| 587 | self.sendMessageToUser(admin, adminmail, user, _("Print Quota Exceeded"), self.config.getHardWarn(printer.Name)) |
| 588 | else : |
| 589 | self.externalMailTo(arguments, action, user, printer, self.config.getHardWarn(printer.Name)) |
| 590 | elif action == "WARN" : |
| 591 | adminmessage = _("Print Quota low for group %s on printer %s") % (group.Name, printer.Name) |
| 592 | self.printInfo(adminmessage) |
| 593 | if mailto in [ "BOTH", "ADMIN" ] : |
| 594 | self.sendMessageToAdmin(adminmail, _("Print Quota"), adminmessage) |
| 595 | if group.LimitBy and (group.LimitBy.lower() == "balance") : |
| 596 | message = self.config.getPoorWarn() |
| 597 | else : |
| 598 | message = self.config.getSoftWarn(printer.Name) |
| 599 | if mailto in [ "BOTH", "USER", "EXTERNAL" ] : |
| 600 | for user in self.storage.getGroupMembers(group) : |
| 601 | if mailto != "EXTERNAL" : |
| 602 | self.sendMessageToUser(admin, adminmail, user, _("Print Quota Exceeded"), message) |
| 603 | else : |
| 604 | self.externalMailTo(arguments, action, user, printer, message) |
625 | | self.sendMessageToAdmin(adminmail, _("Print Quota"), adminmessage) |
626 | | elif action == "WARN" : |
627 | | adminmessage = _("Print Quota low for user %s on printer %s") % (user.Name, printer.Name) |
628 | | self.printInfo(adminmessage) |
629 | | if mailto in [ "BOTH", "USER", "EXTERNAL" ] : |
630 | | if user.LimitBy and (user.LimitBy.lower() == "balance") : |
631 | | message = self.config.getPoorWarn() |
632 | | else : |
633 | | message = self.config.getSoftWarn(printer.Name) |
634 | | if mailto != "EXTERNAL" : |
635 | | self.sendMessageToUser(admin, adminmail, user, _("Print Quota Low"), message) |
636 | | else : |
637 | | self.externalMailTo(arguments, action, user, printer, message) |
638 | | if mailto in [ "BOTH", "ADMIN" ] : |
639 | | self.sendMessageToAdmin(adminmail, _("Print Quota"), adminmessage) |
| 626 | self.sendMessageToAdmin(adminmail, _("Print Quota"), message) |
| 627 | else : |
| 628 | action = self.checkUserPQuota(userpquota) |
| 629 | if action.startswith("POLICY_") : |
| 630 | action = action[7:] |
| 631 | |
| 632 | if action == "DENY" : |
| 633 | adminmessage = _("Print Quota exceeded for user %s on printer %s") % (user.Name, printer.Name) |
| 634 | self.printInfo(adminmessage) |
| 635 | if mailto in [ "BOTH", "USER", "EXTERNAL" ] : |
| 636 | message = self.config.getHardWarn(printer.Name) |
| 637 | if mailto != "EXTERNAL" : |
| 638 | self.sendMessageToUser(admin, adminmail, user, _("Print Quota Exceeded"), message) |
| 639 | else : |
| 640 | self.externalMailTo(arguments, action, user, printer, message) |
| 641 | if mailto in [ "BOTH", "ADMIN" ] : |
| 642 | self.sendMessageToAdmin(adminmail, _("Print Quota"), adminmessage) |
| 643 | elif action == "WARN" : |
| 644 | adminmessage = _("Print Quota low for user %s on printer %s") % (user.Name, printer.Name) |
| 645 | self.printInfo(adminmessage) |
| 646 | if mailto in [ "BOTH", "USER", "EXTERNAL" ] : |
| 647 | if user.LimitBy and (user.LimitBy.lower() == "balance") : |
| 648 | message = self.config.getPoorWarn() |
| 649 | else : |
| 650 | message = self.config.getSoftWarn(printer.Name) |
| 651 | if mailto != "EXTERNAL" : |
| 652 | self.sendMessageToUser(admin, adminmail, user, _("Print Quota Low"), message) |
| 653 | else : |
| 654 | self.externalMailTo(arguments, action, user, printer, message) |
| 655 | if mailto in [ "BOTH", "ADMIN" ] : |
| 656 | self.sendMessageToAdmin(adminmail, _("Print Quota"), adminmessage) |