Use named permissions
authorThierry Florac <thierry.florac@onf.fr>
Thu, 08 Oct 2015 11:40:41 +0200
changeset 17 cbb60bf47bf3
parent 16 33f22d044f62
child 18 23ac4c21b235
Use named permissions
src/pyams_thesaurus/__init__.py
--- a/src/pyams_thesaurus/__init__.py	Thu Aug 27 11:30:22 2015 +0200
+++ b/src/pyams_thesaurus/__init__.py	Thu Oct 08 11:40:41 2015 +0200
@@ -16,6 +16,8 @@
 from pyramid.i18n import TranslationStringFactory
 _ = TranslationStringFactory('pyams_thesaurus')
 
+from pyams_utils.interfaces import VIEW_PERMISSION, VIEW_SYSTEM_PERMISSION
+
 
 def includeme(config):
     """Pyramid include"""
@@ -35,13 +37,15 @@
     config.register_role({'id': 'thesaurus.Admin',
                           'title': _("Thesaurus administrator (role)"),
                           'permissions': {'thesaurus.admin', 'thesaurus.manage', 'thesaurus.extract.manage',
-                                          'view', 'system.view'},
+                                          VIEW_PERMISSION, VIEW_SYSTEM_PERMISSION},
                           'managers': {'system:admin', 'role:system.Manager'}})
     config.register_role({'id': 'thesaurus.Manager',
                           'title': _("Thesaurus content manager (role)"),
-                          'permissions': {'thesaurus.manage', 'thesaurus.extract.manage', 'view', 'system.view'},
+                          'permissions': {'thesaurus.manage', 'thesaurus.extract.manage',
+                                          VIEW_PERMISSION, VIEW_SYSTEM_PERMISSION},
                           'managers': {'system:admin', 'role:system.Manager', 'role:thesaurus.Admin'}})
     config.register_role({'id': 'thesaurus.ExtractManager',
                           'title': _("Thesaurus extract manager (role)"),
-                          'permissions': {'thesaurus.extract.manage', 'view', 'system.view'},
+                          'permissions': {'thesaurus.extract.manage',
+                                          VIEW_PERMISSION, VIEW_SYSTEM_PERMISSION},
                           'managers': {'system:admin', 'role:system.Manager', 'role:thesaurus.Admin'}})