[19cc408] | 1 | #!/usr/local/bin/python |
---|
| 2 | |
---|
[f4f4117] | 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 |
---|
[19cc408] | 6 | |
---|
[3f6bc5f] | 7 | from authorizer import authorizer |
---|
| 8 | |
---|
[19cc408] | 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 | |
---|
[72ed6e4] | 20 | def __init__(self, config=None): |
---|
[19cc408] | 21 | """ |
---|
| 22 | Initializer. Parses a configuration if one is given. |
---|
| 23 | """ |
---|
[72ed6e4] | 24 | self.soap_services = { } |
---|
| 25 | self.xmlrpc_services = { } |
---|
[3f6bc5f] | 26 | self.auth = authorizer() |
---|
[72ed6e4] | 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"): |
---|
[3f6bc5f] | 34 | self.access = fedd_access(config, self.auth) |
---|
[72ed6e4] | 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"): |
---|
[3f6bc5f] | 39 | self.experiment = \ |
---|
| 40 | fedd_experiment_control_local(config, self.auth) |
---|
[72ed6e4] | 41 | self.soap_services.update(self.experiment.soap_services) |
---|
| 42 | self.xmlrpc_services.update(self.experiment.xmlrpc_services) |
---|
| 43 | |
---|
[f4f4117] | 44 | if config.has_section("splitter"): |
---|
[3f6bc5f] | 45 | self.splitter = fedd_split_local(config, self.auth) |
---|
[f4f4117] | 46 | self.soap_services.update(self.splitter.soap_services) |
---|
| 47 | self.xmlrpc_services.update(self.splitter.xmlrpc_services) |
---|
| 48 | |
---|
[72ed6e4] | 49 | def new_feddservice(config): |
---|
| 50 | return fedd_deter_impl(config) |
---|