source: fedd/federation/deter_impl.py @ 23dec62

axis_examplecompt_changesinfo-opsversion-2.00version-3.01version-3.02
Last change on this file since 23dec62 was 23dec62, checked in by Ted Faber <faber@…>, 15 years ago

Initial dragon import and fedd_client testing for same

  • Property mode set to 100644
File size: 2.6 KB
Line 
1#!/usr/local/bin/python
2
3import emulab_access
4import dragon_access
5from experiment_control import experiment_control_local
6from split import split_local
7from util import read_simple_accessdb
8
9from authorizer import authorizer
10
11class deter_impl:
12    """
13    The implementation of access control based on mapping users to projects.
14
15    Users can be mapped to existing projects or have projects created
16    dynamically.  This implements both direct requests and proxies.
17    """
18    # Used by the SOAP caller
19    soap_namespaces = ('http://www.isi.edu/faber/fedd.wsdl',
20            'http://www.isi.edu/faber/fedd_internal.wsdl')
21
22    def __init__(self, config=None):
23        """
24        Initializer.  Uses the parsed configuration to create appropriate
25        components.
26        """
27        self.soap_services = { }
28        self.xmlrpc_services = { }
29        self.auth = authorizer()
30
31        if config:
32            self.cert_file = config.get("globals", "cert_file");
33            self.cert_pwd = config.get("globals", "cert_pwd");
34            self.trusted_certs = config.get("globals", "trusted_certs");
35            self.access_type = config.get("globals", "access_type", "emulab")
36
37            access_db = config.get("globals", "accessdb")
38
39            if access_db:
40                try:
41                    read_simple_accessdb(access_db, self.auth)
42                except IOError, e:
43                    raise RuntimeError(
44                            "Error reading accessDB %s: %s" % (access_db, e))
45                except ValueError, e:
46                    raise RuntimeError("%s" % e)
47
48            if config.has_section("access"):
49                if self.access_type == "emulab":
50                    self.access = emulab_access.access(config, self.auth)
51                elif self.access_type == "dragon":
52                    self.access = dragon_access.access(config, self.auth)
53                else:
54                    raise RuntimeError("Unknown access_type: %s" % \
55                            self.access_type)
56                self.soap_services.update(self.access.soap_services) 
57                self.xmlrpc_services.update(self.access.xmlrpc_services) 
58
59            if config.has_section("experiment_control"):
60                self.experiment = \
61                        experiment_control_local(config, self.auth)
62                # Tell the experiment control where local access control is and
63                # what testbeds it pertains to.
64                if getattr(self, 'access', None):
65                    for t in self.access.testbed:
66                        self.experiment.local_access[t] = self.access
67
68                self.soap_services.update(self.experiment.soap_services) 
69                self.xmlrpc_services.update(self.experiment.xmlrpc_services) 
70                self.get_handler = self.experiment.get_handler
71            else:
72                self.get_handler = None
73
74            if config.has_section("splitter"):
75                self.splitter = split_local(config, self.auth)
76                self.soap_services.update(self.splitter.soap_services) 
77                self.xmlrpc_services.update(self.splitter.xmlrpc_services) 
78
79def new_feddservice(config):
80    return deter_impl(config)
Note: See TracBrowser for help on using the repository browser.