--- a/src/pyams_content/shared/common/interfaces/__init__.py Mon Sep 11 14:45:39 2017 +0200
+++ b/src/pyams_content/shared/common/interfaces/__init__.py Mon Sep 11 14:46:24 2017 +0200
@@ -16,7 +16,8 @@
# import standard library
# import interfaces
-from pyams_content.interfaces import IBaseContent, MANAGE_CONTENT_PERMISSION
+from pyams_content.interfaces import IBaseContent, MANAGE_CONTENT_PERMISSION, OWNER_ROLE, MANAGER_ROLE, \
+ READER_ROLE, GUEST_ROLE, WEBMASTER_ROLE, PILOT_ROLE, CONTRIBUTOR_ROLE
from pyams_content.root.interfaces import ISiteRoot
from pyams_workflow.interfaces import IWorkflowManagedContent
from zope.container.interfaces import IContainer
@@ -65,24 +66,24 @@
webmasters = PrincipalsSet(title=_("Webmasters"),
description=_("Webmasters can handle all contents, including published ones"),
- role_id='pyams.Webmaster',
+ role_id=WEBMASTER_ROLE,
required=False)
pilots = PrincipalsSet(title=_("Pilots"),
description=_("Pilots can handle tool configuration, manage access rules, grant users "
"roles and manage managers restrictions"),
- role_id='pyams.Pilot',
+ role_id=PILOT_ROLE,
required=False)
managers = PrincipalsSet(title=_("Managers"),
description=_("Managers can handle main operations in tool's workflow, like publish "
"or retire contents"),
- role_id='pyams.Manager',
+ role_id=MANAGER_ROLE,
required=False)
contributors = PrincipalsSet(title=_("Contributors"),
description=_("Contributors are users which are allowed to create new contents"),
- role_id='pyams.Contributor',
+ role_id=CONTRIBUTOR_ROLE,
required=False)
@@ -137,14 +138,14 @@
owner = PrincipalsSet(title=_("Content owner"),
description=_("The owner is the creator of content's first version, except if it was "
"transferred afterwards to another owner"),
- role_id='pyams.Owner',
+ role_id=OWNER_ROLE,
required=True,
max_length=1)
managers = PrincipalsSet(title=_("Managers"),
description=_("Managers can handle main operations in tool's workflow, like publish "
"or retire contents"),
- role_id='pyams.Manager',
+ role_id=MANAGER_ROLE,
required=False)
contributors = PrincipalsSet(title=_("Contributors"),
@@ -156,12 +157,12 @@
readers = PrincipalsSet(title=_("Readers"),
description=_("Readers are users which are asked to verify and comment contents before "
"they are published"),
- role_id='pyams.Reader',
+ role_id=READER_ROLE,
required=False)
guests = PrincipalsSet(title=_("Guests"),
description=_("Guests are users which are allowed to view contents with restricted access"),
- role_id='pyams.Guest',
+ role_id=GUEST_ROLE,
required=False)
--- a/src/pyams_content/shared/common/review.py Mon Sep 11 14:45:39 2017 +0200
+++ b/src/pyams_content/shared/common/review.py Mon Sep 11 14:46:24 2017 +0200
@@ -19,6 +19,7 @@
from uuid import uuid4
# import interfaces
+from pyams_content.interfaces import READER_ROLE
from pyams_content.interfaces.review import IReviewManager, IReviewComment, IReviewComments, \
REVIEW_COMMENTS_ANNOTATION_KEY, CommentAddedEvent, ICommentAddedEvent
from pyams_content.shared.common.interfaces import IWfSharedContent, IWfSharedContentRoles
@@ -222,7 +223,7 @@
principals = set()
protection = IProtectedObject(context, None)
if protection is not None:
- principals |= protection.get_principals('pyams.Reader')
+ principals |= protection.get_principals(READER_ROLE)
comments = self.context.user_data.get('comments')
if comments is not None:
principals |= comments.reviewers