Bhavesh Goyal has proposed merging 
lp:~bhavesh-goyal093/postorius/fixed-postorius-method-decorators into 
lp:postorius.

Requested reviews:
  Mailman Coders (mailman-coders)
Related bugs:
  Bug #1435062 in Postorius: "Postorius gets confused in showing views for 
members with multiple roles"
  https://bugs.launchpad.net/postorius/+bug/1435062

For more details, see:
https://code.launchpad.net/~bhavesh-goyal093/postorius/fixed-postorius-method-decorators/+merge/256037

Fixed Bug #1435062 which caused postorius to show incorrect nav bar view for 
members posessing different roles.
The solution was found in correcting permissions for list_nav template and 
fixing method decorators for list_moderator_required which earlier didn't set 
is_list_owner to be True even if the user was the owner and as a result the 
view was shown to be incorrect.
Now the attributes are set correctly according to the roles and the nav bar 
sows correct view or different and multiple roles.
-- 
Your team Mailman Coders is requested to review the proposed merge of 
lp:~bhavesh-goyal093/postorius/fixed-postorius-method-decorators into 
lp:postorius.
=== modified file 'src/postorius/auth/decorators.py'
--- src/postorius/auth/decorators.py	2015-02-09 14:35:44 +0000
+++ src/postorius/auth/decorators.py	2015-04-13 21:09:22 +0000
@@ -82,13 +82,18 @@
         if getattr(user, 'is_list_owner', None):
             return fn(*args, **kwargs)
         if getattr(user, 'is_list_moderator', None):
-            return fn(*args, **kwargs)
+	    return fn(*args, **kwargs)
         mlist = List.objects.get_or_404(fqdn_listname=list_id)
         if user.email not in mlist.moderators and \
                 user.email not in mlist.owners:
             raise PermissionDenied
-        else:
-            user.is_list_moderator = True
+	else:
+	    if user.email in mlist.moderators and \
+		    user.email not in mlist.owners:
+	        user.is_list_moderator = True
+	    else:
+	        user.is_list_moderator = True
+	        user.is_list_owner = True
             return fn(*args, **kwargs)
     return wrapper
 

=== modified file 'src/postorius/templates/postorius/menu/list_nav.html'
--- src/postorius/templates/postorius/menu/list_nav.html	2015-04-13 19:38:03 +0000
+++ src/postorius/templates/postorius/menu/list_nav.html	2015-04-13 21:09:22 +0000
@@ -9,7 +9,7 @@
         {% if user.is_superuser or user.is_list_owner %}
             <li class="mm_nav_item"><a class="{% nav_active_class current 'list_members' %}" href="{% url 'list_members' list.list_id %}">{% trans "Members" %}</a></li>
         {% endif %}
-        {% if user.is_superuser or user.is_list_moderator %}
+        {% if user.is_superuser or user.is_list_owner or user.is_list_moderator %}
             <li class="mm_nav_item"><a class="{% nav_active_class current 'list_held_messages' %}" href="{% url 'list_held_messages' list.list_id %}">{% trans "Held Messages" %}</a></li>
         {% endif %}
         {% if user.is_superuser or user.is_list_owner %}

_______________________________________________
Mailman-coders mailing list
[email protected]
https://mail.python.org/mailman/listinfo/mailman-coders

Reply via email to