Hello community, here is the log from the commit of package tryton for openSUSE:Factory checked in at 2016-08-25 09:56:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/tryton (Old) and /work/SRC/openSUSE:Factory/.tryton.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "tryton" Changes: -------- New Changes file: --- /dev/null 2016-07-07 10:01:34.856033756 +0200 +++ /work/SRC/openSUSE:Factory/.tryton.new/tryton.changes 2016-08-25 09:56:39.000000000 +0200 @@ -0,0 +1,42 @@ +------------------------------------------------------------------- +Mon Apr 4 10:58:05 UTC 2016 - [email protected] + +- added GNUHealth Camera and OpenCV + +------------------------------------------------------------------- +Thu Nov 5 20:55:25 UTC 2015 - [email protected] + +- Version 3.8.1 + tryton-lang removed + +------------------------------------------------------------------- +Wed Oct 19 20:14:38 UTC 2015 - [email protected] + +- Tryton Release 3.8 + +------------------------------------------------------------------- +Wed Apr 15 07:24:15 UTC 2015 - [email protected] + +- Tryton Release 3.6 + +------------------------------------------------------------------- +Fri Feb 07 23:15:02 UTC 2014 - [email protected] + +- update to 3.0.2, changes to specfile + +------------------------------------------------------------------- +Mon Nov 11 11:00:06 UTC 2013 - [email protected] + +- update to 3.0.1, patch for mime type + +------------------------------------------------------------------- +Wed Oct 23 14:59:59 UTC 2013 - [email protected] + +- new branch 3.0 + +* Sat Jun 22 2013 [email protected] +- new spec with regard to systemd +- setup of user tryton if not existing + +* Sun Mar 29 2009 [email protected] +- packaged tryton version 1.0.3 using the buildservice spec file wizard New: ---- _service gnuhealth-camera-plugin-latest.tar.gz tryton-3.8.8.tar.gz tryton.changes tryton.spec tryton_crypto.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ tryton.spec ++++++ # # spec file for package tryton # # Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2015 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.8 Name: tryton Version: %{majorver}.8 Release: 0 Summary: The client of the Tryton application platform License: GPL-3.0 Group: Productivity/Office/Management Url: http://www.tryton.org/ Source: http://downloads.tryton.org/%{majorver}/%{name}-%{version}.tar.gz Source1: ftp://ftp.gnu.org/gnu/health/plugins/gnuhealth-camera-plugin-latest.tar.gz Patch0: tryton_crypto.patch BuildRequires: desktop-file-utils 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 %description The client of the Tryton application platform. A three-tiers high-level general purpose application platform written in Python and use Postgresql as database engine. It is the core base of an Open Source ERP. It provides modularity, scalability and security. %prep %setup -q %patch0 -p1 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} %fdupes %{buildroot}%{_datadir} %fdupes %{buildroot}%{_prefix}/lib mkdir -p %{buildroot}%{_datadir}/pixmaps cp %{buildroot}%{python_sitelib}/%{name}/data/pixmaps/%{name}/%{name}-icon.png %{buildroot}%{_datadir}/pixmaps/%{name}-icon.png %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 LICENSE README CHANGELOG %{_datadir}/pixmaps/* %{python_sitelib}/* %changelog ++++++ _service ++++++ <services> <service name="download_files" mode="localonly" /> </services> ++++++ tryton_crypto.patch ++++++ diff -U 6 -H -d -r -N -- a/tryton/plugins/crypto/__init__.py b/tryton/plugins/crypto/__init__.py --- a/tryton/plugins/crypto/__init__.py 1970-01-01 01:00:00.000000000 +0100 +++ b/tryton/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 <[email protected]> +# Copyright (C) 2011-2014 GNU Solidario <[email protected]> +# +# +# 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
