Problem/Motivation
The module is adding a roles_change
new form element to the user_account_form()
. By doing so, it breaks all other validations that other modules are trying to do against the official $form['account']['roles']
form element. For example an additional validation callback should check $form_state['values']['roles_change']
instead of $form_state['values']['roles']
which a 3rd party module would expect.
Moreover, even if a module tries to integrate with Role Delegation by applying validations against $form_state['values']['roles_change']
he might fail because even this is not consistent. When a user has administer permissions
acces, he will get the original $form_state['values']['roles']
and no $form_state['values']['roles_change']
.
Proposed resolution
Make the form consistent as keys with the original user_account_form()
. Use roles
key for roles in form.
Remaining tasks
None.
User interface changes
None.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#2 | user_account_form_not-2460949-2.patch | 4.72 KB | claudiu.cristea |
| |||
#2 | interdiff.txt | 893 bytes | claudiu.cristea |
Comments
Comment #1
claudiu.cristeaPatch. Note that a test fail but fails also without the patch so the failure has not been introduced now.
Comment #2
claudiu.cristeaFixed the case when the form is for new an account.
Comment #3
skwashd CreditAttribution: skwashd at Dave Hall Consulting for Pfizer, Inc. commentedOverall the code looks sane to me. I haven't tested it locally to confirm that it works. One thing I noticed was this:
The multiple ternary operators here make the code difficult to follow. Have you considered doing something like this?:
Comment #4
skwashd CreditAttribution: skwashd at Dave Hall Consulting for Pfizer, Inc. commentedComment #5
claudiu.cristeaThank you for review.
Using 2 ternary operators in a single line doesn't make it hard to read. The inside operator is enclosed in parentheses making the reading easy.