예제 #1
0
    def testSetUp(self):
        self.setUpProducts()
        provideUtility(self["app"], provides=ISiteRoot)
        provideUtility(self["app"], provides=ISiteRoot)

        # Layer is not a plone site, registry of some utilities is required
        provideUtility(Registry(), provides=IRegistry)
        provideUtility(cacheProviderFactory(), provides=ICacheProviderFactory)
        provideUtility(CacheSettingsRecordProvider(),
                       provides=ICacheSettingsRecordProvider)
        migrate_root_uf(self["app"])
        registerPluginTypes(self["app"].acl_users)
예제 #2
0
    def testSetUp(self):
        self.setUpProducts()
        provideUtility(self["app"], provides=ISiteRoot)
        provideUtility(self["app"], provides=ISiteRoot)

        # Layer is not a plone site, registry of some utilities is required
        provideUtility(Registry(), provides=IRegistry)
        provideUtility(cacheProviderFactory(), provides=ICacheProviderFactory)
        provideUtility(
            CacheSettingsRecordProvider(), provides=ICacheSettingsRecordProvider
        )
        migrate_root_uf(self["app"])
        registerPluginTypes(self["app"].acl_users)
예제 #3
0
def install_acl_users(app, event):
    logger = event.commit
    uf = app.acl_users
    found = uf.objectIds(['Plone Session Plugin'])
    if not found:
        # new root acl user implementation not installed yet
        migrate_root_uf(app)
        uf = app.acl_users  # need to get new acl_users

        plone_pas = uf.manage_addProduct['PlonePAS']
        manage_addSessionPlugin(plone_pas, 'session')
        activatePluginInterfaces(app, "session")

        cookie_auth = uf.credentials_cookie_auth
        cookie_auth.login_path = u'/@@secure-login'

        uf.plugins.activatePlugin(
            IChallengePlugin,
            'credentials_cookie_auth'
        )

        # also delete basic auth
        uf.manage_delObjects(['credentials_basic_auth'])

        # for some reason, we need to install the initial user...
        if not api.env.test_mode():
            try:
                uf.users.manage_addUser('admin', 'admin', 'admin', 'admin')
                uf.roles.assignRoleToPrincipal('Manager', 'admin')
            except KeyError:
                pass  # already a user

        if logger is not None:
            logger('Updated acl users')

    km = getattr(app, 'key_manager', None)
    if km is None:
        km = KeyManager()
        app.key_manager = km
        app._p_changed = 1
        if logger is not None:
            logger('adding key manager')

    sm = getGlobalSiteManager()
    sm.registerUtility(km, IKeyManager)
예제 #4
0
 def testSetUp(self):
     self.setUpProducts()
     provideUtility(self['app'], provides=ISiteRoot)
     migrate_root_uf(self['app'])
 def testSetUp(self):
     self.setUpProducts()
     provideUtility(self['app'], provides=ISiteRoot)
     migrate_root_uf(self['app'])
예제 #6
0
 def testSetUp(self):
     self.setUpProducts()
     provideUtility(self['app'], provides=ISiteRoot)
     migrate_root_uf(self['app'])
     registerPluginTypes(self['app'].acl_users)