view wiki/config/more_samples/groups_wikiconfig_snippet @ 4874:7b181a7e35b2

groups/dicts: improved docs/CHANGES and snippets
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 21 Jul 2009 21:11:57 +0200
parents c098b029cf60
children
line wrap: on
line source
    # This is a sample configuration snippet that shows moin's groups configuration.
    # See HelpOnConfiguration for more info.

    # WikiGroups backend gets groups from wiki pages and is used by default.
    def groups(self, request):
        from MoinMoin.datastruct import WikiGroups
        return WikiGroups(request)

    # ConfigGroups uses groups defined in the configuration file.
    def groups(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)

    # CompositeGroups to use both ConfigGroups and WikiGroups backends.
    def groups(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))