diff --git a/ansible/deploy.yaml b/ansible/deploy.yaml index a3b0ca551af96feb6f1fa6f57741afe3c5268ed9..8e357c950cbc43a8c5ea2cd27e96b17c9891345d 100644 --- a/ansible/deploy.yaml +++ b/ansible/deploy.yaml @@ -92,11 +92,22 @@ app_path: "/home/{{ deploy_user_name }}/iPPIDB/ippisite" settings: "ippisite.{{ ansible_hostname }}_settings" # FIXME: this should obviously be removed before switching to prod. env. - - name: restrict access to the web server to specific IPs + - name: install passlib for htpasswd in ansible + yum: name=python-passlib state=installed + - file: + path: /etc/ippidb-80/passwdfile + state: absent + - htpasswd: + path: /etc/ippidb-80/passwdfile + name: ippidb + password: 'LeroyMerlin' #FIXME FIXME should be secret + owner: "{{ deploy_user_name }}" + mode: 0640 + - name: add httpd conf to use HTTP authentication lineinfile: dest=/etc/ippidb-80/httpd.conf regexp='' insertafter=EOF - line='<Location '/'>\nRequire all denied\nRequire ip 10.6.108.60\nRequire ip 10.6.107.22\nRequire ip 157.99\n</Location>\n' + line='LoadModule auth_basic_module '${MOD_WSGI_MODULES_DIRECTORY}/mod_auth_basic.so'\nLoadModule authn_core_module '${MOD_WSGI_MODULES_DIRECTORY}/mod_authn_core.so'\nLoadModule authn_file_module '${MOD_WSGI_MODULES_DIRECTORY}/mod_authn_file.so'\nLoadModule authz_core_module '${MOD_WSGI_MODULES_DIRECTORY}/mod_authz_core.so'\nLoadModule authz_user_module '${MOD_WSGI_MODULES_DIRECTORY}/mod_authz_user.so'\n<Location />\nAuthType Basic\nAuthName "Restricted Files"\nAuthUserFile /etc/ippidb-80/passwdfile\nRequire valid-user\n</Location>\n' - name: copy systemd service file for IPPIDB-web copy: remote_src: true diff --git a/ippisite/ippidb/views.py b/ippisite/ippidb/views.py index 805185c162561cc2765508f9ed4b91f17e643d07..e06ba57612e474cca1082bdb603101d8604e3f19 100644 --- a/ippisite/ippidb/views.py +++ b/ippisite/ippidb/views.py @@ -96,6 +96,8 @@ class IppiWizard(NamedUrlSessionWizardView): if step == 'ProteinDomainComplexForm': pks = self.storage.get_step_data('PDBForm').get('pks') print("Proteins",Protein.objects.filter(id__in=pks)) + if step == 'PpiForm': + initial['pdb_id'] = self.storage.get_step_data('PDBForm').get('PDBForm-pdb_id') return self.initial_dict.get(step, initial) def process_step(self, form):