--- a/src/pyams_content/shared/common/interfaces/__init__.py Tue Oct 01 08:31:43 2019 +0200
+++ b/src/pyams_content/shared/common/interfaces/__init__.py Tue Oct 01 12:04:20 2019 +0200
@@ -38,29 +38,33 @@
"""Shared tool roles interface"""
webmasters = PrincipalsSet(title=_("Webmasters"),
- description=_("Webmasters can handle all contents, including published ones"),
+ description=_("Webmasters can handle all contents, including "
+ "published ones"),
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"),
+ description=_("Pilots can handle tool configuration, manage access "
+ "rules, grant users roles and manage managers "
+ "restrictions"),
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"),
+ description=_("Managers can handle main operations in tool's "
+ "workflow, like publish or retire contents"),
role_id=MANAGER_ROLE,
required=False)
contributors = PrincipalsSet(title=_("Contributors"),
- description=_("Contributors are users which are allowed to create new contents"),
+ description=_("Contributors are users which are allowed to "
+ "create new contents"),
role_id=CONTRIBUTOR_ROLE,
required=False)
designers = PrincipalsSet(title=_("Designers"),
- description=_("Designers are users which are allowed to manage presentation templates"),
+ description=_("Designers are users which are allowed to manage "
+ "presentation templates"),
role_id=DESIGNER_ROLE,
required=False)
@@ -83,11 +87,12 @@
containers(ISharedToolContainer)
- shared_content_menu = Attribute("Boolean flag indicating if tool is displayed into 'Shared contents' or "
- "Shared tools' menu")
+ shared_content_menu = Attribute("Boolean flag indicating if tool is displayed into 'Shared "
+ "contents' or Shared tools' menu")
shared_content_workflow = Choice(title=_("Workflow name"),
- description=_("Name of workflow utility used to manage tool contents"),
+ description=_("Name of workflow utility used to manage tool "
+ "contents"),
vocabulary="PyAMS workflows",
default="PyAMS default workflow")
@@ -119,12 +124,14 @@
content_name = Attribute("Content name")
content_url = TextLine(title=_("Content URL"),
- description=_("URL used to access this content; this is important for SEO and "
- "should include most important words describing content; spaces and "
- "underscores will be automatically replaced by hyphens"),
+ description=_("URL used to access this content; this is important for "
+ "SEO and should include most important words describing "
+ "content; spaces and underscores will be automatically "
+ "replaced by hyphens"),
required=True)
- handle_content_url = Attribute("Static boolean value to specify if content URL is supported by this content type")
+ handle_content_url = Attribute("Static boolean value to specify if content URL is supported by "
+ "this content type")
creator = Principal(title=_("Version creator"),
description=_("Name of content's version creator. "
@@ -154,15 +161,19 @@
description=_("Content's header is generally displayed in page header"),
required=False)
- handle_header = Attribute("Static boolean value to specify if header is supported by this content type")
+ handle_header = Attribute("Static boolean value to specify if header is supported by this "
+ "content type")
description = I18nTextField(title=_("Meta-description"),
- description=_("The content's description is 'hidden' into HTML's page headers; but it "
- "can be seen, for example, in some search engines results as content's "
- "description; if description is empty, content's header will be used."),
+ description=_("The content's description is 'hidden' into HTML's "
+ "page headers; but it can be seen, for example, in "
+ "some search engines results as content's "
+ "description; if description is empty, content's "
+ "header will be used."),
required=False)
- handle_description = Attribute("Static boolean value to specify if description is supported by this content type")
+ handle_description = Attribute("Static boolean value to specify if description is supported by "
+ "this content type")
keywords = TextLineListField(title=_("Keywords"),
description=_("They will be included into HTML pages metadata"),
@@ -189,37 +200,39 @@
"""Shared content roles"""
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"),
+ description=_("The owner is the creator of content's first version, "
+ "except if it was transferred afterwards to another 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"),
+ description=_("Managers can handle main operations in tool's "
+ "workflow, like publish or retire contents"),
role_id=MANAGER_ROLE,
required=False)
contributors = PrincipalsSet(title=_("Contributors"),
- description=_("Contributors are users which are allowed to update this content in "
- "addition to it's owner"),
+ description=_("Contributors are users which are allowed to update "
+ "this content in addition to it's owner"),
role_id=CONTRIBUTOR_ROLE,
required=False)
designers = PrincipalsSet(title=_("Designers"),
- description=_("Designers are users which are allowed to manage presentation templates"),
+ description=_("Designers are users which are allowed to manage "
+ "presentation templates"),
role_id=DESIGNER_ROLE,
required=False)
readers = PrincipalsSet(title=_("Readers"),
- description=_("Readers are users which are asked to verify and comment contents before "
- "they are published"),
+ description=_("Readers are users which are asked to verify and comment "
+ "contents before they are published"),
role_id=READER_ROLE,
required=False)
guests = PrincipalsSet(title=_("Guests"),
- description=_("Guests are users which are allowed to view contents with restricted access"),
+ description=_("Guests are users which are allowed to view contents "
+ "with restricted access"),
role_id=GUEST_ROLE,
required=False)
@@ -286,11 +299,19 @@
"""Shared content contributor restrictions"""
publication_checks = Bool(title=_("Publication checks"),
- description=_("If 'yes', this contributor will have to confirm that contents have "
- "been previewed and checked before asking for publication"),
+ description=_("If 'yes', this contributor will have to confirm that "
+ "contents have been previewed and checked before "
+ "asking for publication"),
required=False,
default=True)
+ owners = PrincipalsSet(title=_("Substitute for"),
+ description=_("Contributor will have access to contents owned by these "
+ "principals"))
+
+ def check_access(self, context, permission=MANAGE_CONTENT_PERMISSION, request=None):
+ """Check if principal is granted access to given context"""
+
class IContributorRestrictions(IRestrictions):
"""Contributor restrictions interface"""
@@ -311,19 +332,21 @@
"""Shared content manager restrictions"""
publication_checks = Bool(title=_("Publication checks"),
- description=_("If 'yes', this manager will have to confirm that contents have "
- "been previewed and checked before publishing a content"),
+ description=_("If 'yes', this manager will have to confirm that "
+ "contents have been previewed and checked before "
+ "publishing a content"),
required=False,
default=True)
restricted_contents = Bool(title=_("Restricted contents"),
- description=_("If 'yes', this manager will get restricted access to manage contents "
- "based on selected settings"),
+ description=_("If 'yes', this manager will get restricted access "
+ "to manage contents based on selected settings"),
required=False,
default=True)
owners = PrincipalsSet(title=_("Selected owners"),
- description=_("Manager will have access to contents owned by these principals"),
+ description=_("Manager will have access to contents owned by these "
+ "principals"),
required=False)
def check_access(self, context, permission=MANAGE_CONTENT_PERMISSION, request=None):