def can_edit_post(self, post, user):
        checker = self._get_checker(user)

        # A user can edit a post if...
        #     he is a superuser
        #     he is the original poster of the forum post
        #     he belongs to the forum moderators
        is_author = self._is_post_author(post, user)
        can_edit = (user.is_superuser or
                    (is_author and checker.has_perm('can_edit_own_posts', post.topic.forum)) or
                    checker.has_perm('can_edit_posts', post.topic.forum))
        return can_edit
Given a forum post, checks whether the user can edit the latter.
dataset/ETHPy150Open ellmetha/django-machina/machina/apps/forum_permission/handler.py/PermissionHandler.can_edit_post