# HG changeset patch # User Lennard de Rijk # Date 1233510732 0 # Node ID ad352f3a37d369fea3c7140e1d5227c41b32773a # Parent 56070e3badea69f19b940e793461673c18e87eee 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 diff -r 56070e3badea -r ad352f3a37d3 app/soc/logic/models/user.py --- 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)