Example #1
0
    def testRepositionRecursiveGroupsPlugin(self):
        # Ensure that the recursive groups plugin is moved to the bottom
        # of the IGroups plugins list, if active.
        addRecursiveGroupsPlugin(self.portal)
        # Plugin is installed, but not active, run against this state.
        from Products.PluggableAuthService.interfaces.plugins import \
            IGroupsPlugin
        acl = getToolByName(self.portal, 'acl_users')
        plugins = acl.plugins
        # The plugin was originally moved to the top of the list of
        # IGroupsPlugin plugins by p.a.controlpanel. Recreate that state.
        while (plugins.getAllPlugins('IGroupsPlugin')['active'].index(
                'recursive_groups') > 0):
            plugins.movePluginsUp(IGroupsPlugin, ['recursive_groups'])

        active_groups = plugins.getAllPlugins('IGroupsPlugin')['active']
        self.assertEqual(active_groups[0], 'recursive_groups')

        # Rerun the migration, making sure that it's now the last item in the
        # list of IGroupsPlugin plugins.
        repositionRecursiveGroupsPlugin(self.portal)
        active_groups = plugins.getAllPlugins('IGroupsPlugin')['active']
        self.assertEqual(active_groups[-1], 'recursive_groups')
Example #2
0
    def testRepositionRecursiveGroupsPlugin(self):
        # Ensure that the recursive groups plugin is moved to the bottom
        # of the IGroups plugins list, if active.
        addRecursiveGroupsPlugin(self.portal)
        # Plugin is installed, but not active, run against this state.
        from Products.PluggableAuthService.interfaces.plugins import \
            IGroupsPlugin
        acl = getToolByName(self.portal, 'acl_users')
        plugins = acl.plugins
        # The plugin was originally moved to the top of the list of
        # IGroupsPlugin plugins by p.a.controlpanel. Recreate that state.
        while (plugins.getAllPlugins('IGroupsPlugin')['active'].index(
               'recursive_groups') > 0):
            plugins.movePluginsUp(IGroupsPlugin, ['recursive_groups'])

        active_groups = plugins.getAllPlugins('IGroupsPlugin')['active']
        self.assertEqual(active_groups[0], 'recursive_groups')

        # Rerun the migration, making sure that it's now the last item in the
        # list of IGroupsPlugin plugins.
        repositionRecursiveGroupsPlugin(self.portal)
        active_groups = plugins.getAllPlugins('IGroupsPlugin')['active']
        self.assertEqual(active_groups[-1], 'recursive_groups')