Porting or referencing roles across multiple sites is a pain because roles are ID'ed using an auto-increment integer. This also makes making roles exportable more or less impossible.

Roles should be ID'ed using a machine name similar to content types.


Dave Reid’s picture

Yep, makes sense, but definately for D8 now.

nvanhove’s picture

I would prefer a situation where *all* primary keys in the database would be UUID()'s instead of machine names.

This would truly create a system where we can export features & content.

arhak’s picture

@#1 I don't think that makes sense, otherwise remove every numeric ID for its machine name.
and still, what about nids?

@#2 the MSSQLServer approach might help a lot when migrating/exporting/synchronizing

nevertheless, exporting tools might come up with an algorithm similar to what Symfony calls "fixtures"
which is saving the data keyed by a "candidate key" (even composed keys) instead of the actual primary key
that way you can always import the data without primary keys conflicts
and there is no lost, since almost every table has at least one candidate key besides the primary key
therefore, references work as well
the only problem would come up if there is a table with only a primary key and no candidate key, but in that case the original proposal of this issue wouldn't work either (and that data shouldn't be that relevant to represent a big impediment when migrating/exporting)

dixon_’s picture

@arhak: I really think it makes sense to have machine readable names for roles, vocabularies, content types, input formats etc. as those are *configuration*. Nodes, users and terms etc. are *content* where it makes sense to have serial numbers.

Configuration should be exportable.

arhak’s picture

@#4 good point
but take for example ImageCache with its presets indexed by machine name, deleting a preset and creating another one in the future with the same name might bring back old permission previously assigned and never reseted (if the permissions are never re-submitted they aren't dropped)
having that with roles would be too risky
it seems to me that indexes other than machine names would be needed,
there is no need to rediscover why the wheel is rounded, and there are good reasons for having serial or GUID primary keys despite the fact that the table has more candidate keys (even when candidate keys aren't composed ones)

gdd’s picture

Issue tags: +Configuration system

Tagging so this can be tracked as part of the configuration management initiative

Tor Arne Thune’s picture

Subscribing. I would love to see machine names as IDs for roles, for the reason described in the OP.

DuaelFr’s picture

I fully approve this initiative as I am facing issues with Workflow and Views Features integration...

neochief’s picture

Status: Active » Closed (duplicate)

I think it's duplicate of #935062: Change role id to machine name

gdd’s picture

Ah yes, that is the right one. Thanks.