Browse Source

fcn-report: ajout exception pour audit dolibarr

root 6 years ago
parent
commit
29bca8c464
1 changed files with 3 additions and 1 deletions
  1. 3 1
      fcn-report

+ 3 - 1
fcn-report

@@ -38,9 +38,11 @@ s = smtplib.SMTP(confsmtp.get('host', 'localhost'))
 pp = pprint.PrettyPrinter()
 
 if confac.get('audit_dolibarr_users', False):
-  usrfields = ["firstname", "lastname", "email"]
+  usrfields = ["rowid", "firstname", "lastname", "email"]
   cur = doli.get_users(fields=usrfields, active_user=True, active_member=False)
   badusers = cur.fetchall()
+  # Exception for user id = 1 (default admin user)
+  badusers = list(filter(lambda usr: usr[0] != 1, badusers))
   if len(badusers) != 0:
     body = "Salut, \n\nDes utilisateurs ne sont pas associés à un membre actif : \n\n" + pp.pformat(badusers)
     msg = MIMEText(body)