Commit 754722f5 authored by Aurel's avatar Aurel

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
parent 8cba95c2
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment