1 # -*- coding: utf-8 -*-
3 ## Copyright (C)2006 Ingeniweb
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 2 of the License, or
8 ## (at your option) any later version.
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ## GNU General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; see the file COPYING. If not, write to the
17 ## Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 __version__
= "$Revision: $"
23 # $Id: __init__.py 40111 2007-04-01 09:12:57Z alecm $
24 __docformat__
= 'restructuredtext'
26 # postonly protections
28 # Zope 2.8.9, 2.9.7 and 2.10.3 (and up)
29 from AccessControl
.requestmethod
import postonly
33 from Products
.Hotfix_20070320
import postonly
35 def postonly(callable): return callable
38 import GroupUserFolder
40 import PatchCatalogTool
42 import Products
.LDAPUserFolder
46 from global_symbols
import *
48 # Plone import try/except
50 from Products
.CMFCore
.DirectoryView
import registerDirectory
51 import GroupsToolPermissions
53 # No registerdir available -> we ignore
56 # Used in Extension/install.py
57 global groupuserfolder_globals
58 groupuserfolder_globals
=globals()
60 # LDAPUserFolder patching
62 import LDAPGroupFolder
65 # Now we can patch LDAPUF
66 from Products
.LDAPUserFolder
import LDAPUserFolder
67 import LDAPUserFolderAdapter
68 LDAPUserFolder
._doAddUser
= LDAPUserFolderAdapter
._doAddUser
69 LDAPUserFolder
._doDelUsers
= LDAPUserFolderAdapter
._doDelUsers
70 LDAPUserFolder
._doChangeUser
= LDAPUserFolderAdapter
._doChangeUser
71 LDAPUserFolder
._find
_user
_dn
= LDAPUserFolderAdapter
._find
_user
_dn
72 LDAPUserFolder
.manage_editGroupRoles
= LDAPUserFolderAdapter
.manage_editGroupRoles
73 LDAPUserFolder
._mangleRoles
= LDAPUserFolderAdapter
._mangleRoles
75 # Patch LDAPUF : XXX FIXME: have to find something cleaner here?
78 def initialize(context
):
81 registerDirectory('skins', groupuserfolder_globals
)
83 # No registerdir available => we ignore
86 context
.registerClass(
87 GroupUserFolder
.GroupUserFolder
,
88 permission
='Add GroupUserFolders',
89 constructors
=(GroupUserFolder
.manage_addGroupUserFolder
,),
90 icon
='www/GroupUserFolder.gif',
94 context
.registerClass(
95 LDAPGroupFolder
.LDAPGroupFolder
,
96 permission
='Add GroupUserFolders',
97 constructors
=(LDAPGroupFolder
.addLDAPGroupFolderForm
, LDAPGroupFolder
.manage_addLDAPGroupFolder
,),
98 icon
='www/LDAPGroupFolder.gif',
101 context
.registerClass(
102 GRUFFolder
.GRUFUsers
,
103 permission
='Add GroupUserFolder',
104 constructors
=(GRUFFolder
.manage_addGRUFUsers
,),
106 icon
='www/GRUFUsers.gif',
109 context
.registerClass(
110 GRUFFolder
.GRUFGroups
,
111 permission
='Add GroupUserFolder',
112 constructors
=(GRUFFolder
.manage_addGRUFGroups
,),
114 icon
='www/GRUFGroups.gif',
118 from Products
.CMFCore
.utils
import ToolInit
, ContentInit
119 from GroupsTool
import GroupsTool
120 from GroupDataTool
import GroupDataTool
121 ToolInit( meta_type
='CMF Groups Tool'
122 , tools
=( GroupsTool
, GroupDataTool
, )
124 ).initialize( context
)
127 Log(LOG_NOTICE
, "Unable to import GroupsTool and/or GroupDataTool. \
128 This won't disable GRUF but if you use CMF/Plone you won't get benefit of its special features.")