Closed (fixed)
Project:
Role Export
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Oct 2011 at 08:53 UTC
Updated:
17 Nov 2011 at 16:50 UTC
Jump to comment: Most recent file
Comments
Comment #1
klausiAnd here is the patch. Displays a warning only after a role machine name has been changed. Maybe we should add a confirmation form when the machine name changes.
Comment #2
Steven Brown commentedSo if I understand this right. It sounds like the issue is if there is an existing role of "Blog Admin" and someone installs a Blog feature that has the role "Blog Admin" then Features will consider this to be "Overridden". Then if you try to revert the role you get the wrong id because we aren't updating the "machine_name" or "rid" upon update.
Trying to make sure I understand the scenario here.
Comment #3
klausiYes, you understood it correctly.
Comment #4
Steven Brown commentedDuring the installation we had an update statement for all existing roles. This would have taken care of this issue because the role would have already been in existence. So upon installation of role_export it would have converted the name into a machine name and generated the id. Which this would now match the feature. So if you had to revert it should be fine.
I think I might be missing something here.
Comment #5
klausiWhat we did in the install function was inconsistent: we added a machine name to existing roles, but we did not update the role id. So if I would enable role export and then would export configurations that rely on that role I would export the old serial id in them, which of course would not work on other sites. But on the other hand, if we would update also the role id in the install function we would break existing configurations in the site that rely on the old role id. So I think it is best to not touch any existing role at all. Maybe a warning message after the installation would be good that says that existing roles where not changed and should be updated manually (if needed).
I think it can be dangerous to just change role ids upon installation. People might try the module on production sites and messing with their role system without asking might lead to critical bugs.
Comment #6
Steven Brown commentedTested and committed the patch made by klausi. http://drupalcode.org/project/role_export.git/commit/3cfda33
Comment #7
Steven Brown commentedComment #8
fago+1 on not automatically coming up with machine names upon installation. We really should ensure machine-names and ids are matching, so user should be able to manually re-name (and re-id) the role.
Imho this shouldn't be there. I should be able to change my human readable role name and leave the machine name empty, in case I don't want to change the id and keep my configuration intact.
Also, there should be a warning in the #description of the machine name that tells me about the consequences of changing a machine name...
Comment #9
klausiHere is a patch that adds #description and also displays a warning for old roles that do not have a machine name yet.
I disagree that we should accept empty machine names, that would be pretty inconsistent. I experimented with the machine name form element, but it gets auto-populated with the role name anyway. So it is never empty to the user editing the role.
Comment #10
Steven Brown commentedCorrect I utilized the machine_name field which automatically pulls data from a field named 'name' which already existed on the form.
Comment #11
fagoI see - once we've the warning it should be fine that way.
Comment #12
Steven Brown commentedThis patch works for me and has been committed. http://drupalcode.org/project/role_export.git/commit/9082784