[Module] HTML ACL 1.1

Brian Gallew geek+python@cmu.edu
Mon, 19 Feb 2001 11:08:24 -0500 (EST)


                              HTML ACL 1.1                              
                              ------------                              

CGI access control

This class provides a really easy way to add access control to a Python
CGI. This if for use in addition to whatever "normal" authentication
module you use. In our case, we use Kerberos for authentication, and
then this module is used for authorization. This allows the two
functions to be easily split.

To check access is simple:

import html_acl ACL = html_acl.ACL('/path/to/access/storage', None)
my_privs = ACL[os.environ['REMOTE_USER']]

my_privs now contains a list of "priveleges" that have been granted to
the current user.

To generate a page which will allow interactive updates to the
permission database is almost as easy:

import sys, cgi, html_acl print 'Content-Type: text/html\n\n' form =
cgi.FieldStorage() ACL = html_acl.ACL('/path/to/access/storage',
'update.py') ACL.update(form, os.environ['REMOTE_USER']) try: dummy =
ACL[os.environ['REMOTE_USER']] except: permission_error() # Define this
yourself

print "\n\n" print ACL print "\n"



Suggestions are always welcome.

       URL:  http://www.as.cmu.edu/~geek/transferables/html_acl.html
  Download:  http://www.as.cmu.edu/~geek/transferables/html_acl.py

   License:  Public Domain
  Requires:  cPickle, base64

  Categories:  CGI Modules

Brian Gallew (geek+python@cmu.edu)
http://www.as.cmu.edu/~geek

--
<a href="http://www.as.cmu.edu/~geek/transferables/html_acl.html">HTML
ACL 1.1</a> -- CGI access control