class Meeting(grok.Container, grok.Site): """the meeting itself """ implements(IMeeting, IRegistrable) name = description = headline = address = None start_date = end_date = None grok.local_utility(PluggableAuthentication, provides=IAuthentication, setup=setup_authentication) grok.local_utility(SeanceContainer, public=True, provides=ISeanceContainer, name_in_container='seances') grok.local_utility(PeopleContainer, public=True, provides=IPeopleContainer, name_in_container='people') grok.local_utility(Durations, public=True, provides=IDurations, name_in_container='durations') grok.local_utility(Rooms, public=True, provides=IRooms, name_in_container='rooms')
class AdHocApp(grok.Application, grok.Container): grok.implements(IAdHocApplication) grok.local_utility(AdHocAuthenticator, name=u"principals", provides=IAuthenticatorPlugin) grok.local_utility(PluggableAuthentication, IAuthentication, public=True, setup=setup_pau) grok.local_utility(intid_factory, IAdHocIdReference, public=True) def __init__(self): super(AdHocApp, self).__init__() self['dokumente'] = Dokumente() def getSiteManager(self): current = super(AdHocApp, self).getSiteManager() #import pdb; pdb.set_trace() #return adhocRegistry if adhocRegistry not in current.__bases__: adhocRegistry.__bases__ = tuple([x for x in adhocRegistry.__bases__ if x.__hash__() != zope.component.globalSiteManager.__hash__()]) current.__bases__ = (adhocRegistry,) + current.__bases__ else: if current.__bases__.index(adhocRegistry) == 1: current.__bases__ = current.__bases__[::-1] return current
class Uvcsite(grok.Application, grok.Container): """Application Object for uvc.site """ grok.traversable('plugins') grok.local_utility(PortalMembership, provides=IHomeFolderManager) grok.local_utility(UVCAuthenticator, name=u"principals", provides=IAuthenticatorPlugin) grok.local_utility(PluggableAuthentication, IAuthentication, public=True, setup=setup_pau) @property def plugins(self): return uvcsite.plugins.PluginsPanel('plugins', self) def getSiteManager(self): current = super(Uvcsite, self).getSiteManager() if uvcsiteRegistry not in current.__bases__: uvcsiteRegistry.__bases__ = tuple( [x for x in uvcsiteRegistry.__bases__ if (hasattr(x, '_hash_') and x._hash_() != globalSiteManager._hash_())]) current.__bases__ = (uvcsiteRegistry,) + current.__bases__ elif current.__bases__[0] is not uvcsiteRegistry: current.__bases__ = (uvcsiteRegistry,) + tuple(( b for b in current.__bases__ if b != uvcsiteRegistry)) return current
class Foo(grok.Model, grok.Site): grok.local_utility(Anything, hide=False, name_in_container='foo', persistent=None) grok.local_adapter() grok.local_view()
class App(grok.Application, grok.Container): grok.local_utility(Database, provides=IDatabase, public=True, name_in_container='database') grok.implements(IForm) engine_name = ''
class PlainLoginDemo(grok.Application, grok.Container): """ An app that lets users create accounts, login, logout and change their passwords. """ # register the authentication utility; see setup_pau for settings grok.local_utility(PluggableAuthentication, IAuthentication, setup=setup_pau)
class Controlturnos(grok.Application, grok.Container): grok.local_utility(PluggableAuthentication, provides=IAuthentication, setup=instalar_autentificacion) grok.local_utility(PluginAuthenticacion, provides=IAuthenticatorPlugin, name='autenticacion') def __init__(self): super(Controlturnos, self).__init__() self['usuarios'] = Usuarios() self.titulo = "Control de Turnos" self["seccion"] = ContenedorSecciones() self["empleado"] = Empleado() self["ticket"] = ContenedorTickets() def app(self): return self
class Cave(grok.Model, grok.Site): grok.local_utility(Fireplace) grok.local_utility(Club) grok.local_utility(SpikyClub, provides=IClub, name='spiky') grok.local_utility(Mammoth, provides=IMammoth) grok.local_utility(SabretoothTiger, name='tiger') grok.local_utility(CavePainting, name='blackandwhite', provides=IPainting) grok.local_utility(ColoredCavePainting, name='color')
class BabyLoginDemo(grok.Application, grok.Container): """ An app that lets users create accounts, login, logout and change their passwords. """ grok.local_utility(MemberAuthentication, IAuthentication) def __init__(self): super(BabyLoginDemo,self).__init__() self['members'] = grok.Container()
class Uvcsite(grok.Application, grok.Container): grok.traversable('plugins') grok.local_utility(zope.pluggableauth.PluggableAuthentication, zope.authentication.interfaces.IAuthentication, public=True, setup=setup_pau) @property def plugins(self): return uvcsite.plugins.panel.PluginsPanel('plugins', self)
class WebSite(grok.Application, grok.Container): """Mars/Grok/Z3C demo website """ zope.interface.implements(interfaces.IWebSite) grok.local_utility(IntIds, IIntIds) # needed for the catalog grok.local_utility(Catalog, ICatalog, setup=setup_catalog, name_in_container='wcatalog') grok.local_utility(SimpleAuthentication, IAuthentication, setup=authentication.setup_site_auth, name_in_container='auth') grok.local_utility( CookieCredentialSessionDataContainer, ISessionDataContainer, setup=authentication.setup_cookie_session_container, name_in_container='CookieCredentialSessionDataContainer', name=SESSION_KEY) grok.local_utility(CookieClientIdManager, IClientIdManager, setup=authentication.setup_cookie_client_manager, name_in_container='LifeTimeSessionClientIdManager', name='LifeTimeSessionClientIdManager') title = FieldProperty(interfaces.IWebSite['title']) description = FieldProperty(interfaces.IWebSite['description']) def __init__(self, title=u'', description=u''): super(WebSite, self).__init__() self.title = title self.description = description def __repr__(self): return '<%s %r>' % (self.__class__.__name__, self.__name__) def traverse(self, name): if name == 'members': return members.Members(self)
class MyAuthApp(grok.Application, grok.Container): def setup_pau(PAU): PAU.authenticatorPlugins = ("auth.bearer", ) PAU.credentialsPlugins = ( "creds.bearer", "Zope Realm Basic-Auth", "No Challenge if Authenticated", ) grok.local_utility(PluggableAuthentication, IAuthentication, public=True, setup=setup_pau)
class UKHAdHocApp(grok.Application, grok.Container): grok.implements(IUKHAdHocApp) grok.local_utility(PluggableAuthentication, IAuthentication, public=True, setup=setup_pau) grok.local_utility(UserAuthenticatorPlugin, provides=IAuthenticatorPlugin, name="users") def getSiteManager(self): current = super(UKHAdHocApp, self).getSiteManager() if adhocRegistry not in current.__bases__: adhocRegistry.__bases__ = tuple([ x for x in adhocRegistry.__bases__ if x.__hash__() != zope.component.globalSiteManager.__hash__() ]) current.__bases__ = (adhocRegistry, ) + current.__bases__ else: if current.__bases__.index(adhocRegistry) == 1: current.__bases__ = current.__bases__[::-1] return current
class Foo2(Foo): grok.local_utility(SpecialAnything)
class Cave(grok.Model, grok.Site): grok.local_utility(Fireplace, public=True, name_in_container='fireplace')
class Cave2(grok.Container, grok.Site): grok.local_utility(Fireplace, public=False, name_in_container='fireplace')
class Cave(grok.Model, grok.Site): grok.local_utility(Fireplace, provides=IFireplace) grok.local_utility(Fireplace2, provides=IFireplace)
class AfpyBarcamp(grok.Application, grok.Container): """The main application container """ grok.local_utility(PluggableAuthentication, provides=IAuthentication, setup=setup_toplevel_authentication)
class Cave(grok.Model, grok.Site): grok.local_utility(Fireplace)
class VeryHollowCave(HollowCave): grok.local_utility(Painting, name='great') grok.local_utility(Painting, name='bad')
class HollowCave(Cave): grok.local_utility(Painting)
class Cave(grok.Model, grok.Site): grok.local_utility(Club)
class Herd(BaseHerd): grok.local_utility(Catalog, provides=ICatalog, setup=setup_catalog)
class Cave(grok.Model, grok.Site): grok.local_utility(Fireplace, name='Foo') grok.local_utility(Fireplace2, name='Foo')
class SpikyCave(Cave): grok.local_utility(SpikyClub)
class BaseHerd(grok.Container, grok.Site): grok.local_utility(IntIds, provides=IIntIds)
class Cave(grok.Model, grok.Site): # we use name_in_container here to prevent multiple registrations # since storing the utilities multiple times under the same name # would raise a DuplicationError grok.local_utility(Fireplace, name_in_container='fireplace')
class Zoo(grok.Site, grok.Container): grok.local_utility(IntIds, provides=IIntIds) grok.local_utility(Catalog, provides=ICatalog, setup=setup_catalog)
class LDAPApp(grok.Application, grok.Container): "Root application object for the gum app" implements(ILDAPUserGroupLocation, ICookieConfiguration) ldap_admin_group = u'' ldap_sysadmin_group = u'' ldap_view_group = u'' cookie_name = u'gum' shared_secret = u'' enable_mod_auth_tkt = False login_url = u'' # GUM does it's Authentication againast LDAP # using the Pluggable Authentication Utility (PAU) # PAU works by requiring a set of: # * credentials plugins for determining how to extract the creds # (username/password) # * authenitcation plugins for determining if the creds are valid # we are just going to use a single cookie creds plugin and a # ldap auth plugin grok.local_utility( zope.pluggableauth.authentication.PluggableAuthentication, provides=IAuthentication, ) grok.local_utility(ldappas.authentication.LDAPAuthentication, provides=IAuthenticatorPlugin, name='ldap-authenticator') grok.local_utility(CookieCredentialsPlugin, provides=ICredentialsPlugin, name='gum-creds') grok.local_utility(TKTCookieCredentialsPlugin, provides=ICredentialsPlugin, name='mod_auth_tkt') grok.local_utility(TKTAuthenticatorPlugin, provides=IAuthenticatorPlugin, name='tkt-auth') # The 'gumldapda' is a named utility that acts as a database adapter # in Zope 3 a connection to ldap is treated like a connection to # any other database, e.g. a relation database adatper for example grok.local_utility(ManageableLDAPAdapter, provides=IManageableLDAPAdapter, name='gumldapda') # Utilities to catalog the transcripts grok.local_utility(IntIds, provides=IIntIds) grok.local_utility(Catalog, provides=ICatalog, name='gum_catalog', setup=setup_catalog) def __init__(self): super(LDAPApp, self).__init__() self.title = 'Home' # for navigation self['groups'] = Groups() self['groups'].title = 'Groups' self['users'] = Users() self['users'].title = 'Users' self['transcripts'] = Transcripts() self['transcripts'].title = 'Transcripts' self['orgs'] = Organizations() self['orgs'].title = 'Organizations' self['smart'] = SmartSearches() self['smart'].title = 'Smart Searches' self['extensions'] = Extensions() self['extensions'].title = 'Extensions' def ldap_connection(self): "LDAP connection" return zope.component.queryUtility(IManageableLDAPAdapter, 'gumldapda').connect() # GUM LDAP settings, these are pulled from the configured # LDAP adapter and LDAP authenticator objects in PAU @property def ldap_host(self): return zope.component.queryUtility(IManageableLDAPAdapter, 'gumldapda').host @property def ldap_port(self): return zope.component.queryUtility(IManageableLDAPAdapter, 'gumldapda').port @property def ldap_login(self): return zope.component.queryUtility(IManageableLDAPAdapter, 'gumldapda').bindDN @property def ldap_password(self): return zope.component.queryUtility(IManageableLDAPAdapter, 'gumldapda').bindPassword @property def ldap_user_search_base(self): return zope.component.queryUtility(IAuthenticatorPlugin, 'ldap-authenticator').searchBase @property def ldap_group_search_base(self): return zope.component.queryUtility( IAuthenticatorPlugin, 'ldap-authenticator').groupsSearchBase