Exemplo n.º 1
0
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')
Exemplo n.º 2
0
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
Exemplo n.º 3
0
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
Exemplo n.º 4
0
class Foo(grok.Model, grok.Site):
    grok.local_utility(Anything,
                       hide=False,
                       name_in_container='foo',
                       persistent=None)
    grok.local_adapter()
    grok.local_view()
Exemplo n.º 5
0
class App(grok.Application, grok.Container):
    grok.local_utility(Database,
                       provides=IDatabase,
                       public=True,
                       name_in_container='database')

    grok.implements(IForm)

    engine_name = ''
Exemplo n.º 6
0
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)
Exemplo n.º 7
0
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
Exemplo n.º 8
0
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')
Exemplo n.º 9
0
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()
Exemplo n.º 10
0
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)
Exemplo n.º 11
0
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)
Exemplo n.º 12
0
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)
Exemplo n.º 13
0
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
Exemplo n.º 14
0
class Foo2(Foo):
    grok.local_utility(SpecialAnything)
Exemplo n.º 15
0
class Cave(grok.Model, grok.Site):
    grok.local_utility(Fireplace, public=True, name_in_container='fireplace')
Exemplo n.º 16
0
class Cave2(grok.Container, grok.Site):
    grok.local_utility(Fireplace, public=False, name_in_container='fireplace')
Exemplo n.º 17
0
class Cave(grok.Model, grok.Site):
    grok.local_utility(Fireplace, provides=IFireplace)
    grok.local_utility(Fireplace2, provides=IFireplace)
Exemplo n.º 18
0
class AfpyBarcamp(grok.Application, grok.Container):
    """The main application container
    """
    grok.local_utility(PluggableAuthentication,
                       provides=IAuthentication,
                       setup=setup_toplevel_authentication)
Exemplo n.º 19
0
class Cave(grok.Model, grok.Site):
    grok.local_utility(Fireplace)
Exemplo n.º 20
0
class VeryHollowCave(HollowCave):
    grok.local_utility(Painting, name='great')
    grok.local_utility(Painting, name='bad')
Exemplo n.º 21
0
class HollowCave(Cave):
    grok.local_utility(Painting)
Exemplo n.º 22
0
class Cave(grok.Model, grok.Site):
    grok.local_utility(Club)
Exemplo n.º 23
0
class Herd(BaseHerd):
    grok.local_utility(Catalog, provides=ICatalog, setup=setup_catalog)
Exemplo n.º 24
0
class Cave(grok.Model, grok.Site):
    grok.local_utility(Fireplace, name='Foo')
    grok.local_utility(Fireplace2, name='Foo')
Exemplo n.º 25
0
class SpikyCave(Cave):
    grok.local_utility(SpikyClub)
Exemplo n.º 26
0
class BaseHerd(grok.Container, grok.Site):
    grok.local_utility(IntIds, provides=IIntIds)
Exemplo n.º 27
0
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')
Exemplo n.º 28
0
class Zoo(grok.Site, grok.Container):
    grok.local_utility(IntIds, provides=IIntIds)
    grok.local_utility(Catalog, provides=ICatalog, setup=setup_catalog)
Exemplo n.º 29
0
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