Skip to content
This repository

2.2 Moderation Bug - Public Page Gets Unpublished #977

Closed
mmansour opened this Issue August 31, 2011 · 11 comments

2 participants

mmansour Jonas Obrist
mmansour

Hi all -

Here is what I am experiencing:

A published and publicly visible page - the home page - becomes unpublished. This happens
when a user makes an edit and Saves (or just hits Save), with permissions of "Add" and "Change" to just the home page.

To recreate.

  1. settings.py

CMS_PUBLIC_FOR = 'all'
CMS_PERMISSION = True
CMS_MODERATOR = True
--(run required command: cms moderator on)

2: Users(Page)
--- Create user with only "Add" and "Change" page permissions
--- Only give this user permissions to edit the home page

3: Login in as that user. Go to the home page in admin. Press "Save". (You don't
need to make a change for the bug to happen. just press "Save"). And you
see the home page is marked as unpublished.

  1. Logout of admin. See that your home page is missing from the the
    public all together. It's not in the nav. And the second page underneath
    became the new home page.

  2. Login back in as super user, see that the second page just under
    the home page is now marked with the tree symbol, as the new home
    page. The original first homepage has to be republished to go live.

Jonas Obrist
Collaborator

does this only happen on home pages or all pages?

mmansour

After more testing I am able to reproduce on all pages.

Jonas Obrist
Collaborator

can you confirm this only happening the first time an underprivileged admin saves the page? If a superuser later publishes it, the other admin can no longer accidentally unpublish it. At least that was the behavior I experienced

Jonas Obrist
Collaborator

I can confirm following behavior (admin with rights as described in OT):

1: superuser creates page (public)
2: admin saves the page
3: page is unpublished
4: superuser publishes page (again)
5: page is published
6: admin saves page
7: page is still published (expected behavior)

The different workflow internally is that line 324 (elif not self.requires_approvement()) triggers in 2, but not in 6. This sets the moderator state to 'MODERATOR_NEED_APPROVEMENT' in the first case, not in the second.

Jonas Obrist
Collaborator

actually those findings were wrong

I now get consistent unpublishing.

The culprit seems to be 370-372 and not what I linked above (see https://github.com/divio/django-cms/blob/develop/cms/models/pagemodel.py#L370-372)

Jonas Obrist
Collaborator

Okay removing those lines solves this issue.

No clue about possible side effects though.

Pull request: #982
Patch: https://github.com/divio/django-cms/pull/982.patch

PLEASE TEST!

mmansour

On my end any page becomes unpublished every time an underprivileged admin saves the page. So not just the first time the underprivileged admin saves the page.

mmansour

That worked. I tested the removal of lines 370-372. I can confirm that a page no longer becomes unpublished upon save by underprivileged admin. Thanks.

Jonas Obrist
Collaborator

the big question is, does it have any negative side effects?

Jonas Obrist
Collaborator

fixed in 5f3c331

Jonas Obrist ojii closed this September 02, 2011
mmansour

"the big question is, does it have any negative side effects?"

I know! Unless that was accidentally left over legacy code I imagine it served some purpose. Moderation is important for the client I am working with, so I will continue to test that and the rest of 2.2 thoroughly, and report back any strange findings. I am learning django-cms at the same time so it's a slow process on my end.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.