Changeset 4074


Ignore:
Timestamp:
24 Apr 2009, 11:21:49 (16 years ago)
Author:
uli
Message:

Enable local authentication on app setups.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/app.py

    r4039 r4074  
    11import grok
    22import re
     3from zope.app.authentication.authentication import PluggableAuthentication
     4from zope.app.security.interfaces import IAuthentication
    35from zope.component import getUtility, getMultiAdapter
    46from zope.interface import Interface
     
    79                              IFacultyContainer)
    810from waeup.viewlets import MainArea, LeftSidebar, Index, Manage, FormWrapMixin
     11from waeup.authentication import setup_authentication
    912
    1013class University(grok.Application, grok.Container):
     
    1215    """
    1316    grok.implements(IUniversity)
     17    # Setup authentication for this app. Note: this is only
     18    # initialized, when a new instance of this app is created.
     19    grok.local_utility(
     20        PluggableAuthentication, provides = IAuthentication,
     21        setup = setup_authentication)
    1422
    1523    def __init__(self, name=u'Sample University', **kw):
     
    4048
    4149    form_fields = grok.AutoFields(IUniversity)
     50    grok.require('waeup.manageUniversity')
    4251
    4352    @grok.action('Save')
     
    5766        return
    5867
    59 class ManageUniversity(FormWrapMixin, grok.Viewlet):
     68class ManageUniversity(Manage):
     69    grok.name('manage')
     70    grok.context(IUniversity)
     71    grok.require('waeup.manageUniversity')
     72
     73    def render(self, *args, **kw):
     74        return super(ManageUniversity, self).render(*args, **kw)
     75   
     76class ManageUniversityMain(FormWrapMixin, grok.Viewlet):
    6077    """A viewlet that renders the `ManageForm`.
    6178    """
Note: See TracChangeset for help on using the changeset viewer.