Beispiel #1
0
def addRecursiveGroupsPlugin(context):
    """Add a recursive groups plugin to acl_users"""
    from Products.PluggableAuthService.plugins.RecursiveGroupsPlugin import addRecursiveGroupsPlugin, IRecursiveGroupsPlugin
    from Products.PluggableAuthService.interfaces.plugins import IGroupsPlugin
    acl = getToolByName(context, 'acl_users')
    plugins = acl.plugins

    existingPlugins = plugins.listPlugins(IGroupsPlugin)
    if existingPlugins:
        for p, id in existingPlugins:
            if IRecursiveGroupsPlugin.providedBy(p):
                plugins.deactivatePlugin(IGroupsPlugin, id)
                logger.warn('Found an existing Recursive Groups plugin, %s, in acl_users, deactivating.' % id)

    if not 'recursive_groups' in acl:
        addRecursiveGroupsPlugin(acl, 'recursive_groups', "Recursive Groups Plugin")
Beispiel #2
0
def addRecursiveGroupsPlugin(context):
    """Add a recursive groups plugin to acl_users"""
    from Products.PluggableAuthService.plugins.RecursiveGroupsPlugin import addRecursiveGroupsPlugin, IRecursiveGroupsPlugin
    from Products.PluggableAuthService.interfaces.plugins import IGroupsPlugin
    acl = getToolByName(context, 'acl_users')
    plugins = acl.plugins

    existingPlugins = plugins.listPlugins(IGroupsPlugin)
    if existingPlugins:
        for p, id in existingPlugins:
            if IRecursiveGroupsPlugin.providedBy(p):
                plugins.deactivatePlugin(IGroupsPlugin, id)
                logger.warn('Found an existing Recursive Groups plugin, %s, in acl_users, deactivating.' % id)

    if not 'recursive_groups' in acl:
        addRecursiveGroupsPlugin(acl, 'recursive_groups', "Recursive Groups Plugin")
Beispiel #3
0
def setupPlugins(portal):
    uf = portal.acl_users
    logger.debug("\nPlugin setup")

    pas = uf.manage_addProduct['PluggableAuthService']
    plone_pas = uf.manage_addProduct['PlonePAS']

    setupAuthPlugins(portal, pas, plone_pas)

    found = uf.objectIds(['User Manager'])
    if not found:
        plone_pas.manage_addUserManager('source_users')
        logger.debug("Added User Manager.")
    activatePluginInterfaces(portal, 'source_users')

    found = uf.objectIds(['Group Aware Role Manager'])
    if not found:
        plone_pas.manage_addGroupAwareRoleManager('portal_role_manager')
        logger.debug("Added Group Aware Role Manager.")
        activatePluginInterfaces(portal, 'portal_role_manager')

    found = uf.objectIds(['Local Roles Manager'])
    if not found:
        plone_pas.manage_addLocalRolesManager('local_roles')
        logger.debug("Added Group Aware Role Manager.")
        activatePluginInterfaces(portal, 'local_roles')

    found = uf.objectIds(['Group Manager'])
    if not found:
        plone_pas.manage_addGroupManager('source_groups')
        logger.debug("Added ZODB Group Manager.")
        activatePluginInterfaces(portal, 'source_groups')

    found = uf.objectIds(['Plone User Factory'])
    if not found:
        plone_pas.manage_addPloneUserFactory('user_factory')
        logger.debug("Added Plone User Factory.")
        activatePluginInterfaces(portal, "user_factory")

    found = uf.objectIds(['ZODB Mutable Property Provider'])
    if not found:
        plone_pas.manage_addZODBMutablePropertyProvider('mutable_properties')
        logger.debug("Added Mutable Property Manager.")
        activatePluginInterfaces(portal, "mutable_properties")

    found = uf.objectIds(['Automatic Group Plugin'])
    if not found:
        plone_pas.manage_addAutoGroup("auto_group",
                                      "Authenticated Users (Virtual Group)",
                                      "AuthenticatedUsers",
                                      "Automatic Group Provider")
        logger.debug("Added Automatic Group.")
        activatePluginInterfaces(portal, "auto_group")


# replace of emc.auth
    found = uf.objectIds(['Plone Session Plugin'])
    if not found:
        manage_addSessionPlugin(plone_pas, 'session')
        logger.debug("Added Plone Session Plugin.")
        activatePluginInterfaces(portal, "session")

    found = uf.objectIds(['Recursive Groups Plugin'])
    if not found:
        addRecursiveGroupsPlugin(plone_pas, 'recursive_groups',
                                 "Recursive Groups Plugin")
        activatePluginInterfaces(portal, 'recursive_groups')
        logger.debug("Added Recursive Groups plugin.")

    setupPasswordPolicyPlugin(portal)
