workflows: new action to anonymise a form (#4961)
This commit is contained in:
parent
fb5bd98d35
commit
ad3381f136
|
@ -0,0 +1,34 @@
|
|||
<page xmlns="http://projectmallard.org/1.0/"
|
||||
type="topic" id="wf-anonymise" xml:lang="fr">
|
||||
|
||||
<info>
|
||||
<link type="guide" xref="index#wf" />
|
||||
<revision docversion="0.1" date="2014-08-26" status="draft"/>
|
||||
<credit type="author">
|
||||
<name>Frédéric Péters</name>
|
||||
<email>fpeters@entrouvert.com</email>
|
||||
</credit>
|
||||
|
||||
</info>
|
||||
|
||||
<title>Anonymisation</title>
|
||||
|
||||
<p>
|
||||
Dans le circuit de traitement d'une demande, après qu'elle ait été traitée,
|
||||
il peut être souhaité d'en conserver une trace à des fins statistiques, tout en
|
||||
lui retirant toute information à caractère personnel.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
L'élément « Anonymisation » répond à ce genre de besoin; il sera généralement
|
||||
placé dans un état du workflow atteint après un expiration d'un délai.
|
||||
</p>
|
||||
|
||||
<note style="important"><p>
|
||||
L'anonymisation des données privées est une obligation légale dans beaucoup de
|
||||
situations.
|
||||
</p></note>
|
||||
|
||||
|
||||
</page>
|
||||
|
|
@ -584,9 +584,6 @@ class FormPage(Directory):
|
|||
if form_data.get('draft_formdata_id'):
|
||||
filled.remove_object(form_data.get('draft_formdata_id'))
|
||||
|
||||
if not filled.user_id:
|
||||
get_session().mark_anonymous_formdata(filled)
|
||||
|
||||
if not filled.user_id and existing_formdata is None:
|
||||
a = AnonymityLink()
|
||||
a.formdata_type = 'form'
|
||||
|
@ -597,11 +594,16 @@ class FormPage(Directory):
|
|||
# XXX nothing with anonylink.key ?
|
||||
a.store()
|
||||
get_logger().info('form %s - done (id: %s)' % (self.formdef.name, filled.id))
|
||||
url = None
|
||||
if existing_formdata is None:
|
||||
url = filled.perform_workflow()
|
||||
if url:
|
||||
return redirect(url)
|
||||
return redirect(filled.get_url())
|
||||
|
||||
if not filled.user_id:
|
||||
get_session().mark_anonymous_formdata(filled)
|
||||
|
||||
if not url:
|
||||
url = filled.get_url()
|
||||
return redirect(url)
|
||||
|
||||
def submitted_existing(self, form, editing):
|
||||
old_data = editing.data
|
||||
|
@ -1026,6 +1028,8 @@ class PublicFormStatusPage(FormStatusPage):
|
|||
def __init__(self, *args, **kwargs):
|
||||
FormStatusPage.__init__(self, *args, **kwargs)
|
||||
if self.filled.anonymised:
|
||||
if get_session() and get_session().is_anonymous_submitter(self.filled):
|
||||
return
|
||||
raise errors.TraversalError()
|
||||
|
||||
def status(self):
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
# w.c.s. - web application for online forms
|
||||
# Copyright (C) 2005-2011 Entr'ouvert
|
||||
#
|
||||
# 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 2 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/>.
|
||||
|
||||
from wcs.workflows import WorkflowStatusItem, register_item_class
|
||||
|
||||
class AnonymiseWorkflowStatusItem(WorkflowStatusItem):
|
||||
description = N_('Anonymise')
|
||||
key = 'anonymise'
|
||||
|
||||
def perform(self, formdata):
|
||||
formdata.anonymise()
|
||||
|
||||
register_item_class(AnonymiseWorkflowStatusItem)
|
|
@ -1578,3 +1578,4 @@ def load_extra():
|
|||
import wf.wscall
|
||||
import wf.form
|
||||
import wf.register_comment
|
||||
import wf.anonymise
|
||||
|
|
Loading…
Reference in New Issue