src/pyams_thesaurus/__init__.py
changeset 0 47700a43ef3f
child 4 5dc0c1fa6af6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_thesaurus/__init__.py	Tue Apr 14 17:52:05 2015 +0200
@@ -0,0 +1,44 @@
+#
+# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+
+__docformat__ = 'restructuredtext'
+
+
+from pyramid.i18n import TranslationStringFactory
+_ = TranslationStringFactory('pyams_thesaurus')
+
+
+def includeme(config):
+    """Pyramid include"""
+
+    from .include import include_package
+    include_package(config)
+
+    # register custom permissions
+    config.register_permission({'id': 'thesaurus.admin',
+                                'title': _("Manage thesaurus properties")})
+    config.register_permission({'id': 'thesaurus.manage',
+                                'title': _("Manage thesaurus content")})
+    config.register_permission({'id': 'thesaurus.extract.manage',
+                                'title': _("Manage thesaurus extract")})
+
+    # register custom roles
+    config.register_role({'id': 'thesaurus.Admin',
+                          'title': "Thesaurus administrator (role)",
+                          'permissions': {'thesaurus.admin', 'thesaurus.manage', 'thesaurus.extract.manage',
+                                          'view', 'system.view'}})
+    config.register_role({'id': 'thesaurus.Manager',
+                          'title': "Thesaurus content manager (role)",
+                          'permissions': {'thesaurus.manage', 'thesaurus.extract.manage', 'view', 'system.view'}})
+    config.register_role({'id': 'thesaurus.ExtractManager',
+                          'title': "Thesaurus extract manager (role)",
+                          'permissions': {'thesaurus.extract.manage', 'view', 'system.view'}})