Accepting request 562028 from Application:ERP:Tryton:Factory

- GNU Health client - initial version 3.2.5

OBS-URL: https://build.opensuse.org/request/show/562028
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/gnuhealth-client?expand=0&rev=1
This commit is contained in:
Dominique Leuenberger 2018-01-06 17:55:29 +00:00 committed by Git OBS Bridge
commit 39e751f971
8 changed files with 391 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

4
_service Normal file
View File

@ -0,0 +1,4 @@
<services>
<service name="download_files" mode="disabled" />
</services>

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f0228792549fcad898019320c6ebed5de6784970645146f350eaf0c07e516624
size 14371

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f36cd8c85b84c49bbde9706cca8cebb77c69d391427308c5dfa93af9ee3a53c1
size 852403

4
gnuhealth-client.changes Normal file
View File

@ -0,0 +1,4 @@
-------------------------------------------------------------------
Fri Jan 5 18:41:40 UTC 2018 - axel.braun@gmx.de
- GNU Health client - initial version 3.2.5

30
gnuhealth-client.desktop Normal file
View File

@ -0,0 +1,30 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=GNU Health
GenericName=GNU Health client
GenericName[ca_ES]=Client per l'aplicació GNU Health
GenericName[de]=Client für die GNU Health Applikationsplattform
GenericName[es_AR]=Cliente para la aplicación GNU Health
GenericName[es_EC]=Cliente para la aplicación GNU Health
GenericName[es_ES]=Cliente para la aplicación GNU Health
GenericName[es_CO]=Cliente para la Aplicación GNU Health
GenericName[fr]=Client de la plate-forme applicative GNU Health
GenericName[ru]=Клиент для платформы приложений GNU Health
GenericName[sl]=Odjemalec za GNU Health programsko platformo
Comment=Access GNU Health server
Comment[de]=Verbindet zu einem GNU Health Server
Comment[es_AR]=Acceso al servidor GNU Health
Comment[es_EC]=Acceso al servidor GNU Health
Comment[ca_ES]=Accés al servidor GNU Health
Comment[es_ES]=Acceso al servidor GNU Health
Comment[es_CO]=Acceso al servidor GNU Health
Comment[fr]=Accéder au serveur GNU Health
Comment[ru]=Подключение к серверу GNU Health
Comment[sl]=Dostop do GNU Health strežnika
Keywords=Healthcare;Medicine;Bioinformatics;Management;Enterprise;ERP;Framework;Client;
Exec=gnuhealth-client %u
Icon=gnuhealth
Terminal=false
MimeType=application/tryton;
Categories=Office;Finance;

104
gnuhealth-client.spec Normal file
View File

