[BlueBream] Tutorial part of authentication

Baiju M baiju.m.mail at gmail.com
Fri May 7 09:57:38 EDT 2010

Hi All,
         I am working on the official tutorial according to our plan [1]
In the tutorial, we are developing an issue tracker application
called "ticket collector" [2]  You can see the code in bzr repository [3].
The 3rd part which will cover "Security". Please look at 7th stage
code in bzr [4]

I am calling this function just after creating the main container
for ticket collector. I avoided the event handler as it is not
introduced in the previous parts of tutorial.
Based on this code, I am going to write the text.
I am looking for your suggestions.  Please review
the code also.

def setup_site_manager(context):
    sm = context.getSiteManager()
    pau = PluggableAuthentication(prefix='tc.pau.')
    sm[u'authentication'] = pau
    sm.registerUtility(pau, IAuthentication)

    client_id_manager = CookieClientIdManager()
    sm[u'CookieClientIdManager'] = client_id_manager
    sm.registerUtility(client_id_manager, ICookieClientIdManager)

    principals = PrincipalFolder(prefix='pf.')
    pau[u'pf'] = principals
    pau.authenticatorPlugins += (u"pf", )

    pau.credentialsPlugins += (u'Session Credentials',)

    p1 = InternalPrincipal('admin1', 'admin1', "Admin 1",
                           passwordManagerName="Plain Text")
    principals['p1'] = p1

    role_manager = IPrincipalRoleManager(context)
    login_name = principals.getIdByLogin(p1.login)
    pid = unicode('tc.pau.' + login_name)
    role_manager.assignRoleToPrincipal('zope.Manager', pid)

[1] http://wiki.zope.org/bluebream/OrganizationOfDocumentation
[2] http://wiki.zope.org/bluebream/ExampleApplication
[3] http://bazaar.launchpad.net/~baijum/bluebream/ticketcollector
[4] http://bazaar.launchpad.net/%7Ebaijum/bluebream/ticketcollector/files/head%3A/stage7/

Baiju M

More information about the bluebream mailing list