def METHOD_NAME(self, model_id, user=current_user):
    """Get a database object with permission check enforced.
    Args:
        model_id: The integer ID of the model to get.
        user: User (instance of timesketch.models.user.User)
    Returns:
        A BaseQuery instance.
    """
    result_obj = self.get(model_id)
    if not result_obj:
        abort(HTTP_STATUS_CODE_NOT_FOUND)
    try:
        if result_obj.get_status.status == "deleted":
            abort(HTTP_STATUS_CODE_NOT_FOUND)
    except AttributeError:
        pass
    if result_obj.is_public:
        return result_obj
    if not result_obj.has_permission(user=user, permission="read"):
        abort(HTTP_STATUS_CODE_FORBIDDEN)
    return result_obj