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

[NFC] Extract case activity permission check. #12949

Merged
merged 1 commit into from
Oct 23, 2018

Conversation

eileenmcnaughton
Copy link
Contributor

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

This is part of refactoring to address duplicate queries for permission checks - no change
in this commit other than an extraction
@civibot
Copy link

civibot bot commented Oct 18, 2018

(Standard links)

@pradpnayak
Copy link
Contributor

The changes look good to me. However do we need to perform checks one more time for CiviCase at 2755?

@eileenmcnaughton
Copy link
Contributor Author

@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

@pradpnayak
Copy link
Contributor

@eileenmcnaughton I meant line 2755 is doing same checks for Civicase for defined permission at

'CiviCase' => array(
.

Since you are already checking for CiviCase than isn't it safe to remove those permission from $compPermissions array?

@eileenmcnaughton
Copy link
Contributor Author

eileenmcnaughton commented Oct 18, 2018

@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

@pradpnayak
Copy link
Contributor

@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.

@eileenmcnaughton
Copy link
Contributor Author

Thanks @pradpnayak

@eileenmcnaughton
Copy link
Contributor Author

test this please

@colemanw colemanw merged commit 755b331 into civicrm:master Oct 23, 2018
@eileenmcnaughton eileenmcnaughton deleted the activity_extract branch October 23, 2018 20:32
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.

3 participants