Mercurial > p > roundup > code
comparison doc/customizing.txt @ 3229:5ce9c9a1399d maint-0.8
merge from HEAD
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 03 Mar 2005 02:19:50 +0000 |
| parents | 96086801bd61 |
| children | 09fbb09bddd4 |
comparison
equal
deleted
inserted
replaced
| 3226:227ac5a716e0 | 3229:5ce9c9a1399d |
|---|---|
| 1 =================== | 1 =================== |
| 2 Customising Roundup | 2 Customising Roundup |
| 3 =================== | 3 =================== |
| 4 | 4 |
| 5 :Version: $Revision: 1.161.2.8 $ | 5 :Version: $Revision: 1.161.2.9 $ |
| 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:: |
| 3241 ----------------------------- | 3241 ----------------------------- |
| 3242 | 3242 |
| 3243 Using an external password validation source | 3243 Using an external password validation source |
| 3244 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 3244 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 3245 | 3245 |
| 3246 .. note:: You will need to either have an "admin" user in your external | |
| 3247 password source *or* have one of your regular users have | |
| 3248 the Admin Role assigned. If you need to assign the Role *after* | |
| 3249 making the changes below, you may use the ``roundup-admin`` | |
| 3250 program to edit a user's details. | |
| 3251 | |
| 3246 We have a centrally-managed password changing system for our users. This | 3252 We have a centrally-managed password changing system for our users. This |
| 3247 results in a UN*X passwd-style file that we use for verification of | 3253 results in a UN*X passwd-style file that we use for verification of |
| 3248 users. Entries in the file consist of ``name:password`` where the | 3254 users. Entries in the file consist of ``name:password`` where the |
| 3249 password is encrypted using the standard UN*X ``crypt()`` function (see | 3255 password is encrypted using the standard UN*X ``crypt()`` function (see |
| 3250 the ``crypt`` module in your Python distribution). An example entry | 3256 the ``crypt`` module in your Python distribution). An example entry |
| 3257 need to override the standard ``verifyPassword`` method defined in | 3263 need to override the standard ``verifyPassword`` method defined in |
| 3258 ``roundup.cgi.actions.LoginAction`` and register the new class. The | 3264 ``roundup.cgi.actions.LoginAction`` and register the new class. The |
| 3259 following is added as ``externalpassword.py`` in the tracker ``extensions`` | 3265 following is added as ``externalpassword.py`` in the tracker ``extensions`` |
| 3260 directory:: | 3266 directory:: |
| 3261 | 3267 |
| 3268 import os, crypt | |
| 3262 from roundup.cgi.actions import LoginAction | 3269 from roundup.cgi.actions import LoginAction |
| 3263 | 3270 |
| 3264 class ExternalPasswordLoginAction(LoginAction): | 3271 class ExternalPasswordLoginAction(LoginAction): |
| 3265 def verifyPassword(self, userid, password): | 3272 def verifyPassword(self, userid, password): |
| 3266 '''Look through the file, line by line, looking for a | 3273 '''Look through the file, line by line, looking for a |
| 3337 tracker_home = sys.argv[1] | 3344 tracker_home = sys.argv[1] |
| 3338 tracker = instance.open(tracker_home) | 3345 tracker = instance.open(tracker_home) |
| 3339 | 3346 |
| 3340 Next we read in the *passwd* file from the tracker home:: | 3347 Next we read in the *passwd* file from the tracker home:: |
| 3341 | 3348 |
| 3342 # read in the users | 3349 # read in the users from the "passwd.txt" file |
| 3343 file = os.path.join(tracker_home, 'users.passwd') | 3350 file = os.path.join(tracker_home, 'passwd.txt') |
| 3344 users = [x.strip().split(':') for x in open(file).readlines()] | 3351 users = [x.strip().split(':') for x in open(file).readlines()] |
| 3345 | 3352 |
| 3346 Handle special users (those to ignore in the file, and those who don't | 3353 Handle special users (those to ignore in the file, and those who don't |
| 3347 appear in the file):: | 3354 appear in the file):: |
| 3348 | 3355 |
