Code review

Code review + one fix in the export_roles_permissions_grant_permissions(...) function.
We still need to make sure that the exported code creates missing roles if any (see TODO in the code).
do you really want to remove trim?