changeset 2671:5e518c71b581

Added item acl report view for admin to view ACLs for all the items in the wiki and provided links to their modify view
author Ajitesh Gupta <ajgupta93@gmail.com>
date Sat, 19 Jul 2014 15:21:50 +0530
parents 54aaba93f5de
children 3f729c4a241c
files MoinMoin/apps/admin/templates/admin/index.html MoinMoin/apps/admin/templates/admin/item_acl_report.html MoinMoin/apps/admin/views.py MoinMoin/static/js/common.js MoinMoin/themes/basic/static/css/basic.css MoinMoin/themes/basic/static/custom-less/basic.less
diffstat 6 files changed, 59 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/admin/templates/admin/index.html	Sat Jul 19 14:54:30 2014 +0530
+++ b/MoinMoin/apps/admin/templates/admin/index.html	Sat Jul 19 15:21:50 2014 +0530
@@ -7,5 +7,6 @@
     <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>
+    <li><a href="{{ url_for('admin.item_acl_report') }}">{{ _("Item ACL Report") }}</a></li>
 </ul>
 {% endblock %}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/apps/admin/templates/admin/item_acl_report.html	Sat Jul 19 15:21:50 2014 +0530
@@ -0,0 +1,21 @@
+{% extends theme("layout.html") %}
+{% import "utils.html" as utils %}
+{% block content %}
+    <h1>{{ _("Item ACL Report") }}</h1>
+    <table class="table table-hover tablesorter tablesorter-default moin-sortable" data-sortlist="[[0,0]]">
+        <thead>
+            <tr>
+                <th>{{ _("Item Names") }}</th>
+                <th>{{ _("ACL") }}</th>
+            </tr>
+        </thead>
+        <tbody>
+            {% for item in items_acls %}
+                <tr>
+                    <td><a href="{{ url_for('frontend.modify_item', item_name=item['fqname']) }}">{% if item['name'] %}{{ item['name'] | join(', ') }}{% else %}{{ _("Item Id") }}: {{ item['itemid'] }}{% endif %}</a></td>
+                    <td>{{ item['acl'] }}</td>
+                </tr>
+            {% endfor %}
+        </tbody>
+    </table>
+{% endblock %}
--- a/MoinMoin/apps/admin/views.py	Sat Jul 19 14:54:30 2014 +0530
+++ b/MoinMoin/apps/admin/views.py	Sat Jul 19 15:21:50 2014 +0530
@@ -20,7 +20,7 @@
 from MoinMoin.themes import render_template, get_editor_info
 from MoinMoin.apps.admin import admin
 from MoinMoin import user
-from MoinMoin.constants.keys import NAME, ITEMID, SIZE, EMAIL, DISABLED, NAME_EXACT, WIKINAME, TRASH, NAMESPACE, NAME_OLD, REVID, MTIME, COMMENT, LATEST_REVS, EMAIL_UNVALIDATED
+from MoinMoin.constants.keys import NAME, ITEMID, SIZE, EMAIL, DISABLED, NAME_EXACT, WIKINAME, TRASH, NAMESPACE, NAME_OLD, REVID, MTIME, COMMENT, LATEST_REVS, EMAIL_UNVALIDATED, ACL
 from MoinMoin.constants.namespaces import NAMESPACE_USERPROFILES, NAMESPACE_DEFAULT, NAMESPACE_ALL
 from MoinMoin.constants.rights import SUPERUSER
 from MoinMoin.security import require_permission
@@ -304,3 +304,30 @@
     return render_template('admin/groupbrowser.html',
                            title_name=_(u'Groups'),
                            groups=groups)
+
+
+@admin.route('/item_acl_report', methods=['GET'])
+@require_permission(SUPERUSER)
+def item_acl_report():
+    """
+    Return a list of all items in the wiki along with the ACL Meta-data
+    """
+    all_items = flaskg.storage.documents(wikiname=app.cfg.interwikiname)
+    items_acls = []
+    for item in all_items:
+        item_namespace = item.meta.get(NAMESPACE)
+        item_id = item.meta.get(ITEMID)
+        item_name = item.meta.get(NAME)
+        item_acl = item.meta.get(ACL)
+        fqname = CompositeName(item_namespace, u'itemid', item_id)
+        if item_acl is None:
+            for namespace, acl_config in app.cfg.acl_mapping:
+                if item_namespace == namespace or item_namespace == 'userprofiles' and namespace == 'userprofiles/':
+                    item_acl = 'Default ({0})'.format(acl_config['default'])
+        items_acls.append({'name': item_name,
+                           'itemid': item_id,
+                           'fqname': fqname,
+                           'acl': item_acl})
+    return render_template('admin/item_acl_report.html',
+                           title_name=_('Item ACL Report'),
+                           items_acls=items_acls)
--- a/MoinMoin/static/js/common.js	Sat Jul 19 14:54:30 2014 +0530
+++ b/MoinMoin/static/js/common.js	Sat Jul 19 15:21:50 2014 +0530
@@ -663,6 +663,7 @@
 
     moin.enhanceUserSettings();
     moin.enhanceEdit();
+    $('.moin-sortable').tablesorter();
     // placing initToggleComments after enhanceEdit prevents odd autoscroll issue when editing hidden comments
     moin.initToggleComments();
 });
--- a/MoinMoin/themes/basic/static/css/basic.css	Sat Jul 19 14:54:30 2014 +0530
+++ b/MoinMoin/themes/basic/static/css/basic.css	Sat Jul 19 15:21:50 2014 +0530
@@ -6978,6 +6978,10 @@
 .tablesorter-header.sorter-false {
   background-image: None;
 }
+.tablesorter-header-inner {
+  padding-left: 20px;
+  cursor: pointer;
+}
 #ticket-summary {
   width: 50%;
 }
--- a/MoinMoin/themes/basic/static/custom-less/basic.less	Sat Jul 19 14:54:30 2014 +0530
+++ b/MoinMoin/themes/basic/static/custom-less/basic.less	Sat Jul 19 15:21:50 2014 +0530
@@ -706,6 +706,10 @@
 .tablesorter-header.sorter-false {
   background-image: None;
 }
+.tablesorter-header-inner {
+  padding-left: 20px;
+  cursor: pointer;
+}
 #ticket-summary {
   width: 50%;
 }