Exemplo n.º 1
0
def content_allowedRolesAndUsers(object):
    """Restrict allowedRolesAndUsers severely for a new version of an item"""
    parent = object
    while parent is not None:
        if ICheckedOut.providedBy(parent):
            pms = getToolByName(object, 'portal_membership')
            member = pms.getAuthenticatedMember()
            return ['user:%s' % member.getId()]
        parent = getattr(parent, 'aq_parent', None)

    return allowedRolesAndUsers(object)
Exemplo n.º 2
0
def content_allowedRolesAndUsers(object):
    """Restrict allowedRolesAndUsers severely for a new version of an item"""
    parent = object
    while parent is not None:    
        if ICheckedOut.providedBy(parent):
            pms = getToolByName(object, 'portal_membership')
            member = pms.getAuthenticatedMember()
            return ['user:%s' % member.getId()]
        parent = getattr(parent, 'aq_parent', None)

    return allowedRolesAndUsers(object)
Exemplo n.º 3
0
def patched_allowedRolesAndUsers(obj):
    """Return a list of roles and users with View permission.
    Used to filter out items you're not allowed to see.
    """
    results = allowedRolesAndUsers(obj)()
    allowed = {}
    tr_annotate = ITokenRolesAnnotate(obj, None)
    if tr_annotate and tr_annotate.token_dict:
        for token, data in tr_annotate.token_dict.items():
            if data['token_end'] < datetime.now():
                continue
            allowed['token:' + token] = 1

    results.extend(list(allowed.keys()))
    return results
 def index_allowedRolesAndUsers(self, obj):
     return allowedRolesAndUsers(obj)()
Exemplo n.º 5
0
def _allowed_roles_and_users(obj):
    from Products.CMFPlone.CatalogTool import allowedRolesAndUsers
    result = allowedRolesAndUsers(obj)()
    return ','.join(result) or None