def setupPlugins(portal):
    uf = portal.acl_users
    logger.debug("\nPlugin setup")

    pas = uf.manage_addProduct['PluggableAuthService']
    plone_pas = uf.manage_addProduct['PlonePAS']

    setupAuthPlugins(portal, pas, plone_pas)

    found = uf.objectIds(['User Manager'])
    if not found:
        plone_pas.manage_addUserManager('source_users')
        logger.debug("Added User Manager.")
    activatePluginInterfaces(portal, 'source_users')

    found = uf.objectIds(['Group Aware Role Manager'])
    if not found:
        plone_pas.manage_addGroupAwareRoleManager('portal_role_manager')
        logger.debug("Added Group Aware Role Manager.")
        activatePluginInterfaces(portal, 'portal_role_manager')

    found = uf.objectIds(['Local Roles Manager'])
    if not found:
        plone_pas.manage_addLocalRolesManager('local_roles')
        logger.debug("Added Group Aware Role Manager.")
        activatePluginInterfaces(portal, 'local_roles')

    found = uf.objectIds(['Group Manager'])
    if not found:
        plone_pas.manage_addGroupManager('source_groups')
        logger.debug("Added ZODB Group Manager.")
        activatePluginInterfaces(portal, 'source_groups')

    found = uf.objectIds(['Plone User Factory'])
    if not found:
        plone_pas.manage_addPloneUserFactory('user_factory')
        logger.debug("Added Plone User Factory.")
        activatePluginInterfaces(portal, "user_factory")

    found = uf.objectIds(['ZODB Mutable Property Provider'])
    if not found:
        plone_pas.manage_addZODBMutablePropertyProvider('mutable_properties')
        logger.debug("Added Mutable Property Manager.")
        activatePluginInterfaces(portal, "mutable_properties")

    found = uf.objectIds(['Automatic Group Plugin'])
    if not found:
        plone_pas.manage_addAutoGroup(
            "auto_group", "Authenticated Users (Virtual Group)",
            "AuthenticatedUsers", "Automatic Group Provider")
        logger.debug("Added Automatic Group.")
        activatePluginInterfaces(portal, "auto_group")

    found = uf.objectIds(['Plone Session Plugin'])
    if not found:
        manage_addSessionPlugin(plone_pas, 'session')
        logger.debug("Added Plone Session Plugin.")
        activatePluginInterfaces(portal, "session")

    found = uf.objectIds(['Recursive Groups Plugin'])
    if not found:
        addRecursiveGroupsPlugin(plone_pas, 'recursive_groups',
                                 "Recursive Groups Plugin")
        activatePluginInterfaces(portal, 'recursive_groups')
        logger.debug("Added Recursive Groups plugin.")

    setupPasswordPolicyPlugin(portal)
Beispiel #5
0
def setupPlugins(portal):
    uf = portal.acl_users
    logger.debug("\nPlugin setup")

    pas = uf.manage_addProduct["PluggableAuthService"]
    plone_pas = uf.manage_addProduct["PlonePAS"]

    setupAuthPlugins(portal, pas, plone_pas)

    found = uf.objectIds(["User Manager"])
    if not found:
        plone_pas.manage_addUserManager("source_users")
        logger.debug("Added User Manager.")
    activatePluginInterfaces(portal, "source_users")

    found = uf.objectIds(["Group Aware Role Manager"])
    if not found:
        plone_pas.manage_addGroupAwareRoleManager("portal_role_manager")
        logger.debug("Added Group Aware Role Manager.")
        activatePluginInterfaces(portal, "portal_role_manager")

    found = uf.objectIds(["Local Roles Manager"])
    if not found:
        plone_pas.manage_addLocalRolesManager("local_roles")
        logger.debug("Added Group Aware Role Manager.")
        activatePluginInterfaces(portal, "local_roles")

    found = uf.objectIds(["Group Manager"])
    if not found:
        plone_pas.manage_addGroupManager("source_groups")
        logger.debug("Added ZODB Group Manager.")
        activatePluginInterfaces(portal, "source_groups")

    found = uf.objectIds(["Plone User Factory"])
    if not found:
        plone_pas.manage_addPloneUserFactory("user_factory")
        logger.debug("Added Plone User Factory.")
        activatePluginInterfaces(portal, "user_factory")

    found = uf.objectIds(["ZODB Mutable Property Provider"])
    if not found:
        plone_pas.manage_addZODBMutablePropertyProvider("mutable_properties")
        logger.debug("Added Mutable Property Manager.")
        activatePluginInterfaces(portal, "mutable_properties")

    found = uf.objectIds(["Automatic Group Plugin"])
    if not found:
        plone_pas.manage_addAutoGroup(
            "auto_group", "Authenticated Users (Virtual Group)", "AuthenticatedUsers", "Automatic Group Provider"
        )
        logger.debug("Added Automatic Group.")
        activatePluginInterfaces(portal, "auto_group")

    found = uf.objectIds(["Plone Session Plugin"])
    if not found:
        manage_addSessionPlugin(plone_pas, "session")
        logger.debug("Added Plone Session Plugin.")
        activatePluginInterfaces(portal, "session")

    found = uf.objectIds(["Recursive Groups Plugin"])
    if not found:
        addRecursiveGroupsPlugin(plone_pas, "recursive_groups", "Recursive Groups Plugin")
        activatePluginInterfaces(portal, "recursive_groups")
        logger.debug("Added Recursive Groups plugin.")

    found = uf.objectIds(["ZODB Portrait Provider"])
    if not found:
        plone_pas.manage_addZODBPortraitProvider("portraits")
        logger.debug("Added Portrait Manager.")
        # activatePluginInterfaces(portal, "portraits")

    found = uf.objectIds(["PortalMemberdata Portrait Provider"])
    if not found:
        plone_pas.manage_addPortalMemberdataPortraitProvider("portraits-memberdata")
        logger.debug("Added Portrait Manager (PortalMemberdata).")
        activatePluginInterfaces(portal, "portraits-memberdata")

    found = uf.objectIds(["Gravatar Portrait Provider"])
    if not found:
        plone_pas.manage_addGravatarPortraitProvider("portraits-gravatar")
        logger.debug("Added Gravatar Portrait Manager.")
        activatePluginInterfaces(portal, "portraits-gravatar")