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

dev/core#1207 - My Cases dashlet shouldn't crash for users with only my cases access #19689

Merged
merged 1 commit into from
Feb 28, 2021

Conversation

demeritcowboy
Copy link
Contributor

@demeritcowboy demeritcowboy commented Feb 28, 2021

Overview

https://lab.civicrm.org/dev/core/-/issues/1207

  1. Turn on civicase.
  2. Make a user that has access my cases and activities permission but not access all cases and activities permission.
  3. Log in as that user.
  4. Create a case (the problem doesn't appear if there aren't any cases).
  5. Add the My Cases dashlet to the dashboard.
  6. Cursor spins.

Before

  • Spinning logo.
  • DB error: no such field
    • Unknown column 't_act.activity_type_id' in 'field list'

After

Dashlet loads

Technical Details

The ajax call is passing an invalid value for the type url parameter, but it only happens when the user only has Access My Cases permission and only for the My Cases dashlet. When type isn't one of the valid values then there's a missing table in the query that gets generated. See ticket for more details.

The material code change here is that the middle expression in the if-else-then is replaced with an expression that converts "my-cases" to "any". The rest is I just moved it into a function.

Note that list is also used as part of the css class names and ultimately how the datatable is targeted, so I didn't want to change anything around that.

Comments

I can't think of how to write a test for this since it's in the javascript and the problem is an invalid value is being put in the url.

@civibot civibot bot added the master label Feb 28, 2021
@civibot
Copy link

civibot bot commented Feb 28, 2021

(Standard links)

@eileenmcnaughton
Copy link
Contributor

I had some trouble replicating this as I had to expand the dashlet to get the error (possibly it was browser caching results when I was logged in as a different user, not sure) - however, I was in the end able to confirm the issue and that this fixed it

@eileenmcnaughton eileenmcnaughton merged commit 83d9049 into civicrm:master Feb 28, 2021
@demeritcowboy
Copy link
Contributor Author

Thanks. Yes dashlets seem very cachey sometimes.

@demeritcowboy demeritcowboy deleted the my-cases-listtype branch February 28, 2021 23:39
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.

2 participants