Screenshot of license role on user's profile

Problem/Motivation

Editing the profile of a user that purchased a license for a role, always deletes his role.

As can be seen in the attached image, it is not possible to toggle that role on/off, since "the role is granted by a license".
But without touching any fields - clicking on 'save' - will remove the role that was purchased.

Proposed resolution

Changes to the (licensed) role should be always locked, but should not be removed by editing the user profile.

Comments

shaal created an issue. See original summary.

webadpro’s picture

StatusFileSize
new678 bytes

Here's a patch, on my end this fixes the issue.

Please review.

webadpro’s picture

Status: Active » Needs review
shaal’s picture

Issue summary: View changes
Status: Needs review » Needs work
StatusFileSize
new41.65 KB

Screenshot with patch #2
Patch #2 fixes the bug of automatically remove the role after saving the profile.
But it introduces a new issue - it removes the warning message "This role is granted by a license. It cannot be removed manually." and it removes the lock that should be there to prevent us from accidentally switching off the role the user has purchased.

joachim’s picture

This looks like a bug in FormAPI, or in the user module form.

Disabling a form element shouldn't cause the value to change.

joachim’s picture

Component: Code » Documentation
Status: Needs work » Active

Confirming that the problem is fixed with my latest patch on that core issue.

I'll add a note to the README here to say that core patch is required.

  • joachim committed 0f5f3c1 on 8.x-2.x
    Issue #2984036 by webadpro, shaal, joachim: Added note to README about...
joachim’s picture

Status: Active » Fixed

Credited everyone for discovery & working on a fix & review.

Going to make a new alpha, with a mention of this in the release notes, as this is a pretty big bug.

shaal’s picture

@joachim wrote a patch for Drupal more details here.
Do not get confused with patch #39 which is intended for Drupal 8.6.x
You want to use patch #37 for Drupal 8.5.5

Hopefully, the patch will make it into Drupal 8.6 and won't be necessary once Drupal 8.6 comes out.

shaal’s picture

joachim’s picture

> @joachim wrote a patch for Drupal CORE 8.5.5

Just to be clear, I rerolled someone else's patch :) -- credit is on the core issue.

Status: Fixed » Closed (fixed)

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