This commit is contained in:
parent
9918598b8f
commit
abd293f19c
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf8 -*-
|
||||
|
||||
from zope.component import getUtility
|
||||
from zope.intid.interfaces import IIntIds
|
||||
from zc.relation.interfaces import ICatalog
|
||||
|
@ -123,3 +125,24 @@ class CanBeTrashedDmsAppendixFile(grok.View):
|
|||
|
||||
def render(self):
|
||||
return api.content.get_state(self.context) == 'published'
|
||||
|
||||
|
||||
class CanReturnToRegistering(grok.View):
|
||||
""""""
|
||||
grok.name('can_return_to_registering')
|
||||
grok.context(IDmsIncomingMail)
|
||||
grok.require('zope2.View')
|
||||
|
||||
def render(self):
|
||||
# accept any of these roles
|
||||
allowed_roles = {'Reviewer', 'Manager', 'Greffier'}
|
||||
user_roles = api.user.get_roles(obj=self.context)
|
||||
if allowed_roles.intersection(user_roles):
|
||||
return True
|
||||
|
||||
# or this user group
|
||||
for group in api.group.get_groups():
|
||||
if group.id == 'Gestion-secretariat-general':
|
||||
return True
|
||||
|
||||
return False
|
||||
|
|
|
@ -204,10 +204,7 @@
|
|||
<transition transition_id="back_to_registering" title="" new_state="registering" trigger="USER" before_script="" after_script="">
|
||||
<action url="%(content_url)s/content_status_modify?workflow_action=back_to_registering" category="workflow" icon="" i18n:translate="">Back to registering</action>
|
||||
<guard>
|
||||
<guard-role>Reviewer</guard-role>
|
||||
<guard-role>Manager</guard-role>
|
||||
<guard-role>Greffier</guard-role>
|
||||
<guard-role>SecretariatGeneralApf</guard-role>
|
||||
<guard-expression>here/@@can_return_to_registering</guard-expression>
|
||||
</guard>
|
||||
</transition>
|
||||
<transition transition_id="directly_noaction" title="" new_state="noaction" trigger="USER" before_script="" after_script="">
|
||||
|
|
|
@ -205,10 +205,7 @@
|
|||
<transition transition_id="back_to_registering" title="" new_state="registering" trigger="USER" before_script="" after_script="">
|
||||
<action url="%(content_url)s/content_status_modify?workflow_action=back_to_registering" category="workflow" icon="" i18n:translate="">Back to registering</action>
|
||||
<guard>
|
||||
<guard-role>Reviewer</guard-role>
|
||||
<guard-role>Manager</guard-role>
|
||||
<guard-role>Greffier</guard-role>
|
||||
<guard-role>SecretariatGeneralAPF</guard-role>
|
||||
<guard-expression>here/@@can_return_to_registering</guard-expression>
|
||||
</guard>
|
||||
</transition>
|
||||
<transition transition_id="directly_noaction" title="" new_state="noaction" trigger="USER" before_script="" after_script="">
|
||||
|
|
Reference in New Issue