def all_reports(self, override=False): if not ForemanOptions.get_options().manager_inherit and not override: return self.direct_reports else: reports = [] for direct_report in self.direct_reports: reports.append(direct_report) reports.extend(direct_report.all_reports()) return reports
def is_manager_of(self, user): man = user.manager if man is None: return False if man.id == self.id: return True if not ForemanOptions.get_options().manager_inherit: return False else: return self.is_manager_of(man)