• Remember Mailing List

Re: Use content types for groups ?

from Rob Miller on Feb 27, 2008 06:39 PM
Yoan Le Clanche wrote:
> Hi everyone,
> 
> Is it possible to create a new content type to manage groups with remember?

yup.

> I know membrane can do it, but remember seems to overwrite this functionnality. So what can i do to use my own content type?

membrane provides the toolkit to use content objects as groups, but as you say 
the default remember implementation doesn't take advantage of it.  here's a 
rough outline of what you'd need to do:

- decide what defines the relationship btn a member and a group (e.g. they 
could be linked via AT or plone.relations references, or possibly the member 
object could simply store a list of group ids, and the group store a list of 
member ids).  whatever you decide has to be bidirectional... i.e. both the 
member and the group objects must be aware of the relationship

- provide custom member type, subclassing remember's base type with the 
following customizations:

   o groups field: this may become a ReferenceField if you use AT references 
or plone.relations to relate the groups to the members.

   o setGroup / getGroup methods: the groups field may need custom accessor 
and/or mutator methods based on how you manage the group <-> member relationships.

   o valid_groups method: this method provides the set of all available 
groups, it may need to be customized to correctly generate this list.

your group class needs to provide membrane's IGroup interface.  if you want to 
use one of membrane's default implementations for managing group <-> member 
relationships (using AT references) then you may need to provide another 
interface, e.g. IGroupsProvider or ISelectedGroupsProvider.

also, i can't say for certain how well the regular Plone group management 
interface will work.  if you want to retain that interface but have it 
interact w/ your content-based groups you may need to customize some of that 
code as well.

hope this helps,

-r
Return to date view: threaded or flat