Reverting part of r2378, since it's not ready yet.
authorLennard de Rijk <ljvderijk@gmail.com>
Sat, 07 Mar 2009 19:23:32 +0000
changeset 1723 259bba384c60
parent 1722 7f285e96cb17
child 1724 d8d04e17b574
Reverting part of r2378, since it's not ready yet. Patch by: Lennard de Rijk Reviewed by: to-be-reviewed
app/soc/views/models/role.py
--- a/app/soc/views/models/role.py	Sat Mar 07 19:17:02 2009 +0000
+++ b/app/soc/views/models/role.py	Sat Mar 07 19:23:32 2009 +0000
@@ -156,8 +156,6 @@
 
     new_params['extra_dynaexclude'] = ['user', 'status', 'agreed_to_tos_on']
 
-    new_params['disallow_last_resign'] = False
-
     params = dicts.merge(params, new_params, sub_merge=True)
 
     super(View, self).__init__(params=params)
@@ -436,29 +434,12 @@
     resign = get_dict.get('resign')
 
     if resign == 'true':
-
-      if params.get('disallow_last_resign'):
-        # check if the current role is the last for this scope
-        fields = {'scope': role_entity.scope,
-            'status': 'active'}
-        roles = logic.getForFields(fields, limit=2)
-
-        # if there is more then one left we can safely resign
-        resign = len(roles) > 1
-      else:
-        resign = True
+      # change the status of this role_entity to invalid
+      fields = {'status': 'invalid'}
+      logic.updateEntityProperties(role_entity, fields)
 
-      if resign:
-        # change the status of this role_entity to invalid
-        fields = {'status': 'invalid'}
-        logic.updateEntityProperties(role_entity, fields)
-
-        # redirect to the roles listing
-        return http.HttpResponseRedirect(redirect)
-      else:
-        # show error to the user
-        context['not_allowed_to_resign'] = ugettext("This user can't be "
-            "resigned, please make sure it's not the last %(name)s." % params)
+      # redirect to the roles listing
+      return http.HttpResponseRedirect(redirect)
 
     # set the appropriate context
     context['entity'] = role_entity