# HG changeset patch # User Thierry Florac # Date 1499852454 -7200 # Node ID 3af8f6523bb004348f81bedb76be8cc0e91bd02e # Parent 451bb2fab7d4718a3847e4a249db37f861520bbc Add constants for role names diff -r 451bb2fab7d4 -r 3af8f6523bb0 src/pyams_content/__init__.py --- a/src/pyams_content/__init__.py Wed Jun 28 14:22:34 2017 +0200 +++ b/src/pyams_content/__init__.py Wed Jul 12 11:40:54 2017 +0200 @@ -25,6 +25,8 @@ from pyams_content.interfaces import MANAGE_SITE_ROOT_PERMISSION, MANAGE_SITE_PERMISSION, MANAGE_TOOL_PERMISSION, \ CREATE_CONTENT_PERMISSION, MANAGE_CONTENT_PERMISSION, COMMENT_CONTENT_PERMISSION, PUBLISH_CONTENT_PERMISSION + from pyams_content.interfaces import WEBMASTER_ROLE, PILOT_ROLE, MANAGER_ROLE, OWNER_ROLE, CONTRIBUTOR_ROLE, \ + READER_ROLE, OPERATOR_ROLE, GUEST_ROLE from pyams_utils.interfaces import PUBLIC_PERMISSION, VIEW_PERMISSION, MANAGE_PERMISSION, \ VIEW_SYSTEM_PERMISSION, MANAGE_SECURITY_PERMISSION, MANAGE_ROLES_PERMISSION @@ -45,7 +47,7 @@ 'title': _("Publish content")}) # register custom roles - config.register_role({'id': 'pyams.Webmaster', + config.register_role({'id': WEBMASTER_ROLE, 'title': _("Webmaster (role)"), 'permissions': {PUBLIC_PERMISSION, VIEW_PERMISSION, MANAGE_PERMISSION, VIEW_SYSTEM_PERMISSION, MANAGE_SECURITY_PERMISSION, MANAGE_ROLES_PERMISSION, @@ -53,7 +55,7 @@ CREATE_CONTENT_PERMISSION, MANAGE_CONTENT_PERMISSION, COMMENT_CONTENT_PERMISSION, PUBLISH_CONTENT_PERMISSION}, 'managers': {'system:admin', 'role:system.Manager', 'role:pyams.Webmaster'}}) - config.register_role({'id': 'pyams.Pilot', + config.register_role({'id': PILOT_ROLE, 'title': _("Pilot (role)"), 'permissions': {PUBLIC_PERMISSION, VIEW_PERMISSION, MANAGE_PERMISSION, VIEW_SYSTEM_PERMISSION, MANAGE_ROLES_PERMISSION, @@ -61,19 +63,19 @@ MANAGE_CONTENT_PERMISSION, COMMENT_CONTENT_PERMISSION, PUBLISH_CONTENT_PERMISSION}, 'managers': {'system:admin', 'role:system.Manager', 'role:pyams.Webmaster'}}) - config.register_role({'id': 'pyams.Manager', + config.register_role({'id': MANAGER_ROLE, 'title': _("Manager (role)"), 'permissions': {PUBLIC_PERMISSION, VIEW_PERMISSION, MANAGE_PERMISSION, VIEW_SYSTEM_PERMISSION, MANAGE_CONTENT_PERMISSION, COMMENT_CONTENT_PERMISSION, PUBLISH_CONTENT_PERMISSION}, 'managers': {'system:admin', 'role:system.Manager', 'role:pyams.Webmaster', 'role:pyams.Pilot'}}) - config.register_role({'id': 'pyams.Owner', + config.register_role({'id': OWNER_ROLE, 'title': _("Creator (role)"), 'permissions': {PUBLIC_PERMISSION, VIEW_PERMISSION, MANAGE_PERMISSION, VIEW_SYSTEM_PERMISSION, MANAGE_ROLES_PERMISSION, MANAGE_CONTENT_PERMISSION, COMMENT_CONTENT_PERMISSION}}) - config.register_role({'id': 'pyams.Contributor', + config.register_role({'id': CONTRIBUTOR_ROLE, 'title': _("Contributor (role)"), 'permissions': {PUBLIC_PERMISSION, VIEW_PERMISSION, MANAGE_PERMISSION, VIEW_SYSTEM_PERMISSION, @@ -81,17 +83,17 @@ COMMENT_CONTENT_PERMISSION}, 'managers': {'system:admin', 'role:system.Manager', 'role:pyams.Webmaster', 'role:pyams.Pilot', 'role:pyams.Owner'}}) - config.register_role({'id': 'pyams.Reader', + config.register_role({'id': READER_ROLE, 'title': _("Reader (role)"), 'permissions': {PUBLIC_PERMISSION, VIEW_PERMISSION, MANAGE_PERMISSION, VIEW_SYSTEM_PERMISSION, COMMENT_CONTENT_PERMISSION}, 'managers': {'system:admin', 'role:system.Manager', 'role:pyams.Webmaster', 'role:pyams.Pilot', 'role:pyams.Manager', 'role:pyams.Contributor'}}) - config.register_role({'id': 'pyams.Operator', + config.register_role({'id': OPERATOR_ROLE, 'title': _("Operator (role)"), 'permissions': {PUBLIC_PERMISSION, VIEW_PERMISSION, VIEW_SYSTEM_PERMISSION}, 'managers': {'system:admin', 'role:system.Manager'}}) - config.register_role({'id': 'pyams.Guest', + config.register_role({'id': GUEST_ROLE, 'title': _("Guest user (role)"), 'permissions': {PUBLIC_PERMISSION, VIEW_PERMISSION}, 'managers': {'system:admin', 'role:system.Manager', 'role:pyams.Webmaster', diff -r 451bb2fab7d4 -r 3af8f6523bb0 src/pyams_content/interfaces/__init__.py --- a/src/pyams_content/interfaces/__init__.py Wed Jun 28 14:22:34 2017 +0200 +++ b/src/pyams_content/interfaces/__init__.py Wed Jul 12 11:40:54 2017 +0200 @@ -57,6 +57,35 @@ # +# Custom roles +# + +WEBMASTER_ROLE = 'pyams.Webmaster' +'''Webmaster role has all permissions on all contents''' + +PILOT_ROLE = 'pyams.Pilot' +'''Pilot role is allowed to manage tools configuration and permissions''' + +MANAGER_ROLE = 'pyams.Manager' +'''Manager role is allowed to manage contents workflow''' + +OWNER_ROLE = 'pyams.Owner' +'''Content owner role is allowed to manage content properties until publication''' + +CONTRIBUTOR_ROLE = 'pyams.Contributor' +'''Contributor role is allowed to create new contents''' + +READER_ROLE = 'pyams.Reader' +'''Reader role is allowed to read and comment contents while still in draft state''' + +OPERATOR_ROLE = 'pyams.Operator' +'''Operator role is allowed to access management interface''' + +GUEST_ROLE = 'pyams.Guest' +'''Guest role is allowed to view contents''' + + +# # Base content interfaces #