Projet

Général

Profil

0001-settings-do-not-export-roles-when-managed-by-idp-242.patch

Thomas Noël, 01 juin 2018 14:15

Télécharger (2,27 ko)

Voir les différences:

Subject: [PATCH] settings: do not export roles when managed by idp (#24224)

 tests/test_admin_pages.py | 17 +++++++++++++++++
 wcs/admin/settings.py     |  3 ++-
 2 files changed, 19 insertions(+), 1 deletion(-)
tests/test_admin_pages.py
3719 3719
    assert 'Imported successfully' in resp.body
3720 3720
    assert '1 forms' in resp.body
3721 3721

  
3722
    # do not export roles when managed by idp
3723
    pub.cfg['sp'] = {'idp-manage-roles': True}
3724
    pub.write_cfg()
3725
    resp = app.get('/backoffice/settings/export')
3726
    resp = resp.form.submit('submit')
3727
    zip_content = StringIO.StringIO(resp.body)
3728
    zipf = zipfile.ZipFile(zip_content, 'a')
3729
    filelist = zipf.namelist()
3730
    assert 'formdefs/1' in filelist
3731
    assert 'workflows/1' in filelist
3732
    assert 'roles/1' not in filelist
3733
    assert 'categories/1' in filelist
3734
    assert 'datasources/1' in filelist
3735
    assert 'wscalls/corge' in filelist
3736
    for filename in filelist:
3737
        assert not '.indexes' in filename
3738

  
3722 3739
def test_settings_themes(pub):
3723 3740
    create_superuser(pub)
3724 3741
    app = login(get_app(pub))
wcs/admin/settings.py
816 816
        form = Form(enctype="multipart/form-data")
817 817
        form.add(CheckboxWidget, 'formdefs', title = _('Forms'), value = True)
818 818
        form.add(CheckboxWidget, 'workflows', title = _('Workflows'), value = True)
819
        form.add(CheckboxWidget, 'roles', title = _('Roles'), value = True)
819
        form.add(CheckboxWidget, 'roles', title = _('Roles'),
820
                 value=not get_cfg('sp', {}).get('idp-manage-roles'))
820 821
        form.add(CheckboxWidget, 'categories', title = _('Categories'), value = True)
821 822
        form.add(CheckboxWidget, 'settings', title = _('Settings'), value = False)
822 823
        form.add(CheckboxWidget, 'datasources', title=_('Data sources'), value=True)
823
-