1 # Copyright (c) 2008 by Florian Friesdorf
3 # GNU Affero General Public License (AGPL)
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License as
7 # published by the Free Software Foundation; either version 3 of the
8 # License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU Affero General Public License for more details.
15 # You should have received a copy of the GNU Affero General Public
16 # License along with this program. If not, see
17 # <http://www.gnu.org/licenses/>.
20 __author__
= "Florian Friesdorf <flo@chaoflow.net>"
21 __docformat__
= "plaintext"
23 from persistent
import Persistent
25 from zope
.app
.container
.contained
import Contained
26 from zope
.component
.factory
import Factory
27 from zope
.interface
import implements
29 from paula
.examples
.interfaces
import IBasicUser
30 from paula
.examples
.interfaces
import IMinimalPloneUser
31 from paula
.examples
.interfaces
import IMinimalPloneProperties
33 from paula
.examples
.interfaces
import IBasicGroup
35 from paula
.authutil
.interfaces
import IAuthProviderAdaptable
36 from paula
.proputil
.interfaces
import IPropertyProviderAdaptable
37 from paula
.grouputil
.interfaces
import IMembershipProviderAdaptable
40 class BasicUser(Persistent
, Contained
):
44 >>> password = u'password'
48 ... password=password,
52 >>> b.password == password
57 IAuthProviderAdaptable
,
63 def __init__(self
, title
=None, password
=None):
65 self
.password
= password
68 class MinimalPloneUser(BasicUser
):
69 """User content with minimal properties for plone
72 >>> password = u'password'
73 >>> realname = u'realname'
76 >>> b = MinimalPloneUser(
78 ... password=password,
79 ... realname=realname,
82 >>> b.realname == realname
87 # it is important to explicitly provide IMinimalPloneProperties
88 # at least for our BasicPropertyProvider adapter
91 IMinimalPloneProperties
,
92 IPropertyProviderAdaptable
,
109 self
.realname
= realname
112 minimalPloneUserFactory
= Factory(
114 title
=u
"Create a minimal plone user",
115 description
=u
"This factory instantiates new minimal plone users",
119 class BasicGroup(Persistent
, Contained
):
124 IMembershipProviderAdaptable
,
131 basicGroupFactory
= Factory(
133 title
=u
"Create a basic group",
134 description
=u
"This factory instantiates new basic groups",