changeset 4847:f0bcf3e1725d

Groups2009: Configuration snippets for groups.
author Dmitrijs Milajevs <dimazest@gmail.com>
date Mon, 13 Jul 2009 16:55:17 +0200
parents 982f706482e7
children f1e75133ab7b
files wiki/config/more_samples/groups_wikiconfig_snippet
diffstat 1 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wiki/config/more_samples/groups_wikiconfig_snippet	Mon Jul 13 16:55:17 2009 +0200
@@ -0,0 +1,28 @@
+    # This is a sample configuration snippet that shows moin's groups configuration
+    # See HelpOnConfiguration for more info.
+
+    # The wiki_groups backend is used by default.
+    def group_manager_init(self, request):
+        from MoinMoin.datastruct import WikiGroups
+        return WikiGroups(request)
+
+    # Use only groups defined in the configuration file.
+    def group_manager_init(self, request):
+        from MoinMoin.datastruct import ConfigGroups
+        # Groups are defined here.
+        groups = {u'EditorGroup': [u'AdminGroup', u'John', u'JoeDoe', u'Editor1'],
+                  u'AdminGroup': [u'Admin1', u'Admin2', u'John']}
+        return ConfigGroups(request, groups)
+
+    # Use both config_groups and wiki_groups backends.
+    def group_manager_init(self, request):
+        from MoinMoin.datastruct import ConfigGroups, WikiGroups, CompositeGroups
+        groups = {u'EditorGroup': [u'AdminGroup', u'John', u'JoeDoe', u'Editor1'],
+                  u'AdminGroup': [u'Admin1', u'Admin2', u'John']}
+
+        # Here ConfigGroups and WikiGroups backends are used.
+        # Note that order matters! Since ConfigGroups backend is mentioned first
+        # EditorGroup will be retrieved from it, not from WikiGroups.
+        return CompositeGroups(request,
+                               ConfigGroups(request, groups),
+                               WikiGroups(request))