Commit 0c8c2cb2 authored by Rafael Monnerat's avatar Rafael Monnerat

ERP5LoginUserManager: Check Assignment is only meaningfull for Persons

The Assigments are only relevant if the User is based on Person Document, on SlapOS, an user come from a Computer or a Software Instance Document. This change makes the document compatible with other kinds of Users, as Assigment is overkill for Non-Person cases, as the presence of ERP5 Login is enough to determinate the User existence. 

The other alternative would be re-factorize to not duplicate code, which seems not the intention of how this code was written. 

/cc @jerome, @kazuhiko 



/reviewed-on nexedi/erp5!458
parent c0fb8e54
......@@ -113,16 +113,17 @@ class ERP5LoginUserManager(BasePlugin):
return
if user_value.getValidationState() == 'deleted':
return
now = DateTime()
for assignment in user_value.contentValues(portal_type="Assignment"):
if assignment.getValidationState() == "open" and (
not assignment.hasStartDate() or assignment.getStartDate() <= now
) and (
not assignment.hasStopDate() or assignment.getStopDate() >= now
):
break
else:
return
if user_value.getPortalType() in ('Person', ):
now = DateTime()
for assignment in user_value.contentValues(portal_type="Assignment"):
if assignment.getValidationState() == "open" and (
not assignment.hasStartDate() or assignment.getStartDate() <= now
) and (
not assignment.hasStopDate() or assignment.getStopDate() >= now
):
break
else:
return
is_authentication_policy_enabled = self.getPortalObject().portal_preferences.isAuthenticationPolicyEnabled()
if check_password:
password = credentials.get('password')
......
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