Despite module system name differing, if two modules have the same name only one of their hook_permission() implementations is shown on admin/people/permissions. While system name of course has to be different, can't module names be the same? Words like "System" are general enough to get reused.
For example, my module (my_module.info) with name = System
and an implementation of hook_permission() will not be exposed.
I'm working on a test case that'll fail and then a patch to fix but you can apply the following patch to test for the time being. It's the start of a hidden module with name = User
and hook_permission() implementation that doesn't show.
How should the permissions page distinguish between modules with the same name, if at all?
Comment | File | Size | Author |
---|---|---|---|
#10 | 740258-module-name-hook-permission-10.patch | 3.55 KB | coltrane |
#8 | 740258-module-name-hook-permission-8.patch | 3.58 KB | coltrane |
#6 | 740258-module-name-hook-permission-6.patch | 2.38 KB | coltrane |
#5 | user_admin_permissions.patch | 883 bytes | mr.baileys |
#2 | 740258-module-name-hook-permission.patch | 624 bytes | coltrane |
Comments
Comment #1
coltraneFull test case for this issue, will fail till I find the offending code.
Patch adds new test case and mock module user_test.
Comment #2
coltraneSimple as not keying by module name and instead using module system name. User's role permissions test case passes with this patch but I'll leave the rest of testing up to the bot.
Comment #3
mr.baileysCurrent patch basically rolls back the changes from #647250: Permissions page not in alphabetical order. Maybe not that simple :)
Comment #4
coltraneThe ksort() is still in place, but it's possible that they could not be in alphabetical order, good catch. Could possibly use module name as value and use regular sort.
Comment #5
mr.baileysSounds good, something like this?
Tested with a custom module with name = System, both "system system" and "custom system" permissions are displayed, and the list is alphabetical.
Comment #6
coltraneLooks good, mr.baileys, thanks.
Here's #5 and the test from #1 as a combined patch.
Comment #8
coltraneOops, #6 was missing added mock module.
Comment #9
retester2010 CreditAttribution: retester2010 commentedthere should be a new line
trailing white spaces
40 critical left. Go review some!
Comment #10
coltraneMarking "major" because this issue affects permissions and as maintainers update their projects this could be a blocker.
Comment #11
Stevel CreditAttribution: Stevel commentedLooks good, it's never a good idea to use the display name as the key instead of the machine name.
Comment #12
webchick#10: 740258-module-name-hook-permission-10.patch queued for re-testing.
Comment #13
webchickMmmm. I really don't know about this. It sounds like you have to be doing completely unholy things to even run across this bug. Definitely not major. I talked to Ben about it here at BADCamp, though, and he pointed out that he might want to make his own custom toolbar_replacement.module with the human readable name "Toolbar." I think this causes a UX nightmare, personally. ;P
However, I agree that keying permissions by a human readable name is pretty silly, so this seems like a bug worth fixing either way.
Committed #10 to HEAD. Thanks!