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

EntityPageTrait: Set logged in contact ID as default if one is not specified - this allows permission checks etc. to work properly. #14620

Merged

Conversation

mattwire
Copy link
Contributor

Overview

Currently the entitypagetrait is only in use by CRM_Contact_Page_View_Relationship. However the plan is to extend it to other pages too. This PR updates it to get the logged in contact ID if none is passed in - so it can be used on non-contact forms (eg. event lists).

Before

Requires a contact ID to be passed in via $_GET

After

Uses a contact ID passed in via $_GET, if not set gets the logged in contact ID.

Technical Details

Comments

…lows permission checks etc. to work properly.
@civibot
Copy link

civibot bot commented Jun 23, 2019

(Standard links)

@civibot civibot bot added the master label Jun 23, 2019
@mattwire
Copy link
Contributor Author

@eileenmcnaughton @colemanw This trait is currently only used on the relationship form so this change is effectively NFC at this point as the contactID is passed reliably by the relationship form. But I'd like to extend it's use to other pages where we can't be sure the contactID will be passed reliably.

@eileenmcnaughton
Copy link
Contributor

@mattwire this is mostly for backend forms isn't it? I'm kinda ok as it's not in use much & it's a page not a form but normally back office you are acting on someone else's record

@mattwire
Copy link
Contributor Author

@eileenmcnaughton Yes mostly for backend forms. If you're working on someone else's record then you should be explicitly passing in the contactID. There are various examples (eg. events pages) where you are not working with a contact at all, but the pages use the contactID to do permissions checks.

@eileenmcnaughton
Copy link
Contributor

ok

@eileenmcnaughton eileenmcnaughton merged commit 09cc3c2 into civicrm:master Jul 28, 2019
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