Skip to content

Allow users with edit access to pages / snippets via workflows to access ping endpoint#12237

Merged
gasman merged 2 commits into
wagtail:mainfrom
gasman:fix/editing-session-ping-moderation
Aug 20, 2024
Merged

Allow users with edit access to pages / snippets via workflows to access ping endpoint#12237
gasman merged 2 commits into
wagtail:mainfrom
gasman:fix/editing-session-ping-moderation

Conversation

@gasman
Copy link
Copy Markdown
Contributor

@gasman gasman commented Aug 16, 2024

Fixes #12209

@gasman gasman added type:Bug Defects, errors, broken functionality, regressions, unexpected behavior, crashes component:Workflow Workflow system, approval processes, content review, publishing workflow, task assignments labels Aug 16, 2024
@gasman gasman added this to the 6.2.1 milestone Aug 16, 2024
@gasman gasman requested a review from laymonage August 16, 2024 11:24
@gasman gasman self-assigned this Aug 16, 2024
@squash-labs
Copy link
Copy Markdown

squash-labs Bot commented Aug 16, 2024

Manage this branch in Squash

Test this branch here: https://gasmanfixediting-session-ping-ycku5.squash.io

Copy link
Copy Markdown
Member

@laymonage laymonage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works as expected, looks good to me – thanks!

Comment on lines +38 to +48
can_edit = permission_policy.user_has_permission_for_instance(
request.user, "change", obj
)
if not can_edit and isinstance(obj, WorkflowMixin):
workflow = obj.get_workflow()
if workflow is not None:
current_workflow_task = obj.current_workflow_task
can_edit = (
current_workflow_task
and current_workflow_task.user_can_access_editor(obj, request.user)
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose an alternative is to include this logic directly in ModelPermissionPolicy.user_has_permission_for_instance(), and reuse it for the edit view, but at this point I think it's better to wait for wagtail/rfcs#102.

gasman added a commit that referenced this pull request Aug 20, 2024
@gasman gasman merged commit a7d243b into wagtail:main Aug 20, 2024
gasman added a commit that referenced this pull request Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:Workflow Workflow system, approval processes, content review, publishing workflow, task assignments type:Bug Defects, errors, broken functionality, regressions, unexpected behavior, crashes

Projects

No open projects
Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

404s for the editing sessions while in workflow

2 participants