[Erp5-report] r35789 fabien - in /experimental/bt5/erp5_credential: DocumentTemplateItem/ E...

nobody at svn.erp5.org nobody at svn.erp5.org
Mon May 31 15:59:43 CEST 2010


Author: fabien
Date: Mon May 31 15:59:41 2010
New Revision: 35789

URL: http://svn.erp5.org?rev=35789&view=rev
Log:
move isLoginAvailable from Credential Request class to Credential Extension as we may want to use it in another context than Credential Request

Added:
    experimental/bt5/erp5_credential/ExtensionTemplateItem/
    experimental/bt5/erp5_credential/ExtensionTemplateItem/Credential.py
    experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/ERP5Site_isLoginAvailable.xml
Modified:
    experimental/bt5/erp5_credential/DocumentTemplateItem/CredentialRequest.py
    experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_checkLoginAvailability.xml
    experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_view/my_password.xml
    experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_view/password_confirm.xml
    experimental/bt5/erp5_credential/bt/revision
    experimental/bt5/erp5_credential/bt/template_extension_id_list

Modified: experimental/bt5/erp5_credential/DocumentTemplateItem/CredentialRequest.py
URL: http://svn.erp5.org/experimental/bt5/erp5_credential/DocumentTemplateItem/CredentialRequest.py?rev=35789&r1=35788&r2=35789&view=diff
==============================================================================
--- experimental/bt5/erp5_credential/DocumentTemplateItem/CredentialRequest.py [utf8] (original)
+++ experimental/bt5/erp5_credential/DocumentTemplateItem/CredentialRequest.py [utf8] Mon May 31 15:59:41 2010
@@ -60,24 +60,3 @@
       # every body can change a password of a credential request as annonymous
       # should be able to do it
       pass
-
-    def isLoginAvailable(self, login):
-      """
-      Check for login avaibility, return False if the login is already used,
-      True instead
-      """
-      if not login:
-        return False
-      acl_users = getToolByName(self, 'acl_users')
-      if PluggableAuthService is not None and isinstance(acl_users,
-          PluggableAuthService.PluggableAuthService.PluggableAuthService):
-        plugin_list = acl_users.plugins.listPlugins(
-            PluggableAuthService.interfaces.plugins.IUserEnumerationPlugin)
-        for plugin_name, plugin_value in plugin_list:
-          if isinstance(plugin_value, ERP5UserManager):
-            user_list = acl_users.searchUsers(id=login,
-                exact_match=True)
-            if len(user_list) > 0:
-              return False
-            break
-      return True

Added: experimental/bt5/erp5_credential/ExtensionTemplateItem/Credential.py
URL: http://svn.erp5.org/experimental/bt5/erp5_credential/ExtensionTemplateItem/Credential.py?rev=35789&view=auto
==============================================================================
--- experimental/bt5/erp5_credential/ExtensionTemplateItem/Credential.py (added)
+++ experimental/bt5/erp5_credential/ExtensionTemplateItem/Credential.py [utf8] Mon May 31 15:59:41 2010
@@ -1,0 +1,57 @@
+##############################################################################
+#
+# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
+#                    Fabien MORIN <fabien at nexedi.com>
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+
+from Products.CMFCore.utils import getToolByName 
+try:
+  from Products import PluggableAuthService
+  from Products.ERP5Security.ERP5UserManager import ERP5UserManager
+except ImportError:
+  PluggableAuthService = None
+
+
+def isLoginAvailable(self, login):
+  """
+  Check for login avaibility, return False if the login is already used,
+  True instead
+  """
+  if not login:
+    return False
+  portal = self.getPortalObject()
+  acl_users = getToolByName(portal, 'acl_users')
+  if PluggableAuthService is not None and isinstance(acl_users,
+      PluggableAuthService.PluggableAuthService.PluggableAuthService):
+    plugin_list = acl_users.plugins.listPlugins(
+        PluggableAuthService.interfaces.plugins.IUserEnumerationPlugin)
+    for plugin_name, plugin_value in plugin_list:
+      if isinstance(plugin_value, ERP5UserManager):
+        user_list = acl_users.searchUsers(id=login,
+            exact_match=True)
+        if len(user_list) > 0:
+          return False
+        break
+  return True

