From 754722f52b167f529f49435b3236137232d6cb8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com> Date: Mon, 14 Jan 2008 14:13:26 +0000 Subject: [PATCH] if dates are defined on an assignment, compare them at login time git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18687 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Security/ERP5UserManager.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/product/ERP5Security/ERP5UserManager.py b/product/ERP5Security/ERP5UserManager.py index 7135156120..6c89ab387c 100644 --- a/product/ERP5Security/ERP5UserManager.py +++ b/product/ERP5Security/ERP5UserManager.py @@ -29,7 +29,7 @@ from Products.PluggableAuthService.interfaces.plugins import IUserEnumerationPlu from Products.ERP5Type.Cache import CachingMethod from ZODB.POSException import ConflictError import sys - +from DateTime import DateTime from zLOG import LOG, PROBLEM try : @@ -101,6 +101,15 @@ class ERP5UserManager(BasePlugin): try: # get assignment assignment_list = [x for x in user.contentValues(portal_type="Assignment") if x.getValidationState() == "open"] + login_date = DateTime() + # compare date if they are defined + for assignment in assignment_list: + if assignment.getStartDate() is not None and \ + assignment.getStartDate() >= login_date: + return None + if assignment.getStopDate() is not None and \ + assignment.getStopDate() < login_date: + return None if pw_validate(user.getPassword(), password) and \ len(assignment_list): #user.getCareerRole() == 'internal': return login, login # use same for user_id and login -- 2.30.9