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())
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