misc: make sure admin permissions are set as strings (#7529)

This commit is contained in:
Frédéric Péters 2015-06-11 11:03:32 +02:00
parent 8f2e98d54d
commit 6455776a42
2 changed files with 15 additions and 0 deletions

View File

@ -140,6 +140,14 @@ def test_backoffice_role_user(pub):
assert not 'Forms Workshop' in resp.body
assert 'Workflows Workshop' in resp.body
# check role id int->str migration
pub.cfg['admin-permissions'] = {'workflows': [int(x.id) for x in Role.select()]}
pub.write_cfg()
resp = app.get('/backoffice/')
assert 'Management' in resp.body
assert not 'Forms Workshop' in resp.body
assert 'Workflows Workshop' in resp.body
def test_backoffice_forms(pub):
create_superuser(pub)
create_environment(set_receiver=False)

View File

@ -130,6 +130,13 @@ class WcsPublisher(StubWcsPublisher):
if request:
request.response.charset = self.site_charset
# make sure permissions are set using strings
if self.cfg.get('admin-permissions'):
for key in self.cfg['admin-permissions'].keys():
if not self.cfg['admin-permissions'][key]:
continue
self.cfg['admin-permissions'][key] = [str(x) for x in self.cfg['admin-permissions'][key]]
import wcs.workflows
wcs.workflows.load_extra()