MoinMoin Groups

The aim of the existing group handling code refactoring is to get access to the groups definitions in various backends, like LDAP, RDBMS.

Kinds of TODOs:

Repository

Main

http://hg.moinmo.in/moin/1.9-groups-dmilajevs/

Secondary

http://hg.zest.id.lv/moin-groups/

Group backends

Group

Group is something which stores members. Groups are immutable. A member is either some arbitrary entity name (Unicode object) or a name of another group (also a Unicode object).

API

Methods:

Description

Group method

Notes

Containment check

__contains__(self, member, processed_groups=None)

first checks members, then iterates over member_groups and delegates to their _contains

Iteration over items

__iter__(self, yielded_members=None, processed_groups=None)

first yield members' members, then iterate over member_groups and yield THEIR members

__repr__(self)

Gives a sane representation to ease debugging

Attributes:

Description

Group attribute

Notes

Name of a group

name

Backend which created this group

_backend

Backend

Backend provides access to the group definitions for the other MoinMoin code.

API

Description

Backend method

Note

Creation of a backend

__init__(self, request)

Check if member is a group name

is_group(self, member)

Selection of a group by its name

__getitem__(self, group_name)

Iteration over group names

__iter__(self)

Check if a group called group_name is defined

__contains__(self, group_name)

List all groups where member is a member of

groups_with_member(self, member)

wiki_groups backend (SOCTODO)

The wiki_groups backend allows to define groups on wiki pages. See SystemPagesGroup as example of a group page.

Normally, the name of the group page has to end with Group like FriendsGroup. This lets MoinMoin recognize it as a list of usernames. This default pattern could be changed (e.g. for non-english languages etc.), see HelpOnConfiguration.

MoinMoin.formatter.groups is used to extract group members from a page.

(!) The wiki_groups backend is used by default.

   1 from wikiconfig import LocalConfig
   2 from MoinMoin.datastruct import WikiGroups
   3 
   4 class Config(LocalConfig):
   5 
   6     def groups(self, request):
   7         return WikiGroups(request)

config_groups backend (SOCTODO)

The config_groups backend enables one to define groups and their members in a wiki config.

One can define config groups in the following way

   1 from wikiconfig import LocalConfig
   2 from MoinMoin.datastruct import ConfigGroups
   3 
   4 class Config(LocalConfig):
   5 
   6     def groups(self, request):
   7         groups = {u'EditorGroup': [u'AdminGroup', u'John', u'JoeDoe', u'Editor1'],
   8                   u'AdminGroup': [u'Admin1', u'Admin2', u'John']}
   9         return ConfigGroups(request, groups)

page_group_regex is used to differentiate group names and member names.

composite_groups backend

The composite_groups is a backend that does not have direct storage, but composes other backends to a new one, so group definitions are retrieved from several backends. This allows to mix different backends.

Configuration snippet:

   1 from wikiconfig import LocalConfig
   2 from MoinMoin.datastruct import ConfigGroups, WikiGroups, CompositeGroups
   3 
   4 class Config(LocalConfig):
   5 
   6     def groups(self, request):
   7         groups = {u'EditorGroup': [u'AdminGroup', u'John', u'JoeDoe', u'Editor1'],
   8                   u'AdminGroup': [u'Admin1', u'Admin2', u'John']}
   9 
  10         # Here ConfigGroups and WikiGroups backends are used.
  11         # Note that order matters! Since ConfigGroups backend is mentioned first
  12         # EditorGroup will be retrieved from it, not from WikiGroups.
  13         return CompositeGroups(request,
  14                                ConfigGroups(request, groups),
  15                                WikiGroups(request))

Group name clashes

Groups should be defined in one backend scope. If a group with same name is defined in several backends, the composite_groups backend considers only backend which is listed earlier in CompositeGroups initialization. In the example above the AdminGroup contains only Admin1, Admin2, John even if there is anAdminGroup wiki page.

Iteration over groups does not return groups which names have been already yielded (it filters out duplicates).

SomeOthersGroupBackends

LDAPGroupBackend (TODO)

Users is these groups must be authenticated via ldap. The moinmoin group name is the ldap group name plus the suffx Group.

