Added permissions names in package interface
authorThierry Florac <thierry.florac@onf.fr>
Mon, 11 Sep 2017 14:18:46 +0200
changeset 36 84a4e78a6567
parent 35 561b0ce57281
child 37 5dacc2c05600
Added permissions names in package interface
src/pyams_thesaurus/__init__.py
src/pyams_thesaurus/interfaces/__init__.py
--- a/src/pyams_thesaurus/__init__.py	Tue Jul 18 10:55:10 2017 +0200
+++ b/src/pyams_thesaurus/__init__.py	Mon Sep 11 14:18:46 2017 +0200
@@ -16,8 +16,8 @@
 from pyramid.i18n import TranslationStringFactory
 _ = TranslationStringFactory('pyams_thesaurus')
 
-from pyams_thesaurus.interfaces import ADMIN_THESAURUS_PERMISSION, MANAGE_THESAURUS_CONTENT_PERMISSION, \
-    MANAGE_THESAURUS_EXTRACT_PERMISSION
+from pyams_thesaurus.interfaces import CREATE_THESAURUS_PERMISSION, ADMIN_THESAURUS_PERMISSION, \
+    MANAGE_THESAURUS_CONTENT_PERMISSION, MANAGE_THESAURUS_EXTRACT_PERMISSION
 from pyams_utils.interfaces import VIEW_PERMISSION, VIEW_SYSTEM_PERMISSION
 
 
@@ -28,6 +28,8 @@
     include_package(config)
 
     # register custom permissions
+    config.register_permission({'id': CREATE_THESAURUS_PERMISSION,
+                                'title': _("Create thesaurus")})
     config.register_permission({'id': ADMIN_THESAURUS_PERMISSION,
                                 'title': _("Manage thesaurus properties")})
     config.register_permission({'id': MANAGE_THESAURUS_CONTENT_PERMISSION,
--- a/src/pyams_thesaurus/interfaces/__init__.py	Tue Jul 18 10:55:10 2017 +0200
+++ b/src/pyams_thesaurus/interfaces/__init__.py	Mon Sep 11 14:18:46 2017 +0200
@@ -20,6 +20,14 @@
 # import packages
 
 
-ADMIN_THESAURUS_PERMISSION = 'thesaurus.admin'
-MANAGE_THESAURUS_CONTENT_PERMISSION = 'thesaurus.manage'
-MANAGE_THESAURUS_EXTRACT_PERMISSION = 'thesaurus.extract.manage'
+CREATE_THESAURUS_PERMISSION = 'pyams.CreateThesaurus'
+'''Permission to create thesaurus'''
+
+ADMIN_THESAURUS_PERMISSION = 'pyams.AdminThesaurus'
+'''Permission to administer all thesaurus properties'''
+
+MANAGE_THESAURUS_CONTENT_PERMISSION = 'pyams.ManageThesaurusContent'
+'''Permission to manage thesaurus contents'''
+
+MANAGE_THESAURUS_EXTRACT_PERMISSION = 'pyams.ManageThesaurusExtract'
+'''Permission to manage thesaurus extract contents'''