Re-add the CommentsViewlet can_manage method. This method has been removed in version 1.0b9 and added again in 1.0b11 because we don't want to change the API in beta releases.
svn path=/plone.app.discussion/trunk/; revision=45110
This commit is contained in:
parent
a8616c1c87
commit
b95707ac52
@ -4,6 +4,11 @@ Changelog
|
||||
1.0b11 (unreleased)
|
||||
-------------------
|
||||
|
||||
- Re-add the CommentsViewlet can_manage method. This method has been removed
|
||||
in version 1.0b9 and added again in 1.0b11 because we don't want to change
|
||||
the API in beta releases.
|
||||
[timo]
|
||||
|
||||
- Declare z3c.form and zope.schema as minimum version dependencies in setup.py
|
||||
in case people use a different KGS.
|
||||
[timo]
|
||||
|
@ -255,6 +255,12 @@ class CommentsViewlet(ViewletBase):
|
||||
return getSecurityManager().checkPermission('Reply to item',
|
||||
aq_inner(self.context))
|
||||
|
||||
def can_manage(self):
|
||||
"""We keep this method for <= 1.0b9 backward compatibility. Since we do
|
||||
not want any API changes in beta releases.
|
||||
"""
|
||||
return self.can_review()
|
||||
|
||||
def can_review(self):
|
||||
"""Returns true if current user has the 'Review comments' permission.
|
||||
"""
|
||||
|
@ -216,7 +216,22 @@ class TestCommentsViewlet(PloneTestCase):
|
||||
self.portal.acl_users._doAddUser('reviewer', 'secret', ['Reviewer'], [])
|
||||
self.login('reviewer')
|
||||
self.failUnless(self.viewlet.can_review())
|
||||
|
||||
|
||||
def test_can_manage(self):
|
||||
"""We keep this method for backward compatibility. This method has been
|
||||
removed in version 1.0b9 and added again in 1.0b11 because we don't
|
||||
do API changes in beta releases.
|
||||
"""
|
||||
# Portal owner has 'can review' permission
|
||||
self.failUnless(self.viewlet.can_manage())
|
||||
self.logout()
|
||||
# Anonymous has no 'can review' permission
|
||||
self.failIf(self.viewlet.can_manage())
|
||||
# The reviewer role has the 'Review comments' permission
|
||||
self.portal.acl_users._doAddUser('reviewer', 'secret', ['Reviewer'], [])
|
||||
self.login('reviewer')
|
||||
self.failUnless(self.viewlet.can_manage())
|
||||
|
||||
def test_is_discussion_allowed(self):
|
||||
# By default, discussion is disabled
|
||||
self.failIf(self.viewlet.is_discussion_allowed())
|
||||
|
Loading…
Reference in New Issue
Block a user