changeset 2495:b0e5881e515e

adds basic ui for acl setting
author sharky93 <rishabhr123@gmail.com>
date Tue, 17 Sep 2013 21:55:55 +0530
parents 6a52b3d4ddc8
children 7ca681527b6c
files MoinMoin/items/__init__.py MoinMoin/themes/basic/templates/modify.html
diffstat 2 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/items/__init__.py	Sun Sep 15 23:57:57 2013 +0530
+++ b/MoinMoin/items/__init__.py	Tue Sep 17 21:55:55 2013 +0530
@@ -178,6 +178,7 @@
 class BaseMetaForm(Form):
     itemtype = RequiredText.using(label=L_("Item type")).with_properties(placeholder=L_("Item type"))
     contenttype = RequiredText.using(label=L_("Content type")).with_properties(placeholder=L_("Content type"))
+    acl = RequiredText.using(label=L_("ACL")).with_properties(placeholder=L_("Access Control List"))
     # Disabled - Flatland doesn't distinguish emtpy value and nonexistent
     # value, while an emtpy acl and no acl have different semantics
     #acl = OptionalText.using(label=L_('ACL')).with_properties(placeholder=L_("Access Control List"))
@@ -424,6 +425,9 @@
             # 'strict', which causes KeyError to be thrown when meta contains
             # meta keys that are not present in self['meta_form']. Setting
             # policy to 'duck' suppresses this behavior.
+            if not meta.has_key('acl'):
+                meta['acl'] = "None"
+        
             self['meta_form'].set(meta, policy='duck')
             for k in self['meta_form'].field_schema_mapping.keys():
                 meta.pop(k, None)
@@ -470,6 +474,14 @@
 
         meta = dict(meta)  # we may get a read-only dict-like, copy it
 
+        if meta.has_key('acl'):
+            # we treat this as nothing specified, so fallback to default
+            if meta['acl'] == 'None':
+                meta.pop('acl')
+            # this is treated as a rule which matches nothing
+            elif meta['acl'] == 'Empty':
+                meta['acl'] = ''
+
         # we store the previous (if different) and current item name into revision metadata
         # this is useful for rename history and backends that use item uids internally
         if name is None:
--- a/MoinMoin/themes/basic/templates/modify.html	Sun Sep 15 23:57:57 2013 +0530
+++ b/MoinMoin/themes/basic/templates/modify.html	Tue Sep 17 21:55:55 2013 +0530
@@ -26,6 +26,7 @@
     <ul class="moin-nav nav-tabs moin-shadow">
         <li class="active"><a href="#editor" data-toggle="tab">Edit Content</a></li>
         <li><a href="#meta" data-toggle="tab">Edit Meta</a></li>
+        <li><a href="#acl" data-toggle="tab">Edit ACL</a></li>
         <li><a href="#help" data-toggle="tab">Help</a></li>
     </ul>    
     <div class="tab-content">
@@ -46,6 +47,17 @@
                 </div>
             </div>
         </div>
+        <div class="tab-pane active" id="acl">
+            <div class="row">
+                {% set field = form['meta_form']['acl'] %}
+                <div class="col-lg-6">
+                    <div class="form-group">
+                        {{ gen.label(field) }}
+                        {{ gen.textarea(field, rows='1', class='form-control') }}
+                    </div>
+                </div>
+            </div>
+        </div>
         <div class="tab-pane active" id="help">
             {% if form['content_form'].help %}
                 <pre id="moin-editor-help">{{ form['content_form'].help }}</pre>