Re: [viewvc-users] [viewvc-users] ViewVCAuthorizer
"C. Michael Pilato" <[email protected]> Mon, 14 May 2012 09:39:39 -0400
| Newsgroups | gmane.comp.version-control.cvs.viewcvs.user |
|---|---|
| Organization | CollabNet, Inc. |
| Message-ID | <4FB10B1B.1020206__48740.3310755782$1337002802$gmane$org@collab.net> |
On 05/14/2012 05:34 AM, Arnaud Le Gué wrote: > Hello, > > I use ViewVC integrated into another web application (in PHP). This > application has his own authentication and rights management based on a > mysql database. So I need to make my own ViewVCAuthorizer to manage the > repertory the user can access. > > But I have one problem. How can I send to ViewVC a session identification > by URL? How the username parameter in __init__ is defined? > > Thank you for any answers. Let's assume that you are passing a session token using the CGI parameter "sessionid". The first to do is to make ViewVC not reject that parameter outright. You'll want to add a new entry to the dictionary _legal_params (in lib/viewvc.py) with the key "sessionid" and a value of one of the following: * None (for no validation) * a regular expression that the session ID must match to be valid * a validation function which accepts the value as a parameter Once you've done that, ViewVC will allow you to deliver to it the "sessionid=XXXXX" bit via the CGI parameters without it complaining of invalid input. And when you do so, the value of your sessionid parameter will be available via request.query_dict['sessionid']. Next, you probably want ViewVC to maintain that "sessionid=XXXXX" portion of the URL on all the URLs it generates for itself. To do this, you'll want to add "sessionid" to the list of "sticky variables" in the _sticky_vars sequence (also in lib/viewvc.py). You might need to do some more hacking around in order to get your sessionid value into your custom ViewVCAuthorizor(), but hopefully what I've provided is enough of a headstart to get you going. -- C. Michael Pilato <[email protected]> CollabNet <> www.collab.net <> Enterprise Cloud Development ------------------------------------------------------ http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4255&dsMessageId=2960512 To unsubscribe from this discussion, e-mail: [[email protected]].
signature.asc
(application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAk+xCxsACgkQokEGqRcG/W7zhgCdFPEig6phOkners7cLHfH11oV nuoAn3zpgxLK9BttysfnaT4DOV1cqLJj =sEeP -----END PGP SIGNATURE-----