コード例 #1
0
ファイル: __init__.py プロジェクト: plone/plone.server
def get_principals_with_access_content(obj, request=None):
    if obj is None:
        return {}
    if request is None:
        request = get_current_request()
    interaction = IInteraction(request)
    roles = interaction.cached_roles(obj, 'plone.AccessContent', 'o')
    result = []
    for r in roles.keys():
        lroles = role.local_roles()
        if r in lroles:
            result.append(r)
    users = interaction.cached_principals(obj, result, 'plone.AccessContent', 'o')
    return list(users.keys())
コード例 #2
0
ファイル: __init__.py プロジェクト: plone/plone.server
def get_roles_with_access_content(obj, request=None):
    """ Return the roles that has access to the content that are global roles"""
    if obj is None:
        return []
    if request is None:
        request = get_current_request()
    interaction = IInteraction(request)
    roles = interaction.cached_roles(obj, 'plone.AccessContent', 'o')
    result = []
    for r in roles.keys():
        lroles = role.global_roles()
        if r in lroles:
            result.append(r)
    return result