add support for OAuthContactTokens, with tests, upgrade step, new permissions
authorNoah Miller <nm@lemnisc.us>
Tue, 27 Apr 2021 07:08:04 +0000 (00:08 -0700)
committerNoah Miller <nm@lemnisc.us>
Fri, 28 May 2021 20:13:46 +0000 (13:13 -0700)
commitd55f710f84d78749fdc0f6d1a0f7eaff274dafa5
tree60ce15def839b9fc69365f09222ff1807770207b
parentff2fb35c77ca8547b5829a596b926129fd012a0a
add support for OAuthContactTokens, with tests, upgrade step, new permissions

Per discussion with @totten, re the logic that interprets "tag" and links/creates contacts accordingly: in earlier versions of this code, I had put that logic in OAuthTokenFacade. Moving it to the api4 "create" action means it will happen even when a ContactToken is created outside the OAuth flow. I decided not to put it in BAO writeRecords() because then it would run too late for the permissions checking we do in the api4 Create action.

Note: the permissions change here means that some current users of the OAuth Extension will need to enable an additional permission to allow for the acquisition of new tokens through the auth-code flow.
26 files changed:
ext/oauth-client/CRM/OAuth/BAO/OAuthContactToken.php [new file with mode: 0644]
ext/oauth-client/CRM/OAuth/ContactFromToken.php [new file with mode: 0644]
ext/oauth-client/CRM/OAuth/DAO/OAuthClient.php
ext/oauth-client/CRM/OAuth/DAO/OAuthContactToken.php [new file with mode: 0644]
ext/oauth-client/CRM/OAuth/DAO/OAuthSysToken.php
ext/oauth-client/CRM/OAuth/Upgrader.php
ext/oauth-client/Civi/Api4/Action/OAuthContactToken/Create.php [new file with mode: 0644]
ext/oauth-client/Civi/Api4/Action/OAuthContactToken/Delete.php [new file with mode: 0644]
ext/oauth-client/Civi/Api4/Action/OAuthContactToken/Get.php [new file with mode: 0644]
ext/oauth-client/Civi/Api4/Action/OAuthContactToken/OnlyModifyOwnTokensTrait.php [new file with mode: 0644]
ext/oauth-client/Civi/Api4/Action/OAuthContactToken/Update.php [new file with mode: 0644]
ext/oauth-client/Civi/Api4/OAuthClient.php
ext/oauth-client/Civi/Api4/OAuthContactToken.php [new file with mode: 0644]
ext/oauth-client/Civi/OAuth/OAuthTokenFacade.php
ext/oauth-client/oauth_client.civix.php
ext/oauth-client/oauth_client.php
ext/oauth-client/sql/auto_install.sql
ext/oauth-client/sql/auto_uninstall.sql
ext/oauth-client/sql/upgrade_0001.sql [new file with mode: 0644]
ext/oauth-client/tests/phpunit/Civi/OAuth/AuthCodeFlowTest.php
ext/oauth-client/tests/phpunit/api/v4/OAuthContactTokenTest.php [new file with mode: 0644]
ext/oauth-client/xml/Menu/oauth_client.xml
ext/oauth-client/xml/schema/CRM/OAuth/OAuthClient.xml
ext/oauth-client/xml/schema/CRM/OAuth/OAuthContactToken.entityType.php [new file with mode: 0644]
ext/oauth-client/xml/schema/CRM/OAuth/OAuthContactToken.xml [new file with mode: 0644]
package-lock.json