We need to use the "Create user" option in Contextual Admin, but the user role settings are causing a conflict for us. The module allows for default roles and altering of roles, but what we need is Contextual Admin to support the functionality we already have in place with the Role Delegation module.
We've written a patch to add support for Role Delegation that I will attach for review. It will also require a patch to the Role Delegation module since Contextual Admin writes its own user_register_form
function.
When writing this patch, we also realized the context_admin_user_edit_form
is really overkill, since it essentially is a copy of user_account_form
with a few changes for #access
. Rather than copying/pasting the entire user_account_form
function into Contextual Admin, we pull the user_account_form
and make modifications to support the differences we see in user_create_menu.inc
.
Also made some updates to replace #dependency
with #states
, as is the newer way to control visibility.
I'll post the patch for review in a few minutes.
Comment | File | Size | Author |
---|---|---|---|
#5 | context_admin-role_delegation_user_create-2700755-5.patch | 13.99 KB | ron_s |
Comments
Comment #2
ron_s CreditAttribution: ron_s commentedAttached is a patch for review. I will add a link to the Role Delegation patch once it has been posted. Both patches will be needed to have this functionality work.
Comment #3
ron_s CreditAttribution: ron_s commentedHere is a link to the Role Delegation patch necessary to support Contextual Administration: https://www.drupal.org/node/2700759#comment-11042391
Comment #4
kevinsbath CreditAttribution: kevinsbath commentedHi Ron,
Thanks for the patches. One quick comment - you're checking the value of $page['handler']->conf['context_admin_user_roles_option'] before checking if it's set - causing an Undefined index: context_admin_user_roles_option in context_admin_user_create_menu_form_alter() (line 255 of context_admin/plugins/context_admin/user_create_menu.inc).
I'm afraid I don't quite understand what this function logic is trying to do - so can't fix - but through I'd let you know anyway.
Kind regards - Kevin.
Comment #5
ron_s CreditAttribution: ron_s commentedKevin, thank you for taking time to review the patch and provide feedback.
Yes, you are right... there is a bug. However I believe it's actually earlier in the process. We should not need an
isset
in the form_alter, because the value should be eithercontext_admin
orrole_delegation
once it reaches that point.The issue is in the
#default_value
of the form, which was set asarray('context_admin')
when no value exists, but should be'context_admin'
.Try the attached patch and let me know if there are further issues. Thanks.