add setting to hide emails in admin page
authorraph
Thu, 10 Dec 2009 16:11:57 +0100
changeset 44 c27132146767
parent 43 c13c0e78b0ca
child 45 678f8cb31c05
add setting to hide emails in admin page
src/cm/cm_settings.py
src/cm/templates/site/user_list.html
src/cm/views/user.py
--- a/src/cm/cm_settings.py	Thu Dec 10 15:07:47 2009 +0100
+++ b/src/cm/cm_settings.py	Thu Dec 10 16:11:57 2009 +0100
@@ -20,4 +20,7 @@
 NO_SECURITY = get_setting('NO_SECURITY', False)
 
 # should every contributor be registered to notifications automatically
-AUTO_CONTRIB_REGISTER = get_setting('AUTO_CONTRIB_REGISTER', False)
\ No newline at end of file
+AUTO_CONTRIB_REGISTER = get_setting('AUTO_CONTRIB_REGISTER', False)
+
+# show email in user list
+SHOW_EMAILS_IN_ADMIN = get_setting('SHOW_EMAILS_IN_ADMIN', True)
\ No newline at end of file
--- a/src/cm/templates/site/user_list.html	Thu Dec 10 15:07:47 2009 +0100
+++ b/src/cm/templates/site/user_list.html	Thu Dec 10 16:11:57 2009 +0100
@@ -130,7 +130,7 @@
             </script>
             </th>
             <th>{% up_down user__username %}{% blocktrans %}User{% endblocktrans %}{% endup_down %}</th>
-            <th>{% up_down user__email %}{% blocktrans %}Email{% endblocktrans %}{% endup_down %}</th>
+            {% if SHOW_EMAILS_IN_ADMIN %}<th>{% up_down user__email %}{% blocktrans %}Email{% endblocktrans %}{% endup_down %}</th>{% endif %}
             <th>{% up_down user__date_joined %}{% blocktrans %}Date joined{% endblocktrans %}{% endup_down %}</th>
             <th>{% up_down role__name %}{% blocktrans %}Role{% endblocktrans %}{% endup_down %}</th>
             <th>{% blocktrans %}Last week activity{% endblocktrans %}</th>
@@ -145,7 +145,7 @@
         <td>
 			{% include "site/macros/user_actions.html" %}
         </td>
-        <td><a href="mailto:{{ user.email }}">{{ user.email }}</a></td>
+        {% if SHOW_EMAILS_IN_ADMIN %}<td><a href="mailto:{{ user.email }}">{{ user.email }}</a></td>{% endif %}
         <td>{{ user.date_joined|local_date }}</td>
         <td>
                 <select name="user-role-{{ user.get_profile.key }}" {% ifequal user request.user %}disabled="disabled"{% endifequal %}>
@@ -175,7 +175,7 @@
     <tr class="full-border even">
         <td></td>
         <td><a class="main_object_title" title="{% blocktrans %}Edit anonymous users{% endblocktrans %}" href="{% url user-anon-edit %}">{% blocktrans %}Anonymous users{% endblocktrans %}</a></td>
-        <td>-</td>
+        {% if SHOW_EMAILS_IN_ADMIN %}<td>-</td>{% endif %}
         <td>-</td>
         <td>
             <select name="user-role-_">
--- a/src/cm/views/user.py	Thu Dec 10 15:07:47 2009 +0100
+++ b/src/cm/views/user.py	Thu Dec 10 16:11:57 2009 +0100
@@ -22,6 +22,7 @@
 from cm.views import get_keys_from_dict
 from cm.security import has_global_perm
 from cm.exception import UnauthorizedException
+from cm.cm_settings import SHOW_EMAILS_IN_ADMIN
 from tagging.models import Tag
 import sys
 import re
@@ -109,6 +110,7 @@
                'display_suspended_users' : display_suspended_users,
                'tag_list' : Tag.objects.usage_for_model(UserProfile),
                'tag_selected': tag_selected,
+               'SHOW_EMAILS_IN_ADMIN': SHOW_EMAILS_IN_ADMIN,
                }
     
     query = UserRole.objects.select_related().filter(text=None).filter(~Q(user=None)).order_by(order_by)