Skipping Workflow WIth Permissions

Permalink
I've set up the basic workflow as per the tutorials, but we're having issues because even admins get the "submit to workflow button". How do I remove this and let certain groups skip the workflow altogether?

We have an "editors" group. I created a basic workflow and added that group to the "approve or deny" "set". I then attached that workflow to the "approve changes" permission.

I started by removing all other permissions. I don't think it's clear that, when a workflow is attached, the otherwise-standard permissions are still required in order "to enter the workflow". I edited a page with the user and they weren't able to submit to the workflow at all. Then I added "editors" and "authors" to "approve changes".

Now, when an editor makes a change, they get the "submit to workflow" button instead of "save page", as I'd expect for an "author". When an editor clicks that, the page reloads and they get "approve changes" dropdown. That's what I want to remove.

(This is on 5.6.12, but I don't see anything in the 5.6.2 changelog that might have addressed this.)

jshannon
 
jshannon replied on at Permalink Best Answer Reply
jshannon
For future reference... I spent some time going through the core code looking for either some hint of a setting, or some sort of event i could plug into. Unfortunately, I found neither, but I did find a pretty easy modification to make.

I wrappedhttps://github.com/concrete5/concrete5/blob/master/web/concrete/core... with an if statement, effectively replacing them with:

if ($this->canApproveWorkflowProgressObject($wp)) {
         $this->approve($wp);
      } else {
         // let's get all the people who are set to be notified on entry
         $message = t('On %s, user %s submitted the following request: %s', date(DATE_APP_GENERIC_MDYT_FULL, strtotime($wp->getWorkflowProgressDateAdded())), $ui->getUserName(), $req->getWorkflowRequestDescriptionObject()->getEmailDescription());
         $this->notify($wp, $message, 'notify_on_basic_workflow_entry');
      }


ie, if the user has approval permissions, then immediately approve, effectively skipping the workflow, but yet still providing some logging.
kirkroberts replied on at Permalink Reply
kirkroberts
Thanks for posting your solution to this.

I'm loathe to touch core files, but it makes sense that any workflow approvers, admins, or at least the superuser should be able to skip the workflow process.

Have you experienced any fallout from this approach?
jshannon replied on at Permalink Reply
jshannon
To be clear, you should be overriding the file as per the standard c5
method, and only overriding that particular function (which is thankfully
pretty light, and thus less likely to be changed in the future).

But, otherwise, no. I never ran into any problems with that approach.

James
Job replied on at Permalink Reply 1 Attachment
Job
Just wanted to say thanks for the solution jshannon, the prospect of my admins having to go through workflow for their own edits was a bug bare.

For anyone who wants it, I've attached the file which should be stored in:

/siteroot/models/workflow/types/basic.php

When you hover over Edit to save the page, it will still read "Submit to Workflow", but the actual effect is approving the workflow.

Maybe I'll look at overriding that this afternoon and come back.