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:
SOCTODO means that this is part of the SOC 2009 project of DmitrijsMilajevs (support him, but leave the coding to him)
- TODO means: help needed, anybody is welcome to help with this (please coordinate here or on #moin-dev)
Repository
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.
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)
- some ldap user is wanted to help here
- how can some ldap user help here in detail ?
Here is a patch on 1.9 that implements it ldap_group2.patch
Here is a patch on 1.9 that implements it and merge with ldap_login ldap_group4.patch
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
- replace pagecommands (SIG, DATE ...) by the dict backend (TODO)
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
This backend is used by default.
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
Review HelpOnGroups on the http://master19.moinmo.in
15:22 < ThomasWaldmann> dimazest: http://master19.moinmo.in/HelpOnAccessControlLists#Groups this is currently the only docs for groups 15:25 < ThomasWaldmann> maybe the part about how to define groups should be split off to a HelpOnGroups page, but HelpOnAccessControlLists should still contain infos about group usage in ACLs plus a link to HelpOnGroups then.
sometimes I think it would be good to have the groups of the user also in the user object. request.user.groups dreimark 31.05.05
Documentation
dicts description on the Groups2009
update docs/CHANGES.dmilajevs
Snippets for backend configuration.
Greedy and lazy BaseBackend
lazy group backend similar to existing config backend
Creole test for groups formatter
Beta/RC releases
- Beta (api):
- Beta (backends):
- RC: ~ 1st July
- Final: midterm
Betatesting (TODO)
Put simply: Betatesters, we need you!
Diary
My university timetable. It includes lectures and exams.
|
|
|
|
Discussion
Add your thoughts, concerns and use-cases here.