Role Permissions revert on bench migrate

Hi - I’m having an issue where a bench migrate isn’t saving the changes I’ve made to Role Permissions Manager.

I’ve checked Custom DocPerm, and I can see the correct permissions in that list.

I have also checked the fixtures > custom_docperm.json, and can see the role and permissions in there too…

Before the migrate, I’m running bench export-fixtures, however they’re just not saving for some reason.

Here’s the fixtures definition in my custom app’s file:

fixtures = ['Custom Field', 'Property Setter', 'Custom DocPerm']

Any help or tips would be greatly appreciated!

Giving this a bump. Any help in resolving this would be really appreciated.

Hi @Shaun

There are many bugs and inconsistencies when it comes to Permissions.
Firstly, there are 2 different ways of defining Role Permissions,
1 In DocType > Settings > Permission Rules
2 In Role Permissions Manager
But, beware of this caveat, especially if you reference a custom Role Profile: Both are independent of one-another, ie a Permission set in the DocType does not reflect in the Role Permissions Manager, and vise versa.

However, I cannot for the life in me figure out which is ultimately in effect since it seems to depend on various conditions such as:
Is the DocType a custom doctype defined with Custom? : Y or N. If N, then the DocType definition is part of the app’s file collection on the File System. If Y, then the DocType definition is in the Database.

I normally only export fixtures for definitions in the Database, since any definition on the file system will migrate just fine.

I’d love to hear what you’ve learned about these inconsistencies and whether we can put heads together to figure out how this works.

It is simply beyond frustrating :hot_face:

Hi @EugeneP, thanks for getting back to me.

It is frustrating indeed.

The only solution I have found for the Role Permissions Manager problem is this:

  1. Add a new role permission for doctype x
  2. Go to “Customize Form” (for doctype x)
  3. Actions > Export Customizations > choose your app > check export permissions & sync on migrate

This is the only way I’ve been able to get role permissions to stick through migrations.

If anyone knows a better way to do this, please tell.

Kind regards,