changeset 2670:54aaba93f5de

Added Groups view to for admin to view information regarding all groups and provide links to their ACL Report
author Ajitesh Gupta <ajgupta93@gmail.com>
date Sat, 19 Jul 2014 14:54:30 +0530
parents 7798855349f6
children 5e518c71b581
files MoinMoin/apps/admin/templates/admin/groupbrowser.html MoinMoin/apps/admin/templates/admin/index.html MoinMoin/apps/admin/views.py
diffstat 3 files changed, 50 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/apps/admin/templates/admin/groupbrowser.html	Sat Jul 19 14:54:30 2014 +0530
@@ -0,0 +1,25 @@
+{% extends theme("layout.html") %}
+{% import "utils.html" as utils %}
+{% block content %}
+    <h1>{{ _("Groups") }}</h1>
+    <table class="table table-hover tablesorter tablesorter-default moin-sortable" data-sortlist="[[0,0],[1,0]]">
+        <thead>
+            <tr>
+                <th>{{ _("Group Names") }}</th>
+                <th>{{ _("Member Users") }}</th>
+                <th>{{ _("Member Groups") }}</th>
+                <th>{{ _("Group ACL Report") }}</th>
+            </tr>
+        </thead>
+        <tbody>
+            {% for group in groups %}
+                <tr>
+                    <td>{% if group['grouptype'] == 'WikiGroup' %}<a href="{{ url_for('frontend.modify_item', item_name=group['name']) }}">{% endif %}{{ group['name'] }}</a></td>
+                    <td>{{ group['member_users']|sort|join(', ') }}</td>
+                    <td>{{ group['member_groups']|sort|join(', ') }}</td>
+                    <td>ACL Report</td>
+                </tr>
+            {% endfor %}
+        </tbody>
+    </table>
+{% endblock %}
--- a/MoinMoin/apps/admin/templates/admin/index.html	Sat Jul 19 14:38:21 2014 +0530
+++ b/MoinMoin/apps/admin/templates/admin/index.html	Sat Jul 19 14:54:30 2014 +0530
@@ -6,5 +6,6 @@
     <li><a href="{{ url_for('admin.wikiconfig') }}">{{ _("Show Wiki Configuration") }}</a></li>
     <li><a href="{{ url_for('admin.wikiconfighelp') }}">{{ _("Wiki Configuration Help") }}</a></li>
     <li><a href="{{ url_for('admin.trash', namespace='all') }}">{{ _("Trash") }}</a></li>
+    <li><a href="{{ url_for('admin.groupbrowser') }}">{{ _("Groups") }}</a></li>
 </ul>
 {% endblock %}
--- a/MoinMoin/apps/admin/views.py	Sat Jul 19 14:38:21 2014 +0530
+++ b/MoinMoin/apps/admin/views.py	Sat Jul 19 14:54:30 2014 +0530
@@ -25,6 +25,7 @@
 from MoinMoin.constants.rights import SUPERUSER
 from MoinMoin.security import require_permission
 from MoinMoin.util.interwiki import CompositeName
+from MoinMoin.datastruct.backends.wiki_groups import WikiGroup
 
 
 @admin.route('/superuser')
@@ -280,3 +281,26 @@
                            title_name=_(u'User ACL Report'),
                            user_names=theuser.name,
                            itemwise_acl=itemwise_acl)
+
+
+@admin.route('/groupbrowser', methods=['GET'])
+@require_permission(SUPERUSER)
+def groupbrowser():
+    """
+    Display list of all groups and their members
+    """
+    all_groups = flaskg.groups
+    groups = []
+    for group in all_groups:
+        group_type = ''
+        if isinstance(all_groups[group], WikiGroup):
+            group_type = 'WikiGroup'
+        else:
+            group_type = 'ConfigGroup'
+        groups.append(dict(name=all_groups[group].name,
+                           member_users=all_groups[group].members,
+                           member_groups=all_groups[group].member_groups,
+                           grouptype=group_type))
+    return render_template('admin/groupbrowser.html',
+                           title_name=_(u'Groups'),
+                           groups=groups)