@ -0,0 +1,104 @@
#
# spec file for package gnuhealth-client
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2015-2017 Dr. Axel Braun
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define majorver 3.2
Name: gnuhealth-client
Version: %{majorver}.5
Release: 0
Summary: The client of the GNU Health Hospital system
License: GPL-3.0
Group: Productivity/Office/Management
Url: http://health.gnu.org/
Source: https://ftp.gnu.org/gnu/health/%{name}-%{version}.tar.gz
Source1: ftp://ftp.gnu.org/gnu/health/plugins/gnuhealth-camera-plugin-latest.tar.gz
Source2: %{name}.desktop
Patch0: gnuhealth_crypto.patch
BuildRequires: fdupes
BuildRequires: python-Babel
BuildRequires: python-Sphinx
# List of additional build dependencies
BuildRequires: python-devel
BuildRequires: python-gtk
BuildRequires: python-python-dateutil
BuildRequires: python-rsvg
BuildRequires: python-setuptools
BuildRequires: python-simplejson
BuildRequires: update-desktop-files
Requires: librsvg
#for the plugins:
Requires: opencv
Requires: python-GooCalendar
Requires: python-cdecimal
Requires: python-chardet
Requires: python-dateutil
Requires: python-gnupg
Requires: python-gtk
Requires: python-opencv
Requires: python-pytz
Requires: python-rsvg
Requires: python-setuptools
Requires: python-simplejson
Requires: python-xml
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
#install Tryton or GNU Health Client
Conflicts: tryton
%description
The client of the GNU Health Hospital application
%prep
%setup -q -n %{name}-%{version}
%patch0 -p1
cp %{S:2} .
pwd
cd %{name}/plugins/
tar --strip-components 1 -xzvf %{SOURCE1}
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
# menu-entry
desktop-file-install --dir %{buildroot}%{_datadir}/applications %{name}.desktop
%suse_update_desktop_file %{name}
mkdir -p %{buildroot}%{_datadir}/pixmaps
cp %{buildroot}%{python_sitelib}/tryton/data/pixmaps/tryton/gnuhealth-icon.png %{buildroot}%{_datadir}/pixmaps/gnuhealth.png
%fdupes %{buildroot}%{_datadir}
%fdupes %{buildroot}%{_prefix}/lib
%post
%desktop_database_post
%icon_theme_cache_post
%postun
%desktop_database_postun
%icon_theme_cache_postun
%files
%defattr(-,root,root)
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%doc COPYRIGHT COPYING COPYRIGHT Changelog
%{_datadir}/pixmaps/*
%{python_sitelib}/*
%changelog

220
gnuhealth_crypto.patch Normal file
View File

@ -0,0 +1,220 @@
diff -U 6 -H -d -r -N -- a/gnuhealth-client/plugins/crypto/__init__.py b/gnuhealth-client/plugins/crypto/__init__.py
--- a/gnuhealth-client/plugins/crypto/__init__.py 1970-01-01 01:00:00.000000000 +0100
+++ b/gnuhealth-client/plugins/crypto/__init__.py 2014-07-15 10:33:53.000000000 +0200
@@ -0,0 +1,179 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# GNU Health: The Free Health and Hospital Information System
+# Copyright (C) 2008-2014 Luis Falcon <lfalcon@gnusolidario.org>
+# Copyright (C) 2011-2014 GNU Solidario <health@gnusolidario.org>
+#
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import tryton.rpc as rpc
+from tryton.common import RPCExecute, warning, message
+from tryton.gui.window.form import Form
+import gettext
+
+try:
+ import gnupg
+except:
+ warning(
+ ('Document Encryption / Signing disabled'
+ '\nPlease install the gnupg library '),
+ ('No GNU Privacy Guard library found !'),
+ )
+
+
+_ = gettext.gettext
+
+def sign_document(data):
+ """ Retrieve the hash value of the serialized document and
+ generates a clearsign signature using the user's private key
+ on the client side via GNU Privacy Guard - GPG -"""
+
+ gpg = gnupg.GPG()
+
+ document_model = data['model']
+
+ """ Don't allow signing more than one document at a time
+ To avoid signing unwanted / unread documents
+ """
+
+ if (len(data['ids']) > 1):
+ warning(
+ _('For security reasons, Please sign one document at a time'),
+ _('Multiple records selected !'),
+ )
+ return
+
+ """ Verify that the document handles digital signatures """
+
+ try:
+ record_vals = rpc.execute(
+ 'model', document_model, 'read',
+ data['ids'],
+ ['document_digest', 'digital_signature'], rpc.CONTEXT)
+
+ except:
+ warning(
+ _('Please enable the model for digital signature'),
+ _('No Digest or Digital Signature fields found !'),
+ )
+ return
+
+ digest = record_vals[0]['document_digest']
+
+ """ Check that the document hasn't been signed already """
+
+ if record_vals[0]['digital_signature']:
+ warning(
+ _('Document already signed'),
+ _('This record has been already signed'),
+ )
+ return
+
+ try:
+ gpg_signature = gpg.sign(digest, clearsign=True)
+
+ except:
+ warning(
+ _('Error when signing the document'),
+ _('Please check your encryption settings'),
+ )
+
+ """
+ Set the clearsigned digest
+ """
+ try:
+ RPCExecute(
+ 'model', document_model, 'set_signature',
+ data, str(gpg_signature))
+
+ except:
+ warning(
+ _('Error when saving the digital signature'),
+ _('The signature was generated but NOT saved !'),
+ )
+
+ else:
+ message(_('Document digitally signed'))
+
+ # TODO
+ # Reload the record view after storing the digital signature
+ # sig_reload or other method to check.
+ # a = Form(document_model, data['ids'])
+ # a.sig_reload()
+ # a.message_info(_('Document digitally signed'), color='blue')
+
+
+def verify_document(data):
+ """ Verify the digital signature of the document """
+
+ gpg = gnupg.GPG()
+
+ document_model = data['model']
+
+ """ Verify that the document handles digital signatures """
+
+ try:
+ record_vals = rpc.execute(
+ 'model', document_model, 'read',
+ data['ids'],
+ ['document_digest', 'digital_signature'], rpc.CONTEXT)
+
+ except:
+ warning(
+ _('Please enable the model for digital signature'),
+ _('No Digest or Digital Signature fields found !'),
+ )
+ return
+
+
+ """ Verify signature """
+ digital_signature = record_vals[0]['digital_signature']
+
+ """ Check that the document has been signed """
+ if not digital_signature:
+ warning(
+ _('Unsigned document'),
+ _('This document has not been signed yet'),
+ )
+ return
+
+ try:
+ verify_signature = gpg.verify(digital_signature)
+
+ except:
+ warning(
+ _('Error when verifying Digital Signature'),
+ _('Please check your GNU Privacy Guard Settings'),
+ )
+
+ else:
+ """ Show message of warning boxes depending on the verification """
+ if (verify_signature.valid):
+ message(_("Valid Signature !\n\n" + verify_signature.stderr))
+ else:
+ warning(
+ _(str(verify_signature.stderr)),
+ _(str("Error !")),
+ )
+
+
+def get_plugins(model):
+ return [
+ (_('Digitally Sign Document'), sign_document),
+ (_('Verify Digital Signature'), verify_document),
+ ]
diff -U 6 -H -d -r -N -- a/tryton/plugins/crypto/doc/index.rst b/tryton/plugins/crypto/doc/index.rst
--- a/tryton/plugins/crypto/doc/index.rst 1970-01-01 01:00:00.000000000 +0100
+++ b/tryton/plugins/crypto/doc/index.rst 2014-07-15 10:33:53.000000000 +0200
@@ -0,0 +1,33 @@
+Tryton Crytpo Plugin
+####################
+
+This plugin has been developed as part of GNU Health [1], but you should
+be able to use it with any model in Tryton[2]
+
+Functionality :
+The Tryton crypto plugin interacts with GNU Privacy Guard [3] to digitally
+sign and encrypt documents.
+
+OS Requirements:
+
+Model attributes :
+The plugin requires - as a minimum - the following attributes on the model
+in order to be able to sign the document.
+
+ "document_digest" of type fields.Char
+ "digital_signature" of type fields.Text
+
+
+In real life, you will need others to make it meaningful. Please take a look
+at the Prescription model on the health_crypto module for an example and
+other fields used.
+
+
+
+Usage:
+
+References:
+
+1.- GNU Health : http://health.gnu.org
+2.- Tryton : http://www.tryton.org
+3.- GNU Privacy Guard : http://www.gnupg.org