def get_object(self, queryset=None): post = super(EditPostView, self).get_object(queryset) if not perms.may_access_post(self.request, post): raise PermissionDenied if not perms.may_edit_post(self.request.user, post): raise PermissionDenied return post
def pybb_editable_by(post, user): """ Check if the post could be edited by the user. """ warnings.warn("pybb_editable_by filter is deprecated and will be removed in later releases. " "Use pybb_may_edit_post(user, post) filter instead", DeprecationWarning) return perms.may_edit_post(user, post)
def get_object(self, queryset=None): post = super(EditPostView, self).get_object(queryset) if not perms.may_edit_post(self.request.user, post): raise PermissionDenied return post
def pybb_editable_by(post, user): """ Check if the post could be edited by the user. """ return perms.may_edit_post(user, post)
def pybb_may_create_poll(post, user): """ Check if the user can create polls. """ return perms.may_edit_post(user)