Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User with appropriate permissions can not cancel workflow task. #11795

Open
Rycerzyk opened this issue Mar 25, 2024 · 0 comments
Open

User with appropriate permissions can not cancel workflow task. #11795

Rycerzyk opened this issue Mar 25, 2024 · 0 comments
Labels
status:Unconfirmed Issue, usually a bug, that has not yet been validated as a confirmed problem. type:Bug

Comments

@Rycerzyk
Copy link

Issue Summary

User with appropriate permissions can not cancel workflow task.

In the method user_can_cancel of WorkflowState class there is a check if user is in appropriate group:

and "approve"
            in [
                action[0]
                for action in self.current_task_state.task.get_actions(
                    self.content_object, user
                )
            ]

But self.current_task_state.task is an instance of Task and not GroupApprovalTask so get_actions that is run looks like this:

def get_actions(self, obj, user):
        """
        Get the list of action strings (name, verbose_name, whether the action requires additional data - see
        ``get_form_for_action``) for actions the current user can perform for this task on the given object.
        These strings should be the same as those able to be passed to ``on_action``
        """
        return []

I propose to fix that issue by in user_can_cancel change self.current_task_state.task.get_actions(...) to self.current_task_state.task.specific.get_actions(...)

Steps to Reproduce

  1. configure workflow with a group selected in a task
  2. create a new object that this task is associated with
  3. login as another user that is in the group associated with the task (or is a superuser)
  4. go to edit page of the object created in step 2
  5. expand the list of available actions at the bottom of the page and gasp in horror that you do not see same buttons as user that created the object.

Technical details

  • Python version: 3.11.2
  • Django version: 4.1
  • Wagtail version: 5.2.3
  • Browser version: Firefox 122

Working on this

Anyone can contribute to this. View our contributing guidelines, add a comment to the issue once you’re ready to start.

@Rycerzyk Rycerzyk added status:Unconfirmed Issue, usually a bug, that has not yet been validated as a confirmed problem. type:Bug labels Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:Unconfirmed Issue, usually a bug, that has not yet been validated as a confirmed problem. type:Bug
Projects
None yet
Development

No branches or pull requests

1 participant