Hello community, here is the log from the commit of package gnuhealth-thalamus for openSUSE:Factory checked in at 2019-07-17 13:14:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/gnuhealth-thalamus (Old) and /work/SRC/openSUSE:Factory/.gnuhealth-thalamus.new.1887 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "gnuhealth-thalamus" Wed Jul 17 13:14:58 2019 rev:3 rq:714991 version:0.9.9 Changes: -------- --- /work/SRC/openSUSE:Factory/gnuhealth-thalamus/gnuhealth-thalamus.changes 2019-03-11 11:15:27.069338510 +0100 +++ /work/SRC/openSUSE:Factory/.gnuhealth-thalamus.new.1887/gnuhealth-thalamus.changes 2019-07-17 13:15:01.447825977 +0200 @@ -1,0 +2,5 @@ +Thu Jul 11 18:51:27 UTC 2019 - Axel Braun <axel.br...@gmx.de> + +- version 0.9.9 + +------------------------------------------------------------------- Old: ---- thalamus-0.9.8.tar.gz New: ---- thalamus-0.9.9.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ gnuhealth-thalamus.spec ++++++ --- /var/tmp/diff_new_pack.Os1CjV/_old 2019-07-17 13:15:02.495825468 +0200 +++ /var/tmp/diff_new_pack.Os1CjV/_new 2019-07-17 13:15:02.499825466 +0200 @@ -21,7 +21,7 @@ %define modname thalamus Name: gnuhealth-%{modname} -Version: 0.9.8 +Version: 0.9.9 Release: 0 Summary: The GNU Health Federation Message and Authentication Server License: GPL-3.0-or-later ++++++ thalamus-0.9.8.tar.gz -> thalamus-0.9.9.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/thalamus-0.9.8/PKG-INFO new/thalamus-0.9.9/PKG-INFO --- old/thalamus-0.9.8/PKG-INFO 2019-03-08 17:26:43.000000000 +0100 +++ new/thalamus-0.9.9/PKG-INFO 2019-07-10 20:59:13.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: thalamus -Version: 0.9.8 +Version: 0.9.9 Summary: The GNU Health Federation Message and Authentication Server Home-page: http://health.gnu.org Author: GNU Solidario diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/thalamus-0.9.8/requirements.txt new/thalamus-0.9.9/requirements.txt --- old/thalamus-0.9.8/requirements.txt 2019-03-08 15:57:36.000000000 +0100 +++ new/thalamus-0.9.9/requirements.txt 2019-04-20 12:12:22.000000000 +0200 @@ -2,5 +2,5 @@ flask_httpauth flask_restful flask_wtf -psycopg2 +psycopg2-binary bcrypt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/thalamus-0.9.8/setup.py new/thalamus-0.9.9/setup.py --- old/thalamus-0.9.8/setup.py 2019-03-08 15:58:18.000000000 +0100 +++ new/thalamus-0.9.9/setup.py 2019-04-20 12:13:11.000000000 +0200 @@ -60,7 +60,7 @@ "flask_httpauth", "flask_restful", "flask_wtf", - "psycopg2", + "psycopg2-binary", "bcrypt", ], packages=find_packages(), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/thalamus-0.9.8/thalamus/demo/people.json new/thalamus-0.9.9/thalamus/demo/people.json --- old/thalamus-0.9.8/thalamus/demo/people.json 2019-03-08 14:33:31.000000000 +0100 +++ new/thalamus-0.9.9/thalamus/demo/people.json 2019-04-20 12:09:07.000000000 +0200 @@ -26,5 +26,19 @@ "password": "$2b$12$cjrKVGYEKUwCmVDCtEnwcegcrmECTmeBz526AAD/ZqMGPWFpHJ4FW", "roles":["end_user"], "active": true +}, +{ +"id": "ARGBUE111FAV", +"lastname": "Root", +"name": "Admin", +"gender": "f", +"dob": "2008-10-12", +"marital_status":"married", +"ethnicity":"latino", +"education":"tertiary", +"profession":"System Administrator", +"password": "$2b$12$McKDNgArdHKbUssD1fj64ecpdbJGMIt29ns7DGvqzqIT26W0dtJzi", +"roles":["root"], +"active": true } ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/thalamus-0.9.8/thalamus/etc/gunicorn.cfg new/thalamus-0.9.9/thalamus/etc/gunicorn.cfg --- old/thalamus-0.9.8/thalamus/etc/gunicorn.cfg 2018-11-27 00:07:32.000000000 +0100 +++ new/thalamus-0.9.9/thalamus/etc/gunicorn.cfg 2019-06-11 23:14:29.000000000 +0200 @@ -1,3 +1,4 @@ keyfile="/opt/gnuhealth/certs/gnuhealthfed.key" certfile="/opt/gnuhealth/certs/gnuhealthfed.crt" bind="localhost:8443" +#bind="localhost:5000" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/thalamus-0.9.8/thalamus/etc/roles.cfg new/thalamus-0.9.9/thalamus/etc/roles.cfg --- old/thalamus-0.9.8/thalamus/etc/roles.cfg 2018-11-27 00:07:32.000000000 +0100 +++ new/thalamus-0.9.9/thalamus/etc/roles.cfg 2019-05-09 12:51:04.000000000 +0200 @@ -1,7 +1,7 @@ [ {"role": "end_user", "permissions": { - "GET": ["person", "book","page","password"], + "GET": ["login","person", "book","page","password"], "PATCH": ["person","page"], "POST": ["page", "password"], "DELETE": [], @@ -11,7 +11,7 @@ {"role": "health_professional", "permissions": { - "GET": ["people","person","book","page"], + "GET": ["login","people","person","book","page"], "PATCH": ["person", "page"], "POST": ["person", "page"], "DELETE": [], @@ -21,7 +21,7 @@ {"role": "root", "permissions": { - "GET": ["people","person","book", "page","password"], + "GET": ["login","people","person","book", "page","password"], "PATCH": ["person","page"], "POST": ["person","page", "password"], "DELETE": ["person","page"], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/thalamus-0.9.8/thalamus/etc/thalamus.cfg new/thalamus-0.9.9/thalamus/etc/thalamus.cfg --- old/thalamus-0.9.8/thalamus/etc/thalamus.cfg 2019-03-08 14:30:29.000000000 +0100 +++ new/thalamus-0.9.9/thalamus/etc/thalamus.cfg 2019-05-26 17:55:03.000000000 +0200 @@ -3,7 +3,7 @@ POSTGRESQL_URI = "postgresql://localhost/federation" # Debugging info -DEBUG = False +DEBUG = True #Flask Secret Key SECRET_KEY = 'TheWorldNeedsMoreSocialMedicine' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/thalamus-0.9.8/thalamus/thalamus.py new/thalamus-0.9.9/thalamus/thalamus.py --- old/thalamus-0.9.8/thalamus/thalamus.py 2019-03-08 14:38:49.000000000 +0100 +++ new/thalamus-0.9.9/thalamus/thalamus.py 2019-06-19 20:25:44.000000000 +0200 @@ -27,8 +27,10 @@ ############################################################################## from flask import Flask, redirect, request, jsonify, render_template, url_for from flask_restful import Resource, Api, abort +from flask_cors import CORS import psycopg2 +from psycopg2 import sql from flask_wtf import FlaskForm from wtforms import BooleanField, StringField, PasswordField, SubmitField, \ @@ -39,9 +41,13 @@ import bcrypt import logging -__all__ = ["People","Person","Book","Page", "PasswordForm","Password"] +__all__ = ["People","Person","Book","Page", "Login", "PasswordForm","Password"] app = Flask(__name__) + +# Allow CORS requests from JS frontends, such as the GH Federation Portal +CORS(app) + app.config.from_pyfile('etc/thalamus.cfg') api = Api(app) @@ -68,8 +74,9 @@ Returns the instance or null """ cur = conn.cursor() - cur.execute ('SELECT id from %s \ - where id = %s limit(1)', (table, resid)) + cur.execute ( + sql.SQL("SELECT id from {} where id = %s limit(1)").format(sql.Identifier(table)), \ + (resid,)) try: res, = cur.fetchone() except: @@ -112,7 +119,7 @@ return False else: - return False + return False @@ -191,7 +198,7 @@ values = json.loads(request.data) # Initialize to inactive the newly created person - values['active'] = False + #values['active'] = False pw = None bcrypt_prefixes = ["$2b$", "$2y$"] @@ -202,7 +209,8 @@ if (person_id): if (type(person_id) is str): #Use upper case on the person federation account - values['id'] = person_id.upper() + person_id = person_id.upper() + values['id'] = person_id else: abort (422, error="wrong format on person ID") @@ -466,6 +474,22 @@ api.add_resource(Institutions, '/institutions') +# Login +class Login(Resource): + """" + Main class for loggin in from another resources, such the GH Federation Portal + At this point, with the decorator auth.login_required is enough + """ + + decorators = [auth.login_required] # Use the decorator from httpauth + + def get(self): + return True + +api.add_resource(Login, '/login') + + + class PasswordForm(FlaskForm): password = PasswordField('Password', validators=[validators.DataRequired(), @@ -474,7 +498,6 @@ pconfirm = PasswordField('Confirm Password') update = SubmitField('Update') - # Update the password of the user with a form @app.route('/password/<person_id>', methods=('GET', 'POST')) @auth.login_required @@ -506,7 +529,6 @@ def index(): return render_template('index.html') - if __name__ == '__main__': app.logger.warning("Running Thalamus without gunicorn ...") app.run() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/thalamus-0.9.8/thalamus.egg-info/PKG-INFO new/thalamus-0.9.9/thalamus.egg-info/PKG-INFO --- old/thalamus-0.9.8/thalamus.egg-info/PKG-INFO 2019-03-08 17:26:40.000000000 +0100 +++ new/thalamus-0.9.9/thalamus.egg-info/PKG-INFO 2019-07-10 20:59:12.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: thalamus -Version: 0.9.8 +Version: 0.9.9 Summary: The GNU Health Federation Message and Authentication Server Home-page: http://health.gnu.org Author: GNU Solidario diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/thalamus-0.9.8/thalamus.egg-info/requires.txt new/thalamus-0.9.9/thalamus.egg-info/requires.txt --- old/thalamus-0.9.8/thalamus.egg-info/requires.txt 2019-03-08 17:26:40.000000000 +0100 +++ new/thalamus-0.9.9/thalamus.egg-info/requires.txt 2019-07-10 20:59:12.000000000 +0200 @@ -2,5 +2,5 @@ flask_httpauth flask_restful flask_wtf -psycopg2 +psycopg2-binary bcrypt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/thalamus-0.9.8/version new/thalamus-0.9.9/version --- old/thalamus-0.9.8/version 2019-03-08 17:13:04.000000000 +0100 +++ new/thalamus-0.9.9/version 2019-07-10 20:47:16.000000000 +0200 @@ -1 +1 @@ -0.9.8 +0.9.9