Configuration snippet:

   1 from wikiconfig import LocalConfig
   2 from MoinMoin.datastruct.backends.ldap_groups import LdapGroups
   3 from MoinMoin.util.ldap_connection import LDAPConnection
   4 
   5 class Config(LocalConfig):
   6 
   7     def groups(self, request):
   8         l = LDAPConnection( server_uri='ldap://localhost', bind_dn='cn=admin,dc=domain,dc=net', bind_pw='xxx')
   9         return LdapGroups( request, l, base_dn='dc=domain,dc=net')

SQLGroupBackend (TODO)

The SQLGroupBackend gets data from the RDBMS. SQLAlchemy can help making this portable over a range of sql dbms.

The work on a SQLGroupBackend was dropped because of too much dependencies to the storage refactoring. Currently it makes no sense to define an additional database for group definition while this becomes a table in the storage repository in a sqlalchemy backend. -- ReimarBauer 2009-07-19 12:44:16

POSIX group

needs root access and can't be easily implemented because of that.

NIS group

needs root access and can't be easily implemented because of that.

Pagecommands

Refactor PageEditor

Dict backends (SocToDo)

(needs to be done because of the refactoring of wikidicts which currently mixed up Group set like definitions and dicts.)

Dict backends store key-value pairs like in a dictionary or glossary.

Dict

API

Methods:

Dict method

Notes

__init__(self, request, name, backend)

__iter__(self)

__len__(self)

__getitem__(self)

get(self, key, default=None)

Attributes:

Dict Attribute

Notes

name

_backend

Backend

API

Methods:

Backend method

Notes

__init__(self, request)

is_dict_name(self, name)

Check if a <name> is a dict name

__contains__(self, dict_name)

Check if a dict called <dict_name> is available in this backend.

__getitem__(self, dict_name)

Get a dict by its moin dict name

wiki_dicts backend

See HelpOnDictionaries

(!) This backend is used by default.

   1 from wikiconfig import LocalConfig
   2 from MoinMoin.datastruct import WikiDicts
   3 
   4 class Config(LocalConfig):
   5     def dict_manager_init(self, request):
   6         return WikiDicts(request)

config_dicts backend

In a similar way to config_groups, dicts may be defined in a configuration file.

   1 from wikiconfig import LocalConfig
   2 from MoinMoin.datastruct import ConfigDicts
   3 
   4 class Config(LocalConfig):
   5     def dict_manager_init(self, request):
   6         dicts = {u'OneDict': {u'first_key': u'first item',
   7                               u'second_key': u'second item'},
   8                  u'NumbersDict': {u'1': 'One',
   9                                   u'2': 'Two'}}
  10         return ConfigDicts(request, dicts)

composite_dicts backend

Using the composite_dicts backend it is possible get dict definitions from several backends.

   1 from wikiconfig import LocalConfig
   2 from MoinMoin.datastruct import WikiDicts, ConfigDicts, CompositeDicts
   3 
   4 class Config(LocalConfig):
   5     def dict_manager_init(self, request):
   6         dicts = {u'OneDict': {u'first_key': u'first item',
   7                               u'second_key': u'second item'},
   8                  u'NumbersDict': {u'1': 'One',
   9                                   u'2': 'Two'}}
  10         return CompositeDicts(request,
  11                                   ConfigDicts(request, dicts),
  12                                   WikiDicts(request))

Plan

Activity log

Current plan

Beta/RC releases

Betatesting (TODO)

Put simply: Betatesters, we need you!

Diary

My university timetable. It includes lectures and exams.

<< <  2009 / 5 >  >>
Mon Tue Wed Thu Fri Sat Sun
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

<< <  2009 / 6 >  >>
Mon Tue Wed Thu Fri Sat Sun
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          

<< <  2009 / 7 >  >>
Mon Tue Wed Thu Fri Sat Sun
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

<< <  2009 / 8 >  >>
Mon Tue Wed Thu Fri Sat Sun
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            

Discussion

Add your thoughts, concerns and use-cases here.


CategoryGoogleSummerOfCode2009 CategoryGsocProject

MoinMoin: Groups2009 (last edited 2012-06-01 07:59:46 by EugeneSyromyatnikov)