from .pi_email_authenticator import addEmailAuthenticatorAuthenticatorPlugin
from .pi_email_authenticator import EmailAuthenticatorPlugin
from .pi_email_authenticator import manage_addEmailAuthenticatorPluginForm
from .pi_recursive_groups import addPIRecursiveGroupsPlugin
from .pi_recursive_groups import manage_addPIRecursiveGroupsPluginForm
from .pi_recursive_groups import PIRecursiveGroupsPlugin
from AccessControl.Permissions import manage_users as ManageUsers
from Products.PluggableAuthService import registerMultiPlugin

registerMultiPlugin(EmailAuthenticatorPlugin.meta_type)
registerMultiPlugin(PIRecursiveGroupsPlugin.meta_type)


def initialize(context):
    context.registerClass(
        EmailAuthenticatorPlugin,
        permission=ManageUsers,
        constructors=(
            manage_addEmailAuthenticatorPluginForm,
            addEmailAuthenticatorAuthenticatorPlugin,
        ),
        visibility=True,
        icon="www/EmailAuthenticatorPlugin.png",
    )
    context.registerClass(
        PIRecursiveGroupsPlugin,
        permission=ManageUsers,
        constructors=(
            manage_addPIRecursiveGroupsPluginForm,
            addPIRecursiveGroupsPlugin,
        ),
        visibility=None,
        icon="www/PIRecursiveGroupsPlugin.png",
    )
