--- trunk/django/django/conf/admin_templates/index.html (revision 656)
+++ trunk/django/django/conf/admin_templates/index.html (working copy)
@@ -9,20 +9,40 @@
 {% load adminapplist %}
 
 {% get_admin_app_list as app_list %}
-{% for app in app_list %}
-    <div class="module">
-    <h2>{{ app.name }}</h2>
-    <table>
-    {% for model in app.models %}
-        <tr>
-            <th><a href="{{ model.admin_url }}">{{ model.name }}</a></th>
-            <td class="x50"><a href="{{ model.admin_url }}add/" class="addlink">Add</a></td>
-            <td class="x75"><a href="{{ model.admin_url }}" class="changelink">Change</a></td>
-        </tr>
+{% if user_has_perms_in_any_app %}
+    {% for app in app_list %}
+        {% if app.has_module_perms %}
+            <div class="module">
+            <h2>{{ app.name }}</h2>
+            <table>
+            {% for model in app.models %}
+                <tr>
+                    {% if model.perms.change %}
+                        <th><a href="{{ model.admin_url }}">{{ model.name }}</a></th>
+                    {% else %}
+                        <th>{{ model.name }}</th>
+                    {% endif %}
+
+                    <td class="x125" style="align:right;">
+                        {% if model.perms.add %}
+                            <a href="{{ model.admin_url }}add/" class="addlink">Add</a>&nbsp;&nbsp;
+                        {% endif %}
+
+                        {% if model.perms.change %}
+                            <a href="{{ model.admin_url }}" class="changelink">Change</a>
+                        {% endif %}
+                    </td>
+
+                </tr>
+            {% endfor %}
+            </table>
+            </div>
+        {% endif %}
     {% endfor %}
-    </table>
-    </div>
-{% endfor %}
+
+{% else %}
+    <p>You do not have any permissions in any application.</p>
+{% endif %}
 
 </div>
 {% endblock %}
--- trunk/django/django/conf/admin_media/css/global.css (revision 656)
+++ trunk/django/django/conf/admin_media/css/global.css (working copy)
@@ -99,6 +99,7 @@
 .x50 { width:50px; }
 .x75 { width:75px; }
 .x100 { width:100px; }
+.x125 { width:125px; }
 .x150 { width:150px; }
 .x200 { width:200px; }
 .x250 { width:250px; }
--- trunk/django/django/templatetags/adminapplist.py    (revision 656)
+++ trunk/django/django/templatetags/adminapplist.py    (working copy)
@@ -8,23 +8,52 @@
         from django.core import meta
         from django.utils.text import capfirst
         app_list = []
+        user = context['user']
+        user_has_perms_in_any_app = False
+        
         for app in meta.get_installed_model_modules():
             app_label = app.__name__[app.__name__.rindex('.')+1:]
-            model_list = [{'name': capfirst(m._meta.verbose_name_plural),
-                            'admin_url': '%s/%s/' % (app_label, m._meta.module_name)} \
-                            for m in app._MODELS if m._meta.admin]
+            has_module_perms = user.has_module_perms(app_label)
+            if has_module_perms == True:
+                user_has_perms_in_any_app = True
+            
+            model_list = []
+            for m in app._MODELS:
+                if m._meta.admin:
+                    module_name = m._meta.module_name
+                    perms = {}
+                    add_perm = "%s.%s" % (app_label, m._meta.get_add_permission())
+                    perms['add'] = user.has_perm(add_perm)                                        
+                    
+                    change_perm = "%s.%s" % (app_label, m._meta.get_change_permission())
+                    perms['change'] = user.has_perm(change_perm)
+                    
+                    delete_perm = "%s.%s" % (app_label, m._meta.get_delete_permission())
+                    perms['delete'] = user.has_perm(delete_perm)
+
+                    # Check to see if user has any perm for this one module
+                    # If so, add the module to the model_list
+                    if True in [perm for perm in perms.values()]:
+                        model_dict = {}
+                        model_dict['name'] = capfirst(m._meta.verbose_name_plural)
+                        model_dict['admin_url'] = '%s/%s/' % (app_label, m._meta.module_name)
+                        model_dict['perms'] = perms
+                        model_list.append(model_dict)
+            
             if model_list:
                 app_list.append({
                     'name': app_label.title(),
+                    'has_module_perms': has_module_perms,
                     'models': model_list,
                 })
         context[self.varname] = app_list
+        context['user_has_perms_in_any_app'] = user_has_perms_in_any_app
         return ''
 
 def get_admin_app_list(parser, token):
     """
     {% get_admin_app_list as app_list %}
-    """
+    """    
     tokens = token.contents.split()
     if len(tokens) < 3:
         raise template.TemplateSyntaxError, "'%s' tag requires two arguments" % tokens[0]
@@ -33,3 +62,4 @@
     return AdminApplistNode(tokens[2])
 
 template.register_tag('get_admin_app_list', get_admin_app_list)
+