Modified: experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_checkLoginAvailability.xml
URL: http://svn.erp5.org/experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_checkLoginAvailability.xml?rev=35789&r1=35788&r2=35789&view=diff
==============================================================================
--- experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_checkLoginAvailability.xml [utf8] (original)
+++ experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_checkLoginAvailability.xml [utf8] Mon May 31 15:59:41 2010
@@ -58,7 +58,7 @@
 user_id = request.get(\'field_my_user_id\', \n
                       request.get(\'my_user_id\'))\n
 \n
-if not context.isLoginAvailable(user_id):\n
+if not context.ERP5Site_isLoginAvailable(user_id):\n
   return 0\n
 return 1\n
 </string> </value>

Modified: experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_view/my_password.xml
URL: http://svn.erp5.org/experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_view/my_password.xml?rev=35789&r1=35788&r2=35789&view=diff
==============================================================================
--- experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_view/my_password.xml [utf8] (original)
+++ experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_view/my_password.xml [utf8] Mon May 31 15:59:41 2010
@@ -13,7 +13,6 @@
             <key> <string>delegated_list</string> </key>
             <value>
               <list>
-                <string>default</string>
                 <string>enabled</string>
                 <string>required</string>
                 <string>title</string>
@@ -59,15 +58,9 @@
             <value>
               <dictionary>
                 <item>
-                    <key> <string>default</string> </key>
+                    <key> <string>enabled</string> </key>
                     <value>
                       <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
-                    </value>
-                </item>
-                <item>
-                    <key> <string>enabled</string> </key>
-                    <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
                     </value>
                 </item>
                 <item>
@@ -97,10 +90,6 @@
             <key> <string>values</string> </key>
             <value>
               <dictionary>
-                <item>
-                    <key> <string>default</string> </key>
-                    <value> <string></string> </value>
-                </item>
                 <item>
                     <key> <string>enabled</string> </key>
                     <value> <int>1</int> </value>
@@ -142,22 +131,6 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>string:******</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-  <record id="3" aka="AAAAAAAAAAM=">
-    <pickle>
-      <tuple>
-        <global name="TALESMethod" module="Products.Formulator.TALESField"/>
-        <tuple/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>_text</string> </key>
             <value> <string>python: request.AUTHENTICATED_USER.has_permission(\'Set own password\', here)</string> </value>
         </item>
       </dictionary>

Modified: experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_view/password_confirm.xml
URL: http://svn.erp5.org/experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_view/password_confirm.xml?rev=35789&r1=35788&r2=35789&view=diff
==============================================================================
--- experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_view/password_confirm.xml [utf8] (original)
+++ experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_view/password_confirm.xml [utf8] Mon May 31 15:59:41 2010
@@ -13,7 +13,6 @@
             <key> <string>delegated_list</string> </key>
             <value>
               <list>
-                <string>default</string>
                 <string>enabled</string>
                 <string>required</string>
                 <string>title</string>
@@ -59,15 +58,9 @@
             <value>
               <dictionary>
                 <item>
-                    <key> <string>default</string> </key>
+                    <key> <string>enabled</string> </key>
                     <value>
                       <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
-                    </value>
-                </item>
-                <item>
-                    <key> <string>enabled</string> </key>
-                    <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
                     </value>
                 </item>
                 <item>
@@ -97,10 +90,6 @@
             <key> <string>values</string> </key>
             <value>
               <dictionary>
-                <item>
-                    <key> <string>default</string> </key>
-                    <value> <string></string> </value>
-                </item>
                 <item>
                     <key> <string>enabled</string> </key>
                     <value> <int>1</int> </value>
@@ -142,22 +131,6 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>string:******</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-  <record id="3" aka="AAAAAAAAAAM=">
-    <pickle>
-      <tuple>
-        <global name="TALESMethod" module="Products.Formulator.TALESField"/>
-        <tuple/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>_text</string> </key>
             <value> <string>python: request.AUTHENTICATED_USER.has_permission(\'Set own password\', here)</string> </value>
         </item>
       </dictionary>

Added: experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/ERP5Site_isLoginAvailable.xml
URL: http://svn.erp5.org/experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/ERP5Site_isLoginAvailable.xml?rev=35789&view=auto
==============================================================================
--- experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/ERP5Site_isLoginAvailable.xml (added)
+++ experimental/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/ERP5Site_isLoginAvailable.xml [utf8] Mon May 31 15:59:41 2010
@@ -1,0 +1,31 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_function</string> </key>
+            <value> <string>isLoginAvailable</string> </value>
+        </item>
+        <item>
+            <key> <string>_module</string> </key>
+            <value> <string>Credential</string> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>ERP5Site_isLoginAvailable</string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Modified: experimental/bt5/erp5_credential/bt/revision
URL: http://svn.erp5.org/experimental/bt5/erp5_credential/bt/revision?rev=35789&r1=35788&r2=35789&view=diff
==============================================================================
--- experimental/bt5/erp5_credential/bt/revision [utf8] (original)
+++ experimental/bt5/erp5_credential/bt/revision [utf8] Mon May 31 15:59:41 2010
@@ -1,1 +1,1 @@
-26
+29

Modified: experimental/bt5/erp5_credential/bt/template_extension_id_list
URL: http://svn.erp5.org/experimental/bt5/erp5_credential/bt/template_extension_id_list?rev=35789&r1=35788&r2=35789&view=diff
==============================================================================
--- experimental/bt5/erp5_credential/bt/template_extension_id_list [utf8] (original)
+++ experimental/bt5/erp5_credential/bt/template_extension_id_list [utf8] Mon May 31 15:59:41 2010
@@ -1,0 +1,1 @@
+Credential




More information about the Erp5-report mailing list