If you create a feature that contains both the definition of a flag AND its permissions, you get the following error:

Warning in features rebuild of my_feature_name. No module defines 
permission "flag my_flag_name".
Warning in features rebuild of my_feature_name. No module defines 
permission "unflag my_flag_name".

Then when the feature is enabled, you have to revert it immediately to get the correct permissions to be added to the flag.

CommentFileSizeAuthor
#3 flag-permissions-2193947-03.patch415 bytesjhedstrom

Comments

joachim’s picture

I'm not really sure what we can do here.

How does it work when you export a node type & its permissions? Does Features do any sort of special handling to get around this problem in that case?

mariacha1’s picture

I'm not sure exactly, but I did see similar issues for other modules, so it might be a problem for a lot of entities.

Here's how it was solved for entityqueue:
https://drupal.org/node/1975512

And here's where the change was enabled to begin with:
https://drupal.org/node/1975512

jhedstrom’s picture

Status: Active » Needs review
StatusFileSize
new415 bytes

This issue tends to only happen when an install profile is being run via drush since static caches can persist for much longer than when an install occurs via the browser/batch system. Clearing the static cache from within hook_permission resolves this warning.

mariacha1’s picture

Status: Needs review » Reviewed & tested by the community

This works great for me and gets rid of warnings during install. Setting as RTBC.

joachim’s picture

Status: Reviewed & tested by the community » Fixed

Committed. Thanks!

git commit -m "Issue #2193947 by jhedstrom: Fixed errors and glitches when permissions for a flag are in the same feature as the flag export." --author="jhedstrom "

Status: Fixed » Closed (fixed)

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