Back to index

plone3  3.1.7
__init__.py
Go to the documentation of this file.
00001 ##############################################################################
00002 #
00003 # PlonePAS - Adapt PluggableAuthService for use in Plone
00004 # Copyright (C) 2005 Enfold Systems, Kapil Thangavelu, et al
00005 #
00006 # This software is subject to the provisions of the Zope Public License,
00007 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this
00008 # distribution.
00009 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
00010 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00011 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
00012 # FOR A PARTICULAR PURPOSE.
00013 #
00014 ##############################################################################
00015 """
00016 """
00017 
00018 from AccessControl.Permissions import add_user_folders
00019 from Products.PluggableAuthService import registerMultiPlugin
00020 from Products.CMFPlone import utils as plone_utils
00021 
00022 import config
00023 
00024 #################################
00025 # plugins
00026 from plugins import gruf
00027 from plugins import user
00028 from plugins import group
00029 from plugins import role
00030 from plugins import local_role
00031 from plugins import ufactory
00032 from plugins import property
00033 from plugins import crumbler
00034 from plugins import cookie_handler
00035 from plugins import autogroup
00036 
00037 #################################
00038 # pas monkies
00039 import pas
00040 
00041 #################################
00042 # ldapmp monkies if available
00043 
00044 try:
00045     from Products import LDAPMultiPlugins
00046     from Products import LDAPUserFolder
00047 except ImportError:
00048     pass
00049 else:
00050     import ldapmp
00051 
00052 #################################
00053 # pas monkies 2 play w/ gruf
00054 if config.PAS_INSIDE_GRUF:
00055     import gruf_support
00056 
00057 #################################
00058 # new groups tool
00059 from tools.membership import MembershipTool
00060 from tools.memberdata import MemberDataTool
00061 from tools.groups import GroupsTool
00062 from tools.groupdata import GroupDataTool
00063 
00064 #################################
00065 # import Extensions to check for syntax errors
00066 from Extensions import *
00067 
00068 #################################
00069 # register plugins with pas
00070 try:
00071     registerMultiPlugin( gruf.GRUFBridge.meta_type )
00072     registerMultiPlugin( user.UserManager.meta_type )
00073     registerMultiPlugin( group.GroupManager.meta_type )
00074     registerMultiPlugin( role.GroupAwareRoleManager.meta_type )
00075     registerMultiPlugin( local_role.LocalRolesManager.meta_type )
00076     registerMultiPlugin( ufactory.PloneUserFactory.meta_type )
00077     registerMultiPlugin( property.ZODBMutablePropertyProvider.meta_type )
00078     registerMultiPlugin( crumbler.CookieCrumblingPlugin.meta_type )
00079     registerMultiPlugin( cookie_handler.ExtendedCookieAuthHelper.meta_type )
00080     registerMultiPlugin( autogroup.AutoGroup.meta_type )
00081 except RuntimeError:
00082     # make refresh users happy
00083     pass
00084 
00085 def initialize(context):
00086 
00087     tools = ( GroupsTool, GroupDataTool, MembershipTool, MemberDataTool )
00088 
00089     plone_utils.ToolInit('PlonePAS Tool',
00090                          tools=tools,
00091                          icon='tool.gif',
00092                          ).initialize(context)
00093 
00094     context.registerClass( role.GroupAwareRoleManager,
00095                            permission = add_user_folders,
00096                            constructors = ( role.manage_addGroupAwareRoleManagerForm,
00097                                             role.manage_addGroupAwareRoleManager ),
00098                            visibility = None
00099                            )
00100 
00101     context.registerClass( gruf.GRUFBridge,
00102                            permission = add_user_folders,
00103                            constructors = ( gruf.manage_addGRUFBridgeForm,
00104                                             gruf.manage_addGRUFBridge ),
00105                            visibility = None
00106                            )
00107 
00108     context.registerClass( user.UserManager,
00109                            permission = add_user_folders,
00110                            constructors = ( user.manage_addUserManagerForm,
00111                                             user.manage_addUserManager ),
00112                            visibility = None
00113                            )
00114 
00115     context.registerClass( group.GroupManager,
00116                            permission = add_user_folders,
00117                            constructors = ( group.manage_addGroupManagerForm,
00118                                             group.manage_addGroupManager ),
00119                            visibility = None
00120                            )
00121 
00122     context.registerClass( ufactory.PloneUserFactory,
00123                            permission = add_user_folders,
00124                            constructors = ( ufactory.manage_addPloneUserFactoryForm,
00125                                             ufactory.manage_addPloneUserFactory ),
00126                            visibility = None
00127                            )
00128 
00129     context.registerClass( local_role.LocalRolesManager,
00130                            permission = add_user_folders,
00131                            constructors = ( local_role.manage_addLocalRolesManagerForm,
00132                                             local_role.manage_addLocalRolesManager ),
00133                            visibility = None
00134                            )
00135 
00136     context.registerClass( property.ZODBMutablePropertyProvider,
00137                            permission = add_user_folders,
00138                            constructors = ( property.manage_addZODBMutablePropertyProviderForm,
00139                                             property.manage_addZODBMutablePropertyProvider ),
00140                            visibility = None
00141                            )
00142 
00143     context.registerClass( crumbler.CookieCrumblingPlugin,
00144                            permission = add_user_folders,
00145                            constructors = ( crumbler.manage_addCookieCrumblingPluginForm,
00146                                             crumbler.manage_addCookieCrumblingPlugin ),
00147                            visibility = None
00148                            )
00149 
00150     context.registerClass( cookie_handler.ExtendedCookieAuthHelper,
00151                            permission = add_user_folders,
00152                            constructors = ( cookie_handler.manage_addExtendedCookieAuthHelperForm,
00153                                             cookie_handler.manage_addExtendedCookieAuthHelper ),
00154                            visibility = None
00155                            )
00156                            
00157 
00158     context.registerClass( autogroup.AutoGroup,
00159                            permission = add_user_folders,
00160                            constructors = ( autogroup.manage_addAutoGroupForm,
00161                                             autogroup.manage_addAutoGroup ),
00162                            visibility = None
00163                            )