Changeset 1733 in products


Ignore:
Timestamp:
Feb 15, 2010 1:29:24 PM (14 years ago)
Author:
kroman0
Message:

Fixed plone.org #2 'Disabling comments for anonymous also disables for Authenticated'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.plonecomments/trunk/quintagroup/plonecomments/utils.py

    r1717 r1733  
    2323 
    2424def setAnonymCommenting(context, allow=False): 
     25    roles = [r['name'] 
     26             for r in portal.rolesOfPermission('Reply to item') 
     27             if r['selected']] 
    2528    portal = getToolByName(context, 'portal_url').getPortalObject() 
    2629    if allow: 
    27         portal.manage_permission('Reply to item', ['Anonymous','Manager','Member'], 1) 
     30        if not 'Anonymous' in roles: 
     31            roles.append('Anonymous') 
     32            portal.manage_permission('Reply to item', roles, 1) 
    2833    else: 
    29         portal.manage_permission('Reply to item', ['Manager','Member'], 1) 
     34        if 'Anonymous' in roles: 
     35            roles.remove('Anonymous') 
     36            portal.manage_permission('Reply to item', roles, 1) 
    3037 
    3138def manage_mails(reply, context, action): 
Note: See TracChangeset for help on using the changeset viewer.