r96363 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96362‎ | r96363 | r96364 >
Date:19:35, 6 September 2011
Author:laner
Status:ok
Tags:
Comment:
Add options for adding and modifying a user's email address in LDAP
Modified paths:
  • /trunk/tools/subversion/user-management/add-ldap-user (modified) (history)
  • /trunk/tools/subversion/user-management/modify-ldap-user (modified) (history)

Diff [purge]

Index: trunk/tools/subversion/user-management/modify-ldap-user
@@ -21,6 +21,7 @@
2222 parser.add_option("--gid", action="store", dest="gidNumber", help="Set the user's gid")
2323 parser.add_option("--uid", action="store", dest="uidNumber", help="Set the user's uid")
2424 parser.add_option("--cn", action="store", dest="cn", help="Set the user's CN")
 25+ parser.add_option("--mail", action="store", dest="mail", help="Set the user's email address")
2526 parser.add_option("--firstname", action="store", dest="givenName", help="Set the user's first name")
2627 parser.add_option("--lastname", action="store", dest="sn", help="Set the user's last name")
2728 parser.add_option("--replacekeys", action="store", dest="replaceKeyLocation", help="Replaces all of the user's keys")
@@ -95,6 +96,8 @@
9697 NewPosixData['givenName'] = options.givenName
9798 if options.cn:
9899 NewPosixData['cn'] = options.cn
 100+ if options.mail:
 101+ NewPosixData['mail'] = options.mail
99102
100103 if PosixData == NewPosixData:
101104 sys.stderr.write("No changes to make; exiting.\n")
Index: trunk/tools/subversion/user-management/add-ldap-user
@@ -25,6 +25,7 @@
2626 parser.add_option("--cn", action="store", dest="cn", help="The user's CN (default: firstname + lastname, or username, if first/last not set)")
2727 parser.add_option("--firstname", action="store", dest="givenName", help="The user's first name (default: username)")
2828 parser.add_option("--lastname", action="store", dest="sn", help="The user's last name (default: username)")
 29+ parser.add_option("--mail", action="store", dest="mail", help="The user's email address")
2930 parser.add_option("--dry-run", action="store_true", dest="dryRun", help="Dry run mode (no changes)")
3031 (options, args) = parser.parse_args()
3132
@@ -121,6 +122,9 @@
122123 userEntry['sn'] = sn
123124 userEntry['cn'] = cn
124125
 126+ if options.mail:
 127+ userEntry['mail'] = options.mail
 128+
125129 if not dryRun:
126130 modlist = ldap.modlist.addModlist(userEntry)
127131 ds.add_s(dn, modlist)

Status & tagging log