Mercurial > p > roundup > code
comparison doc/customizing.txt @ 3228:1b15e9eeb592
fixes to the "Using an external password validation source"...
...customisation example (bugs [SF#153640] and [SF#155108])
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 03 Mar 2005 02:18:02 +0000 |
| parents | 7308c3c5a943 |
| children | 78d2f3ce85f6 |
comparison
equal
deleted
inserted
replaced
| 3227:8faeb10c819d | 3228:1b15e9eeb592 |
|---|---|
| 1 =================== | 1 =================== |
| 2 Customising Roundup | 2 Customising Roundup |
| 3 =================== | 3 =================== |
| 4 | 4 |
| 5 :Version: $Revision: 1.172 $ | 5 :Version: $Revision: 1.173 $ |
| 6 | 6 |
| 7 .. This document borrows from the ZopeBook section on ZPT. The original is at: | 7 .. This document borrows from the ZopeBook section on ZPT. The original is at: |
| 8 http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx | 8 http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx |
| 9 | 9 |
| 10 .. contents:: | 10 .. contents:: |
| 3244 ----------------------------- | 3244 ----------------------------- |
| 3245 | 3245 |
| 3246 Using an external password validation source | 3246 Using an external password validation source |
| 3247 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 3247 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 3248 | 3248 |
| 3249 .. note:: You will need to either have an "admin" user in your external | |
| 3250 password source *or* have one of your regular users have | |
| 3251 the Admin Role assigned. If you need to assign the Role *after* | |
| 3252 making the changes below, you may use the ``roundup-admin`` | |
| 3253 program to edit a user's details. | |
| 3254 | |
| 3249 We have a centrally-managed password changing system for our users. This | 3255 We have a centrally-managed password changing system for our users. This |
| 3250 results in a UN*X passwd-style file that we use for verification of | 3256 results in a UN*X passwd-style file that we use for verification of |
| 3251 users. Entries in the file consist of ``name:password`` where the | 3257 users. Entries in the file consist of ``name:password`` where the |
| 3252 password is encrypted using the standard UN*X ``crypt()`` function (see | 3258 password is encrypted using the standard UN*X ``crypt()`` function (see |
| 3253 the ``crypt`` module in your Python distribution). An example entry | 3259 the ``crypt`` module in your Python distribution). An example entry |
| 3260 need to override the standard ``verifyPassword`` method defined in | 3266 need to override the standard ``verifyPassword`` method defined in |
| 3261 ``roundup.cgi.actions.LoginAction`` and register the new class. The | 3267 ``roundup.cgi.actions.LoginAction`` and register the new class. The |
| 3262 following is added as ``externalpassword.py`` in the tracker ``extensions`` | 3268 following is added as ``externalpassword.py`` in the tracker ``extensions`` |
| 3263 directory:: | 3269 directory:: |
| 3264 | 3270 |
| 3271 import os, crypt | |
| 3265 from roundup.cgi.actions import LoginAction | 3272 from roundup.cgi.actions import LoginAction |
| 3266 | 3273 |
| 3267 class ExternalPasswordLoginAction(LoginAction): | 3274 class ExternalPasswordLoginAction(LoginAction): |
| 3268 def verifyPassword(self, userid, password): | 3275 def verifyPassword(self, userid, password): |
| 3269 '''Look through the file, line by line, looking for a | 3276 '''Look through the file, line by line, looking for a |
| 3340 tracker_home = sys.argv[1] | 3347 tracker_home = sys.argv[1] |
| 3341 tracker = instance.open(tracker_home) | 3348 tracker = instance.open(tracker_home) |
| 3342 | 3349 |
| 3343 Next we read in the *passwd* file from the tracker home:: | 3350 Next we read in the *passwd* file from the tracker home:: |
| 3344 | 3351 |
| 3345 # read in the users | 3352 # read in the users from the "passwd.txt" file |
| 3346 file = os.path.join(tracker_home, 'users.passwd') | 3353 file = os.path.join(tracker_home, 'passwd.txt') |
| 3347 users = [x.strip().split(':') for x in open(file).readlines()] | 3354 users = [x.strip().split(':') for x in open(file).readlines()] |
| 3348 | 3355 |
| 3349 Handle special users (those to ignore in the file, and those who don't | 3356 Handle special users (those to ignore in the file, and those who don't |
| 3350 appear in the file):: | 3357 appear in the file):: |
| 3351 | 3358 |
