<> = 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 == 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. {{{#!python from wikiconfig import LocalConfig from MoinMoin.datastruct import WikiGroups class Config(LocalConfig): def groups(self, request): 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 {{{#!python from wikiconfig import LocalConfig from MoinMoin.datastruct import ConfigGroups class Config(LocalConfig): def groups(self, request): groups = {u'EditorGroup': [u'AdminGroup', u'John', u'JoeDoe', u'Editor1'], u'AdminGroup': [u'Admin1', u'Admin2', u'John']} 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: {{{#!python from wikiconfig import LocalConfig from MoinMoin.datastruct import ConfigGroups, WikiGroups, CompositeGroups class Config(LocalConfig): def groups(self, request): 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)) }}} ==== 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 an`AdminGroup` 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 [[attachment:ldap_group2.patch]] * Here is a patch on 1.9 that implements it and merge with ldap_login [[attachment: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: {{{#!python from wikiconfig import LocalConfig from MoinMoin.datastruct.backends.ldap_groups import LdapGroups from MoinMoin.util.ldap_connection import LDAPConnection class Config(LocalConfig): def groups(self, request): l = LDAPConnection( server_uri='ldap://localhost', bind_dn='cn=admin,dc=domain,dc=net', bind_pw='xxx') return LdapGroups( request, l, base_dn='dc=domain,dc=net') }}} ==== SQLGroupBackend (TODO) ==== The SQLGroupBackend gets data from the RDBMS. [[http://www.sqlalchemy.org/|SQLAlchemy]] can help making this portable over a range of sql dbms. * http://dev.pocoo.org/projects/zine/browser/zine/models.py 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 <> ==== 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 is a dict name || ||`__contains__(self, dict_name)` ||Check if a dict called 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. {{{#!python from wikiconfig import LocalConfig from MoinMoin.datastruct import WikiDicts class Config(LocalConfig): def dict_manager_init(self, request): return WikiDicts(request) }}} ==== config_dicts backend ==== In a similar way to config_groups, dicts may be defined in a configuration file. {{{#!python from wikiconfig import LocalConfig from MoinMoin.datastruct import ConfigDicts class Config(LocalConfig): def dict_manager_init(self, request): dicts = {u'OneDict': {u'first_key': u'first item', u'second_key': u'second item'}, u'NumbersDict': {u'1': 'One', u'2': 'Two'}} return ConfigDicts(request, dicts) }}} ==== composite_dicts backend ==== Using the composite_dicts backend it is possible get dict definitions from several backends. {{{#!python from wikiconfig import LocalConfig from MoinMoin.datastruct import WikiDicts, ConfigDicts, CompositeDicts class Config(LocalConfig): def dict_manager_init(self, request): dicts = {u'OneDict': {u'first_key': u'first item', u'second_key': u'second item'}, u'NumbersDict': {u'1': 'One', u'2': 'Two'}} return CompositeDicts(request, ConfigDicts(request, dicts), WikiDicts(request)) }}} == Plan == === Activity log === * /FirstWeekActivity * /SecondThirdWeekActivity * /ForthWeekActivity * /SixthWeekActivity * /SeventhWeekActivity === Current plan === * Review [[http://master19.moinmo.in/HelpOnGroups|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 [[https://aws.unibz.it/students-zone/itt/export/exportitt.aspx?showtype=0&sfdid=Aj1iyF0DEjSwRAcNSoKFuA==&format=atom|university timetable]]. It includes lectures and exams. ||<>||<>||<>||<>|| == Discussion == Add your thoughts, concerns and use-cases here. ---- CategoryGoogleSummerOfCode2009 CategoryGsocProject