This patch prohibits changing of agreed_to_tos and agreed_to_tos_on by the Logic module.
This is used so that legally the agreed_to_tos fields can never change in the User model once set.
Patch by: Haoyu Bai
Reviewed by: Lennard de Rijk
--- a/app/soc/logic/models/user.py Sun Feb 01 17:40:26 2009 +0000
+++ b/app/soc/logic/models/user.py Sun Feb 01 17:52:12 2009 +0000
@@ -134,8 +134,18 @@
with the old account.
Also, if either is_developer or agrees_to_tos change, the user's
rights have changed, so we need to flush the sidebar.
+ Make sure once the user agreed ToS, the ToS fields can't be changed.
"""
+ # iff the agreed_to_tos is True and we want to set it to False
+ if (name == 'agreed_to_tos') and (not value) and entity.agreed_to_tos:
+ return False
+
+ # iff the agreed_to_tos_on has a value and we want to change it
+ if (name == 'agreed_to_tos_on') and entity.agreed_to_tos_on and (
+ value != entity.agreed_to_tos_on):
+ return False
+
if (name == 'is_developer') and (entity.is_developer != value):
sidebar.flush(entity.account)