def METHOD_NAME(action, request):
    if action == "all":
        _actions = Action.objects.filter(public=True)[:100]
    else:
        _actions = Action.objects.filter(public=True, action_object_content_type__model=action)[:100]
    _filtered_actions = []
    for _action in _actions:
        if _action.target_object_id:
            action_object_filter = {"id": _action.target_object_id}
        elif _action.action_object_object_id:
            action_object_filter = {"id": _action.action_object_object_id}
        try:
            obj = get_object_or_404(ResourceBase, **action_object_filter)
            resource = obj.get_self_resource()
            user = request.user
            if user.has_perm("base.view_resourcebase", resource) or user.has_perm(
                "view_resourcebase", resource
            ):
                _filtered_actions.append(_action.id)
        except ResourceBase.DoesNotExist:
            _filtered_actions.append(_action.id)
        except (PermissionDenied, Exception) as e:
            logger.debug(e)
    return _filtered_actions