-
-
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
APIv4 - Add shorthand for setCheckPermissions() #17834
Conversation
(Standard links)
|
Jenkins re test this please |
This looks good to me @eileenmcnaughton |
I think we can still get away with making this change in that custom v4 apis haven't taken off and it helps usability a lot - but we need to think about communications around it - ie. email dev-list? release notes (@agh1 ) docs updates & change log |
@eileenmcnaughton I've submitted https://lab.civicrm.org/extensions/api4example/-/merge_requests/1 and also updated the dev docs to prominently point to those examples. I can also send out an email once this is merged. |
@colemanw so it's still not clear to me what has changed from a consumer POV - what will break & how |
@colemanw so for example will this api break? https://github.com/eileenmcnaughton/civi-data-translate/blob/master/Civi/Api4/Action/Message/Render.php |
@eileenmcnaughton it's not going to break, just generate some annoying PHP warnings because the base class function takes 1 param ( I'm trying this out now with the patched Example extension + unpatched civicrm master, and PHP is fine with it. So warnings get generated if core is updated before extensions, but no warnings if extensions are updated before core. So I can put out a dev email now asking extension maintainers to update any ad-hoc v4 APIs now & release before september 5th (which is when this will be released in core if we merge it now). |
@colemanw my inclination is to send the email out now & merge on Monday. I'm just not comfortable that we will have thought through all the implications of this. ( this is a breaking change although the case is that the impact of the breakage is minimal). I think some screenshots of the warnings would help |
@eileenmcnaughton actually now I'm not able to get php to generate any warnings from the example extension or from your extension. The only warnings I can generate is one from the contactLayout extension because it overrides a dao action. That's pretty unusual for an api; I really don't think this is going to affect much of anyone but I'll send out a notice to the dev list anyway. |
@colemanw ah that makes sense - OK happy to merge this then but yes do email the list |
Overview
This adds a much-requested shorthand for setting
$checkPermissions
in APIv4.AbstractAction
,BasicAction
orDAOAction
. Until you do so, a php warning will be generated about function signatures not matching.Before
After
Technical Details
This required updating every API factory method, so it's a big PR.
It's also going to generate on-screen PHP warnings for any extensions with built-from-scratch APIs (of which there are very few in existence and most if not all of them were written by me) until those function signatures get updated. I can take care of that shortly after this PR gets accepted. Extensions with regular DAO-based APIv4 entities are not affected if they just inherit all their factory functions from the base class.
Comments
Also updated the API Explorer:
![image](https://user-images.githubusercontent.com/2874912/87467336-cc0fed80-c5e5-11ea-8cd5-f723adbe08db.png)