Last change
on this file since 2111 was
1,
checked in by myroslav, 19 years ago
|
Building directory structure
|
-
Property svn:eol-style set to
native
|
File size:
1.1 KB
|
Line | |
---|
1 | from Acquisition import aq_inner |
---|
2 | from AccessControl import getSecurityManager |
---|
3 | from Products.CMFPlone.utils import getToolByName |
---|
4 | |
---|
5 | from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile |
---|
6 | from plone.app.layout.viewlets import comments |
---|
7 | |
---|
8 | class CommentsViewlet(comments.CommentsViewlet): |
---|
9 | """A custom version of the comments viewlet |
---|
10 | """ |
---|
11 | |
---|
12 | render = ViewPageTemplateFile('comments.pt') |
---|
13 | |
---|
14 | def is_moderation_enabled(self): |
---|
15 | """ Returns a boolean indicating whether the user has enabled moderation |
---|
16 | in the qPloneComments configlet |
---|
17 | """ |
---|
18 | portal_properties = getToolByName(self.context, 'portal_properties') |
---|
19 | try: |
---|
20 | return portal_properties.qPloneComments.getProperty('enable_moderation', None) |
---|
21 | except AttributeError: |
---|
22 | return False |
---|
23 | |
---|
24 | def can_moderate(self): |
---|
25 | """ Returns a boolean indicating whether the user has the 'Moderate Discussion' |
---|
26 | permission |
---|
27 | """ |
---|
28 | return getSecurityManager().checkPermission('Moderate Discussion', aq_inner(self.context)) |
---|
Note: See
TracBrowser
for help on using the repository browser.