Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving permissions filtered by role crashes upon submission #6

Closed
bugfolder opened this issue Sep 28, 2022 · 2 comments · Fixed by #7
Closed

Saving permissions filtered by role crashes upon submission #6

bugfolder opened this issue Sep 28, 2022 · 2 comments · Fixed by #7
Assignees

Comments

@bugfolder
Copy link
Contributor

Testing version 1.0.4 with Backdrop 1.23.0. To reproduce:

  • Go to the Permissions page at admin/config/people/permissions.
  • Filter to a single role (e.g., Editor).
  • Click "Save Permissions" (you don't need to change anything).

Result is this error:

Argument 2 passed to user_role_change_permissions() must be of the type array, null given, called in /mysite/core/modules/user/user.admin.inc on line 494

The relevant code is:

function user_admin_permissions_submit($form, &$form_state) {
  foreach ($form_state['values']['roles'] as $role_name => $role) {
    user_role_change_permissions($role->name, $form_state['values'][$role->name]);
  }

The problem is that although we've filtered only to the Editor role, $form_state['values']['roles'] still contains all roles. But $form_state['values'][$role->name] doesn't have an entry for any of the other roles.

@bugfolder
Copy link
Contributor Author

PR submitted.

@yorkshire-pudding
Copy link
Collaborator

Thanks @bugfolder - Sorry for the delay in responding; I need to adjust my email notification settings.
This PR does fix exactly what it says on the tin and therefore I will merge it. However testing this has made me aware of another UX issue with the module that I will raise separately: #8

yorkshire-pudding added a commit that referenced this issue Sep 30, 2022
Issue #6: Fix crash when filtering by role.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants