from AccessControl import ClassSecurityInfo
from zope.interface import implements

from zope.interface import implements

from Products.Archetypes.public import *
from Products.TeamSpace.config import PKG_NAME

from Products.membrane.interfaces import IUserAuthProvider
from Products.membrane.interfaces import IUserAuthentication
from Products.membrane.interfaces import IUserRoles
from Products.membrane.interfaces import IPropertiesProvider
from Products.membrane.interfaces import IGroupsProvider
from Products.membrane.interfaces import IGroupAwareRolesProvider

memberschema = BaseSchema.copy() + Schema((
    StringField('fullname',
                languageIndependent = 1,
                widget = StringWidget(description = "Enter the name.")
               ),
    StringField('email',
                languageIndependent = 1,
                widget = StringWidget(description = "Enter the email.")
               ),
    ))


class Member(BaseContent):
    """A simple member archetype"""

    implements(IUserAuthProvider, IUserAuthentication, IUserRoles,
               IPropertiesProvider, IGroupsProvider,
               IGroupAwareRolesProvider)

    portal_type=archetype_name='Member'
    schema = memberschema

    security = ClassSecurityInfo()

    def getUserId(self):
        return self.getId()

    def getUserName(self):
        return self.getId()

    def verifyCredentials(self, credentials):
        return True

    def getRoles(self):
        return ['Member']


registerType(Member, PKG_NAME)
