def METHOD_NAME(self, idea):
    request = self.context.get("request")
    if request and hasattr(request, "user"):
        user = request.user
        return user.has_perm("a4_candy_ideas.rate_idea", idea)
    return False