Changeset 1510 for pykota/trunk/pykota/storages/ldapstorage.py
- Timestamp:
- 05/28/04 22:56:45 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/ldapstorage.py
r1506 r1510 22 22 # 23 23 # $Log$ 24 # Revision 1.66 2004/05/28 20:56:45 jalet 25 # Extended syntax for LDAP specific newuser and newgroup directives. Untested. 26 # 24 27 # Revision 1.65 2004/05/27 12:52:12 jalet 25 28 # More useful error message in case of misconfiguration of an LDAP search base … … 762 765 mustadd = 1 763 766 if self.info["newuser"].lower() != 'below' : 764 result = self.doSearch("(&(objectClass=%s)(%s=%s))" % (self.info["newuser"], self.info["userrdn"], user.Name), None, base=self.info["userbase"]) 767 try : 768 (where, action) = [s.strip() for s in self.info["newuser"].split(",")] 769 except ValueError : 770 (where, action) = (self.info["newuser"].strip(), "fail") 771 result = self.doSearch("(&(objectClass=%s)(%s=%s))" % (where, self.info["userrdn"], user.Name), None, base=self.info["userbase"]) 765 772 if result : 766 773 (dn, fields) = result[0] … … 769 776 self.doModify(dn, fields) 770 777 mustadd = 0 778 else : 779 message = _("Unable to find an existing entry to attach pykotaAccount objectclass %s") % user.Name 780 if action.lower() == "warn" : 781 self.tool.logger.log_message("%s. A new entry will be created instead." % message, "warn") 782 else : # 'fail' or incorrect setting 783 raise PyKotaStorageError, "%s. Action aborted. Please check your configuration." % message 771 784 772 785 if mustadd : … … 788 801 mustadd = 1 789 802 if self.info["newgroup"].lower() != 'below' : 790 result = self.doSearch("(&(objectClass=%s)(%s=%s))" % (self.info["newgroup"], self.info["grouprdn"], group.Name), None, base=self.info["groupbase"]) 803 try : 804 (where, action) = [s.strip() for s in self.info["newgroup"].split(",")] 805 except ValueError : 806 (where, action) = (self.info["newgroup"].strip(), "fail") 807 result = self.doSearch("(&(objectClass=%s)(%s=%s))" % (where, self.info["grouprdn"], group.Name), None, base=self.info["groupbase"]) 791 808 if result : 792 809 (dn, fields) = result[0] … … 795 812 self.doModify(dn, fields) 796 813 mustadd = 0 814 else : 815 message = _("Unable to find an existing entry to attach pykotaGroup objectclass %s") % group.Name 816 if action.lower() == "warn" : 817 self.tool.logger.log_message("%s. A new entry will be created instead." % message, "warn") 818 else : # 'fail' or incorrect setting 819 raise PyKotaStorageError, "%s. Action aborted. Please check your configuration." % message 797 820 798 821 if mustadd :