Thomas Waldmann avatar Thomas Waldmann committed 9cf6a6b

rename create_simple_mapping() acl param names, you may need to update your wikiconfig!

It is now called like this:

create_simple_mapping(uri='...', default_acl=..., userprofiles_acl=...)

This was "content_acl" and "user_profile_acl" before, but as the namespaces are
named "default" and "userprofiles", I changed it for better consistency.

Comments (0)

Files changed (7)

MoinMoin/_tests/test_test_environ.py

         assert storage.has_item(itemname)
 
 
-CONTENT_ACL = dict(
+DEFAULT_ACL = dict(
     before="+All:write",  # need to write to sys pages
     default="All:read,write,admin,create,destroy",
     after="Me:create",
 class TestStorageEnvironWithConfig(object):
 
     class Config(wikiconfig.Config):
-        content_acl = CONTENT_ACL
+        default_acl = DEFAULT_ACL
 
     def test_config(self):
         assert isinstance(app.cfg, wikiconfig.Config)
-        assert app.cfg.content_acl == CONTENT_ACL
+        assert app.cfg.default_acl == DEFAULT_ACL

MoinMoin/_tests/wikiconfig.py

     _root = abspath(join(_here, '..', '..'))
     data_dir = join(_here, 'wiki', 'data')  # needed for plugins package TODO
     index_storage = 'FileStorage', (join(_here, 'wiki', 'index'), ), {}
-    content_acl = None
+    default_acl = None
     item_root = 'FrontPage'
     interwikiname = u'MoinTest'
     interwiki_map = dict(Self='http://localhost:8080/', MoinMoin='http://moinmo.in/')

MoinMoin/conftest.py

 
 def init_test_app(given_config):
     namespace_mapping, backend_mapping, acl_mapping = \
-        create_simple_mapping("stores:memory:", given_config.content_acl)
+        create_simple_mapping("stores:memory:", given_config.default_acl)
     more_config = dict(
         namespace_mapping=namespace_mapping,
         backend_mapping=backend_mapping,

MoinMoin/security/_tests/test_security.py

     from MoinMoin._tests import wikiconfig
 
     class Config(wikiconfig.Config):
-        content_acl = dict(hierarchic=False, before=u"WikiAdmin:admin,read,write,create,destroy", default=u"All:read,write", after=u"All:read")
+        default_acl = dict(hierarchic=False, before=u"WikiAdmin:admin,read,write,create,destroy", default=u"All:read,write", after=u"All:read")
         acl_functions = u"SuperUser:superuser NoTextchaUser:notextcha"
 
     def setup_method(self, method):
     from MoinMoin._tests import wikiconfig
 
     class Config(wikiconfig.Config):
-        content_acl = dict(hierarchic=True, before=u"WikiAdmin:admin,read,write,create,destroy", default=u"All:read,write", after=u"All:read")
+        default_acl = dict(hierarchic=True, before=u"WikiAdmin:admin,read,write,create,destroy", default=u"All:read,write", after=u"All:read")
 
     def setup_method(self, method):
         become_trusted(username=u'WikiAdmin')
     from MoinMoin._tests import wikiconfig
 
     class Config(wikiconfig.Config):
-        content_acl = dict(hierarchic=True, before=u"WikiAdmin:admin,read,write,create,destroy", default=u"Editor:read,write", after=u"All:read")
+        default_acl = dict(hierarchic=True, before=u"WikiAdmin:admin,read,write,create,destroy", default=u"Editor:read,write", after=u"All:read")
 
     def setup_method(self, method):
         become_trusted(username=u'WikiAdmin')

MoinMoin/storage/__init__.py

 
 
 def create_simple_mapping(uri='stores:fs:instance',
-                          content_acl=None, user_profile_acl=None):
+                          default_acl=None, userprofiles_acl=None):
     """
     When configuring storage, the admin needs to provide a namespace_mapping.
     To ease creation of such a mapping, this function provides sane defaults
                  to below /path/to/store/.
     """
     # if no acls are given, use something mostly harmless:
-    if not content_acl:
-        content_acl = dict(before=u'', default=u'All:read,write,create', after=u'', hierarchic=False)
-    if not user_profile_acl:
-        user_profile_acl = dict(before=u'All:', default=u'', after=u'', hierarchic=False)
+    if not default_acl:
+        default_acl = dict(before=u'', default=u'All:read,write,create', after=u'', hierarchic=False)
+    if not userprofiles_acl:
+        userprofiles_acl = dict(before=u'All:', default=u'', after=u'', hierarchic=False)
     namespaces = {
         NAMESPACE_DEFAULT: BACKEND_DEFAULT,
         NAMESPACE_USERPROFILES + ':': BACKEND_USERPROFILES,
         BACKEND_USERPROFILES: None,
     }
     acls = {
-        NAMESPACE_USERPROFILES + ':': user_profile_acl,
-        NAMESPACE_DEFAULT: content_acl,
+        NAMESPACE_USERPROFILES + ':': userprofiles_acl,
+        NAMESPACE_DEFAULT: default_acl,
     }
     return create_mapping(uri, namespaces, backends, acls)

docs/admin/configure.rst

 
     namespace_mapping, backend_mapping, acl_mapping = create_simple_mapping(
         uri=...,
-        content_acl=dict(before=...,
+        default_acl=dict(before=...,
                          default=...,
                          after=...,
                          hierarchic=..., ),
-        user_profile_acl=dict(before=...,
+        userprofiles_acl=dict(before=...,
                               default=...,
-                              after=..., ),
+                              after=...,
+                              hierarchiv=False, ),
     )
 
 The `uri` depends on the kind of storage backend and stores you want to use, 
 | userprofiles   | /srv/mywiki/userprofiles/   |
 +----------------+-----------------------------+
 
-`content_acl` and `user_profile_acl` are dictionaries specifying the ACLs for
+`default_acl` and `userprofiles_acl` are dictionaries specifying the ACLs for
 this part of the namespace (normal content, user profiles).
 See the docs about ACLs.
 
     data_dir = '/srv/mywiki/data'
     namespace_mapping, acl_mapping = create_simple_mapping(
         uri='stores:fs:{0}/%(nsname)s/%(kind)s'.format(data_dir),
-        content_acl=dict(before=u'WikiAdmin:read,write,create,destroy',
+        default_acl=dict(before=u'WikiAdmin:read,write,create,destroy',
                          default=u'All:read,write,create',
                          after=u'', ),
-        user_profile_acl=dict(before=u'WikiAdmin:read,write,create,destroy',
+        userprofiles_acl=dict(before=u'WikiAdmin:read,write,create,destroy',
                               default=u'',
                               after=u'', ),
     )
     namespace_mapping, backend_mapping, acl_mapping = create_simple_mapping(
         uri='stores:fs:{0}/%(backend)s/%(kind)s'.format(data_dir),
         # XXX we use rather relaxed ACLs for the development wiki:
-        content_acl=dict(before=u'',
+        default_acl=dict(before=u'',
                          default=u'All:read,write,create,destroy,admin',
                          after=u'',
                          hierarchic=False, ),
-        user_profile_acl=dict(before=u'',
+        userprofiles_acl=dict(before=u'',
                               default=u'All:read,write,create,destroy,admin',
                               after=u'',
                               hierarchic=False, ),
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.