-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
[NFC] Extract case activity permission check. #12949
Conversation
This is part of refactoring to address duplicate queries for permission checks - no change in this commit other than an extraction
(Standard links)
|
The changes look good to me. However do we need to perform checks one more time for CiviCase at 2755? |
@pradpnayak I don't think I've removed any checks - I did move them higher up in the function as well as extracting - but that should be no-change |
@eileenmcnaughton I meant line 2755 is doing same checks for Civicase for defined permission at civicrm-core/CRM/Activity/BAO/Activity.php Line 2721 in ac4b9bc
Since you are already checking for CiviCase than isn't it safe to remove those permission from $compPermissions array? |
@pradpnayak so bigger picture what I think will work better is to generate a list of activity types that the contact can access before the main query & then setting an activity_type_id filter before the query runs - the current methodology is broken for getcount :-( and painfully slow under some circumstances. I kinda need to resolve this https://lab.civicrm.org/dev/core/issues/454 to be able to do that part - but I figure in the meantime I can clean up the functions a bit to make the next change easier. I agree the case permission checks are being doubled up - that isn't new I just repeated the array rather than passing it into that function as I thought that was more readable |
@eileenmcnaughton make sense now. This is good to merge but would be great if @colemanw have a look at this once since he has better sense on Check Permissions and CiviCase. |
Thanks @pradpnayak |
test this please |
Overview
Function extraction for code legibility - no functional change
Before
long block of code
After
shorter block of code
Technical Details
This is part of refactoring to address duplicate queries for permission checks - no change
in this commit other than an extraction
Comments