1 | #!/usr/local/bin/python |
---|
2 | |
---|
3 | from fedd_access import fedd_access |
---|
4 | from fedd_experiment_control import fedd_experiment_control_local |
---|
5 | from fedd_split import fedd_split_local |
---|
6 | |
---|
7 | from authorizer import authorizer |
---|
8 | |
---|
9 | class fedd_deter_impl: |
---|
10 | """ |
---|
11 | The implementation of access control based on mapping users to projects. |
---|
12 | |
---|
13 | Users can be mapped to existing projects or have projects created |
---|
14 | dynamically. This implements both direct requests and proxies. |
---|
15 | """ |
---|
16 | # Used by the SOAP caller |
---|
17 | soap_namespaces = ('http://www.isi.edu/faber/fedd.wsdl', |
---|
18 | 'http://www.isi.edu/faber/fedd_internal.wsdl') |
---|
19 | |
---|
20 | def __init__(self, config=None): |
---|
21 | """ |
---|
22 | Initializer. Parses a configuration if one is given. |
---|
23 | """ |
---|
24 | self.soap_services = { } |
---|
25 | self.xmlrpc_services = { } |
---|
26 | self.auth = authorizer() |
---|
27 | |
---|
28 | if config: |
---|
29 | self.cert_file = config.get("globals", "cert_file"); |
---|
30 | self.cert_pwd = config.get("globals", "cert_pwd"); |
---|
31 | self.trusted_certs = config.get("globals", "trusted_certs"); |
---|
32 | |
---|
33 | if config.has_section("access"): |
---|
34 | self.access = fedd_access(config, self.auth) |
---|
35 | self.soap_services.update(self.access.soap_services) |
---|
36 | self.xmlrpc_services.update(self.access.xmlrpc_services) |
---|
37 | |
---|
38 | if config.has_section("experiment_control"): |
---|
39 | self.experiment = \ |
---|
40 | fedd_experiment_control_local(config, self.auth) |
---|
41 | self.soap_services.update(self.experiment.soap_services) |
---|
42 | self.xmlrpc_services.update(self.experiment.xmlrpc_services) |
---|
43 | |
---|
44 | if config.has_section("splitter"): |
---|
45 | self.splitter = fedd_split_local(config, self.auth) |
---|
46 | self.soap_services.update(self.splitter.soap_services) |
---|
47 | self.xmlrpc_services.update(self.splitter.xmlrpc_services) |
---|
48 | |
---|
49 | def new_feddservice(config): |
---|
50 | return fedd_deter_impl(config) |
---|