Changeset 1510 for pykota/trunk
- Timestamp:
- 05/28/04 22:56:45 (21 years ago)
- Location:
- pykota/trunk
- Files:
-
- 4 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/conf/pykota.conf.sample
r1502 r1510 98 98 # 99 99 # How to create new accounts and groups 100 # authorized values are "below" and "attach(objectclass name )"100 # authorized values are "below" and "attach(objectclass name [, fail|warn])" 101 101 # 102 102 # "below" creates the new accounts/groups as standalone entries 103 103 # below the above defined 'userbase' ou 104 104 # 105 # attach(objectclass name ) tries to find some existing user/group105 # attach(objectclass name [, action]) tries to find some existing user/group 106 106 # using the above defined 'userrdn' or 'grouprdn' and 'userbase' 107 107 # 'groupbase', and attach the PyKota specific entries to it. 108 # 109 # a possible value: newuser: attach(posixAccount) 108 # if action is "warn" and no entry exists to attach to, a new 109 # entry is created, and a message is logged. 110 # if action is "fail" and no entry exists to attach to, program 111 # logs an error message and aborts. 112 # if action is not set, the default value is "fail". 113 # 114 # a possible value: newuser: attach(posixAccount, warn) 110 115 #newuser : below 111 116 #newgroup : below -
pykota/trunk/NEWS
r1502 r1510 25 25 - 1.19alpha16 : 26 26 27 - the newuser and newgroup LDAP specific directives now accept 28 a second parameter to attach(), "fail" or "warn". If no entry 29 is found to attach PyKota attributes to, and "fail" was used, 30 then action is aborted and program exits in error. If "warn" 31 is used, a new entry is created but a warning message is logged. 32 27 33 - The job's originating hostname is now stored in the database, 28 34 and exported as PYKOTAJOBORIGINATINGHOSTNAME in the environment. -
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 : -
pykota/trunk/TODO
r1509 r1510 40 40 is cancelled by the user. 41 41 42 - newuser: attach(posixAccount | inetOrgPerson | ..., fail|warn)43 same for newgroup44 45 42 - Test and document a possible workaround for knowing 46 43 if the job is a banner (embed a postscript comment