I'm running into scenarios where anonymous users might create a new workflow state, but do not have permission to cause transition state changes. Therefore, they do not have any options, as stated in workflow-7.x-1.x-dev:

            // @TODO: Some users, like anonymous, may not be allowed
            // to cause transitions, so there will be no choices.
            $keys = array_keys($choices);

I am running migrations via drush, and my current workaround is to supply drush an authenticated --user argument. Any advice for a workflow patch, to get rid of this @TODO?

CommentFileSizeAuthor
#9 1976840.patch2.13 KBnancydru
#7 1976840.patch1.12 KBnancydru
#6 1976840.patch706 bytesnancydru

Comments

nancydru’s picture

I'm not clear on your point here. If anonymous users can create a node, then that user is "author" and must be allowed to transition to at least one state (usually the first one).

I will look at that note and see if I can remember why I put it there.

nancydru’s picture

Well, it's no longer there in my code. How long ago did you download?

bdone’s picture

I'm seeing it on line 47 of workflow.tokens.inc using 7.x-1.x (HEAD).

nancydru’s picture

Ah, that 'splains it.

So, please explain the situation so a blond (me) can understand it. I allowed an anonymous user to create a node and it flowed through with no problem.

bdone’s picture

Regarding #1, I'm setting node authors programmatically during migration, and running the migration as anonymous (via drush). So in that case, maybe an edge case admittedly, i can't depend on the global $user in workflow_field_choices().

nancydru’s picture

Status: Active » Needs review
StatusFileSize
new706 bytes

Please test if this patch solves your issue.

nancydru’s picture

StatusFileSize
new1.12 KB

Oops, missed some

bdone’s picture

not having any luck with patch in #7. drush errors that migrate captures come from workflow.tokens.inc:

<em class="placeholder">MigrateException</em>: array_keys() expects parameter 1 to be array, boolean given                                                                                                                             [error]
File .../workflow/workflow.tokens.inc, line 49 in <em class="placeholder">MigrationBase-&gt;errorHandler()</em> (line <em class="placeholder">570</em> of <em
class="placeholder">.../sites/all/modules/contrib/migrate/includes/base.inc</em>).

i'll continue debugging.

nancydru’s picture

StatusFileSize
new2.13 KB

Could you give this a try, please?

nancydru’s picture

Status: Needs review » Fixed

committed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.