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

Fix for one cause of CRM-18300. #11470

Merged

Conversation

twomice
Copy link
Contributor

@twomice twomice commented Dec 31, 2017

Overview

Incorrect values for civicrm_uf_group.name cause spurious "Permission Denied" errors.

Before

On sites where this is an issue, the following steps will cause the error message

  1. Inspect the name column in the civicrm_uf_group table. If there's a row with the value 'summary_overlay', you may not be able to reproduce the error on this installation. However, if such a row does not exist, you can surely reproduce the error. In my case, I notice all values in the name column are in the form 'title_with_underscores_[id]', so the value for the "Summary Overlay" profile is 'summary_overlay_7'.
  2. Perform any contact search that will generate results.
  3. In the search results, hover over the "contact type" icon (by default, an Individual, Organization, or Household icon) and observe that the summary overlay appears poorly formatted. (If you examine your browser console's Network tab, you'll observe a request to /civicrm/profile/view?reset=1&gid=&id=[contact_id]&snippet=4. Note the value for gid is empty.)
  4. Reload the page or load any other civicrm page to see the error message: "Permission Denied: You do not have permission to view this contact record. Contact the site administrator if you need assistance."

After

This PR contains SQL UPDATE statements in the upgrade SQL script for version 4.7.31. For sites affected by this issue, after these SQL queries are applied, the repro steps above do not result in the error message described in step 4.

Technical Details

This PR fixes a particular cause of the error message, specifically: All records in civicrm_uf_group have their name column in the format 'title_with_underscores_[id]' instead of simply 'title_with_underscores'. For most profiles, this is fine, and is by design, as there was some effort to fix problems with non-unique values in the name column (for example issues CRM-15952 and CRM-15961).

But for the specific profile 'summary_overlay', it is a problem. This profile is referenced by this exact name (without the '_[id]' suffix) in CiviCRM core code. The addition of this suffix is the cause of the error message in this case.

Further, there are other name values which are specifically referenced in CiviCRM core code. name values for those profiles are also addressed by this PR.

Comments

Comments in CRM-18300 indicate there are other causes of this error message. This PR is not expected to address those causes.


@twomice
Copy link
Contributor Author

twomice commented Dec 31, 2017

@colemanw I thought about making this a one-liner, but it's hard to come up with the correct value in the SET clause, so I'm leaving it as several separate UPDATE queries. Please comment, review, merge, or request improvements, if you can.

@colemanw
Copy link
Member

@colemanw colemanw merged commit 1566f1b into civicrm:master Dec 31, 2017
sluc23 pushed a commit to ixiam/civicrm-core that referenced this pull request Jan 10, 2018
…oded_profile_names

Fix for one cause of CRM-18300.
@mlutfy mlutfy added this to the 4.7.31 milestone Feb 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants