[Cubicweb] Correct use of the 'person' cube

Sylvain Thénault sylvain.thenault at logilab.fr
Wed Jul 11 11:56:29 CEST 2012


On 11 juillet 10:57, Aurélien Campéas wrote:
> Le 11/07/2012 08:42, Stéphane Bugat a écrit :
> >Dear all,
> >
> >I want to use the 'person' cube so that each CWUser belonging to the 'users' group has a Person instance defined. For that I have decided to create an inlined relation definition between CWUser and Person (with a '11' cardinality).
> >However, there are common attributes between both entities (first name, email, and so on).
> >
> >Just to make sure there is no other and simpler approach to deal with it:
> >A solution is to define a hook for the creation of each CWUser that automatically creates the corresponding Person and predefines its attributes with the corresponding values of the CWUser attributes (using a 'after_add_entity' event).
> >
> >Is this correct?
> 
> Correct.

Though you'll need more burden to keep them in sync. For your information,
we've been wishing to split current CWUser into CWAccount + Person or similar
for a while now, but never found the time to do so.

-- 
Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse (09.54.03.55.76)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org



More information about the Cubicweb mailing list