When a user account has a file field, the user protect module causes an AJAX error for users that only have the authenticated role if they try to remove an attached file. User protect currently unsets the rid for the authenticated role in userprotect_user_edit_fields_validate, but the block module's function block_form_user_profile_form_alter needs the rid there or else an SQL error breaks the AJAX call.

A patch will be supplied below.

CommentFileSizeAuthor
#1 userprotect-roleids-1508752-1.patch855 bytesscotthorn
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

scotthorn’s picture

karschsp’s picture

Status: Needs review » Postponed (maintainer needs more info)

I'm not actually able to reproduce this. Here's the steps I followed:

* Add a file field to user accounts.
* Create a user with only authenticated user role.
* Log in as that user, edit account, upload image, save.
* Edit account again, remove image, save.
* Log out
* Log in as administrator
* Edit the account of the user created above.
* Remove image
* Save

I didn't see any AJAX errors when going through those steps. What am I missing?

scotthorn’s picture

You will also need to protect role changes for authenticated users at admin/config/people/userprotect/protected_roles. Sorry, I didn't realize that when I originally posted.

Just now I tried it on a clean install using sqlite and did not encounter the error. I repeated the test with a fresh MySQL install and did get the problem again. Thanks for responding, and for a great module!

scotthorn’s picture

Status: Postponed (maintainer needs more info) » Needs review

  • MegaChriz committed fe85284 on 7.x-1.x authored by scotthorn
    Issue #1508752 by scotthorn: Fixed Removal of authenticated user RID...
MegaChriz’s picture

Issue summary: View changes
Status: Needs review » Fixed

I couldn't reproduce the issue, but the removal of a role on the account object when that's not specifically needed is like playing with fire. Committed #1.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.