source: TI03-DataExtractor/branches/old_stuff/extractor/protect.py @ 793

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI03-DataExtractor/branches/old_stuff/extractor/protect.py@793
Revision 793, 1.1 KB checked in by astephen, 14 years ago (diff)

Put all the old code in the old_stuff branch.

Line 
1#!/usr/local/cdat/bin/python
2
3"""
4protect.py
5==========
6
7Security module for the extractor package.
8
9This module holds the main function that is used
10to control a user authentication (login) and authorisation
11(access to various datasets).
12
13Version history
14===============
15
16Version 1.0:  - 01/03/2004
17              - Ag Stephens, British Atmospheric Data Centre.
18              - First version.
19
20"""
21
22# Import required modules
23
24import commands
25import re
26import os
27
28# Set global variables
29
30from shared_data import *
31
32def checkSecurity(perl_script=os.path.join(basedir, "protector.pl")):
33
34    output=commands.getoutput(perl_script) 
35    #print "Content-Type: text/html\n\n"
36    #for key in os.environ.keys(): print "<BR>%s, %s" % (key, os.environ[key])
37
38    match=re.search("START_GROUPS::(.*)::END_GROUPS", output)
39    if match:
40        groupstring=match.group(1)
41        grouplist=groupstring.split(", ")
42        groups=[]
43        for item in grouplist:
44            if item!="":
45                groups.append(item.strip(", \n\r\t"))
46        return groups
47    else:
48        return output
49             
50
51
52
53   
54       
55
Note: See TracBrowser for help on using the repository browser.