Back to index

plone3  3.1.7
MigrationCheck.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 acceptable_user_sources = ("User Folder","LDAPUserFolder")
00016 #acceptable_group_sources = ("User Folder","LDAPGroupFolder")
00017 acceptable_group_sources = ("User Folder",)
00018 
00019 def canAutoMigrate(userfolder):
00020     """Determine if a userfolder is set up so that it can be
00021     auto-migrated to PAS.
00022 
00023     Currently only true for GRUF with either UserFolder or
00024     LDAPUserFolder sources.
00025     """
00026     retval = 1
00027     if userfolder.meta_type == "Group User Folder":
00028         user_sources = userfolder.listUserSources()
00029         group_source = userfolder.Groups.acl_users
00030 
00031         retval = retval and group_source.meta_type in acceptable_group_sources
00032         for uf in user_sources:
00033             retval = retval and uf.meta_type in acceptable_user_sources
00034     else:
00035         retval = 0
00036     return retval