0001-misc-always-hide-status-in-front-37517.patch
tests/test_form_pages.py | ||
---|---|---|
3727 | 3727 |
wf = Workflow(name='status') |
3728 | 3728 |
st0 = wf.add_status('Status0', 'st0') |
3729 | 3729 |
st1 = wf.add_status('Status1', 'st1') |
3730 |
st1.visibility = ['_receiver'] |
|
3731 | 3730 |
export_to = ExportToModel() |
3732 | 3731 |
export_to.label = 'create doc' |
3733 | 3732 |
upload = QuixoteUpload('/foo/test.rtf', content_type='application/rtf') |
... | ... | |
3783 | 3782 |
resp = resp.form.submit('button_export_to') |
3784 | 3783 |
resp = resp.follow() |
3785 | 3784 |
assert 'Form exported in a model' in resp.body |
3786 |
assert 'visibility-off' in resp.body |
|
3787 | 3785 | |
3788 | 3786 |
resp = resp.form.submit('button_jump2') |
3789 | 3787 |
resp = resp.follow() |
3790 | 3788 | |
3789 |
# limit visibility of status with document |
|
3790 |
st1.visibility = ['_receiver'] |
|
3791 |
wf.store() |
|
3791 | 3792 | |
3792 |
# change formdef receiver so the hidden status should not longer be visible |
|
3793 |
role2 = Role(name='yyy') |
|
3794 |
role2.store() |
|
3795 |
formdef.workflow_roles = {'_receiver': role2.id} |
|
3796 |
formdef.store() |
|
3797 | ||
3798 |
resp = login(get_app(pub), username='foo', password='foo').get(resp.request.url) |
|
3793 |
formdata = formdef.data_class().select()[0] |
|
3794 |
resp = login(get_app(pub), username='foo', password='foo').get(formdata.get_url()) |
|
3799 | 3795 |
assert not 'Form exported in a model' in resp.body |
3800 |
assert 'visibility-off' not in resp.body |
|
3796 | ||
3797 |
# check status is visible in backoffice |
|
3798 |
resp = login(get_app(pub), username='foo', password='foo').get(formdata.get_url(backoffice=True)) |
|
3799 |
assert 'visibility-off' in resp.body |
|
3800 |
assert 'Form exported in a model' in resp.body |
|
3801 | 3801 | |
3802 | 3802 |
def test_formdata_form_file_download(pub): |
3803 | 3803 |
create_user(pub) |
wcs/workflows.py | ||
---|---|---|
1564 | 1564 |
def is_visible(self, formdata, user): |
1565 | 1565 |
if not self.visibility: # no restriction -> visible |
1566 | 1566 |
return True |
1567 |
if get_request() and not get_request().is_in_backoffice(): |
|
1568 |
# always hide in front |
|
1569 |
return False |
|
1567 | 1570 |
if user and user.is_admin: |
1568 | 1571 |
return True |
1569 | 1572 | |
1570 |
- |