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

dev/core#2559 Support tenancy in OAuth providers #25214

Merged
merged 1 commit into from Jan 7, 2023

Conversation

JKingsnorth
Copy link
Contributor

@civibot
Copy link

civibot bot commented Dec 23, 2022

No issue was found matching the number given in the pull request title. Please check the issue number.

@civibot
Copy link

civibot bot commented Dec 23, 2022

(Standard links)

@civibot civibot bot added the master label Dec 23, 2022
@MegaphoneJon
Copy link
Contributor

@JKingsnorth test failures appear to be related.

@MegaphoneJon
Copy link
Contributor

It looks like mostly undefined array key warnings. I'm also reviewing the code, and will do an r-run if possible. I have a client who needs this but because of red tape I don't have direct access to Azure, so I have to schedule time to screenshare with someone who does.

@JKingsnorth
Copy link
Contributor Author

Yes, should be a quick fix for the tests, my local rig wasn't working so I let the test bot at it. I'll fix em up shortly :)

The test should just be: after updating and running the extension updates, you can create/edit an ms-exchange provider oauth client, and enter the tenant id.

I plan to update the documentation if the PR is accepted.

*/
public function upgrade_5581(): bool {
$this->ctx->log->info('Applying oauth-client update 5581. Adding tenant column to the civicrm_oauth_client table.');
CRM_Upgrade_Incremental_Base::addColumn($this->ctx, 'civicrm_oauth_client', 'tenant', 'varchar(128) NULL COMMENT "Tenant ID" AFTER guid');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JKingsnorth I believe you can change this to be

Suggested change
CRM_Upgrade_Incremental_Base::addColumn($this->ctx, 'civicrm_oauth_client', 'tenant', 'varchar(128) NULL COMMENT "Tenant ID" AFTER guid');
$this->addTask('Add Tenant ID to OauthClient', 'addColumn', 'civicrm_oauth_client', 'tenant', 'varchar(128) NULL COMMENT "Tenant ID" AFTER guid');

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @seamuslee001, that makes more sense. Done.

@JKingsnorth
Copy link
Contributor Author

JKingsnorth commented Dec 24, 2022

@MegaphoneJon / @seamuslee001

I've altered the PR to add the logic into the CiviGenericProvider class, rather than creating a new one just for the ms-exchange. This should make it easier for other providers to add support for tenancy where required, whilst not causing bloat or breaking existing providers. But would be great to get an r-run test on sites that do use existing gmail providers [=

I've also added tests (ooh, ahh).

EDIT: I'll squash the commits before merge - but wanted to keep my working visible for now...

@JKingsnorth
Copy link
Contributor Author

Squashed. Ready for any more review needed.

@mattwire
Copy link
Contributor

mattwire commented Jan 7, 2023

I've applied this patch on a ms-exchange site where tenant ID is required and it works. Also applied on a gmail site and it carries on working

@mattwire mattwire merged commit 88b3982 into civicrm:master Jan 7, 2023
@JKingsnorth
Copy link
Contributor Author

Thanks @mattwire , and thanks for the review and merge.

@spalmstr
Copy link
Contributor

Wonderful. Just tried it on my development system running 5.59.alpha1 and it works! Just one comment, there didn't seem to be a confirmation that the information was saved after clicking Save.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants