All hail testing! I was trying to fix some failing tests and found that two of them are failing because of an actual bug. When you try to visit the blog of a user who has permission to create blog posts, but hasn't started their blog yet, you get a 403 error. There's existing logic to display a much friendlier message along the lines of "this user hasn't created any blog posts yet" but it's being bypassed by a somewhat overzealous access check.

CommentFileSizeAuthor
#2 blog.patch1.58 KBdesbeers
#1 259496_access_fix.patch3.85 KBksenzee

Comments

ksenzee’s picture

Status: Active » Needs review
StatusFileSize
new3.85 KB

Here's a patch. It looks more involved than it actually is because it moves a bunch of code into an if clause. This patch fixes two of the eight blog.module tests that currently fail.

desbeers’s picture

Title: Inappropriate 403 errors when a user has no blog posts » Blog has incorrect permission naming so test will fail.
StatusFileSize
new1.58 KB

Confirmed the problem but found that the problem was that the ‘create blog entries’ was renamed to ‘create blog content’.

As a side result, on the users own blog page, it always said ''You are not allowed to post a new blog entry.' in depended of the permission set or not.

Attached the patch that correct the permission name in two places and now the blog.module will pass all tests.

boombatower’s picture

Status: Needs review » Reviewed & tested by the community

The tests found a bug!

Confirmed this patch fixes the bug and the tests pass.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks folks.

damien tournoud’s picture

Version: 7.x-dev » 6.x-dev
Status: Fixed » Reviewed & tested by the community

I guess this needs to be backported to Drupal 6. The patch applies there (with some benign fuzz).

desbeers’s picture

Status: Reviewed & tested by the community » Fixed

Np, in D6 the permission is still named 'create blog entries'; so correct. It was changed in #30984

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.