Comments

Bastlynn’s picture

At the moment that isn't an exportable feature, once we get a few more things backported from 7.x to 6 - I'll pick this up as the next thing to export. (Unless someone else works up a patch first, in which case it'll go in sooner. )

jpoesen’s picture

Status: Active » Needs review
StatusFileSize
new5.81 KB

I've added tentative Features support for workflow_access. Appears to be working well in a current staging->production environment we set up for a client.

Note: This is my first Features integration code.
Comments always welcome.

flyingkiki’s picture

Update patch in comment #2 for below purpose:
The exported workflow_access configuration references roles by rid which leads to wrong roles configuration when imported the features

Modification: use role_name to configure the mapping.

Volx’s picture

I can confirm, that the patch works as intended, thanks!

One more thing I would like to see for better usability is that when adding a workflow to a feature and this workflow uses workflow_access, then the workflow_access feature item should be added automatically.

Volx’s picture

Unfortunately I have to revoke my confirmation, the access rules for the author are missing. That's because the sql select to get all access rules joins the role table and the author is not a role, so we need special handling for the author. I changed the select to use a left join so it also picks up entries that do not have a corresponding role, to be safe I added a check if the rid is either a valid role id or -1 (i.e. the author "role"). Since the select will not return a role name for the author, WORKFLOW_FEATURES_AUTHOR_NAME is used when rid is null. On rebuild WORKFLOW_FEATURES_AUTHOR_NAME is replaced with -1.

As far as I can tell (it's getting pretty late :) ) this is working for me now.

bladedu’s picture

Using the patch #5 I get a notice error:

Use of undefined constant WORKFLOW_FEATURES_AUTHOR_NAME - assumed 'WORKFLOW_FEATURES_AUTHOR_NAME' in workflow_access_get_features_workflow_access_by_sid() (line 126 of /workflow/workflow_access/workflow_access.features.inc).

apart from that, it works.

bladedu’s picture

This patch (which is a fix of patch #5) should fix the problem.

nancydru’s picture

Status: Needs review » Needs work

There is no workflow_access/workflow_access.features.inc in my current code.

fgm’s picture

That file is introduced by the patch itself. The logic inherent in using that constant for its string value does not seem to be correct, though.

There is a deeper problem: this export uses the workflow state sid, but there is no guarantee that they will be correct: indeed, once one deletes a given workflow or even just one of its states, this export cannot restore the WF access because the sids used are no longer available. WF access export needs to use the state state instead of its sid.

fgm’s picture

Assigned: Unassigned » fgm

Working on redoing it with names instead of ids. Will probably involve a new dependency on EntityAPI and a schema change.

nancydru’s picture

Thanks, Frederic.

fgm’s picture

Assigned: fgm » Unassigned
Status: Needs work » Needs review
StatusFileSize
new7.24 KB

Seems to work, but needs tests and review.

It could also probably be made rather faster, but the workflow API is showing its age: it really needs to be overhauled on top of Entity API, but that will be for a major version, I guess.

fgm’s picture

Rerolled against latest 7.x-1.x HEAD: previous version no longer applied.

nancydru’s picture

I'd like to get my UI changes committed before I apply this. But many thanks for the patch.

fgm’s picture

Just ask if you need it to be rerolled.

fgm’s picture

Component: Miscellaneous » Workflow Access: Code

Changing component.

fgm’s picture

StatusFileSize
new2.08 KB

Another patch (0002.....) to apply only once the previous one has been merged: workflow_access instances depend on their respective workflow.

And yet another to apply on top of the previous two (0003...): workflow access needs the roles used in the export to exist.

fgm’s picture

Whoop, looks like the 0002... patch didn't make it.

nancydru’s picture

Status: Needs review » Fixed

Committed with attribution

nancydru’s picture

Status: Fixed » Closed (fixed)

Included in 7.x-1.1-rc1

supercone’s picture

Issue summary: View changes

Patch for this issue, is it already part of the recent version both full and dev releases?

Because when I exported the workflow, I didn't see any indication of workflow 'access' being part of the export code.
I had manually update the workflow 'access' settings again once I did workflow export.

supercone’s picture

Status: Closed (fixed) » Needs work
johnv’s picture

Status: Needs work » Closed (outdated)

@supercone, this is a very old issue. Version 7.x-1.x is not supported. All new features are in 7.x--2.x