Can anybody please provide a simple example of a working usersource
written in python?

I've written this, but it just does not work, all that happens is that
it writes opened to /tmp/source.log

class USER:
    "Just a little test"
    name    = None
    roles   = [ 'Anonymous' , 'member' ]
    domains = []

    def __init__(self, name):
        self.name = name

class SolidUserSource(BasicUserSource):

    """ Solid User Source """

    __plugin_kind__ = "User Source"
    meta_type       = "Solid User Source"
    f = open("/tmp/source.log",'a',0)
    f.write("opened\n")
    
    #def __init__(id,title):
    #    self.f.write("init %s %s\n" % (id,title))
    #    self.id = id
    #    self.title = title
        
    def existsUser(self, name):
        self.f.write('Users exists %s\n' % name)
        return 1

    def retreiveItem(self, name):

        self.f.write('Creating object for %s\n' % name)
        return USER(name)

    def rolesForUser(self, user):
        self.f.write('Returning roles for %s\n' % user.name)
        return user.roles

    def domainsForUser(self, user):
        self.f.write('Returning domains for %s\n' % user.name)
        return user.domains

    def authenticateUser(self, user, password, request):
        self.f.write('Authenticates user %s\n' % user.name)
        if user.name == 'aaa' and password == 'aaa':
            return 1 == 1
        return 1 == 0


-- 
 - Terje
[EMAIL PROTECTED]

_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to