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

[SDK-2435] Add Organizations support to Management API Client #483

Merged
merged 39 commits into from
Apr 1, 2021

Conversation

evansims
Copy link
Member

@evansims evansims commented Mar 16, 2021

This pull request adds support for Organizations to the Management API Client:

  • Adds Management::organizations() singleton provider.
  • Adds Users::getOrganizations() method for retrieving organizations user is a member of.
  • Updates Auth0\SDK\API\Management\Tickets class:
    • Tickets::createEmailVerificationTicket() now supports passing organization_id param. Fixed client_id not getting passed properly.
    • Tickets::createPasswordChangeTicket() now has an optional organization_id argument.
    • Tickets::createPasswordChangeTicketByEmail() now has an optional organization_id argument.
    • Tickets::createPasswordChangeTicketRaw() now has an optional organization_id argument.
  • Updates Auth0\SDK\API\Management\Jobs class:
    • Jobs::sendVerificationEmail() now supports passing organization_id param.
  • Adds Auth0\SDK\API\Management\Organizations class:
    • Organizations::create() creates a new organization.
    • Organizations::update() makes changes to an existing organization.
    • Organizations::delete() deletes an organization.
    • Organizations::getAll() returns an array of all created organizations. Pagination supported.
    • Organizations::get() returns details about an existing organization, by its id.
    • Organizations::getByName() returns details about an existing organization, by its name.
    • Organizations::getEnabledConnections() returns an array of all enabled connections. Pagination supported.
    • Organizations::getEnabledConnection() returns details about an enabled connection.
    • Organizations::addEnabledConnection() attachs a connection to an organization.
    • Organizations::updateEnabledConnection() makes changes to properties of a connection on an organization.
    • Organizations::removeEnabledConnection() detaches a connection from an organization.
    • Organizations::getMembers() returns an array of all users who are members of an organization. Pagination supported.
    • Organizations::addMembers() makes one or more users members of an organization.
    • Organizations::removeMembers() removes membership of one or more users from an organization.
    • Organizations::getMemberRoles() returns an array of roles a user has been granted within the organization.
    • Organizations::addMemberRoles() grants a user one or more roles within an organization.
    • Organizations::removeMemberRoles() strips one or more roles from a member of an organization.
    • Organizations::getInvitations() returns an array of all pending invitations for an organization. Pagination supported.
    • Organizations::getInvitation() returns details about a pending invitation for an organization.
    • Organizations::createInvitation() creates an invitation to join an organization.
    • Organizations::deleteInvitation() deletes a pending invitation for an organization.
  • Adds GenericResource::checkEmptyOrInvalidArray() helper.
  • Updates UsersMockedTest for new Users::getOrganizations() method.
  • Adds OrganizationsTest unit tests for new Auth0\SDK\API\Management\Organizations class.
  • Adds OrganizationsIntegrationTest integration tests for new Auth0\SDK\API\Management\Organizations class.

…ement

Signed-off-by: Evan Sims <evan.sims@auth0.com>

# Conflicts:
#	README.md
#	src/API/Authentication.php
#	src/Auth0.php
#	src/Helpers/Tokens/IdTokenVerifier.php
@evansims evansims changed the title [SDK-2374] Add Organizations support to Management API Client [SDK-2435] Add Organizations support to Management API Client Mar 29, 2021
@evansims evansims marked this pull request as ready for review March 31, 2021 07:06
@stevehobbsdev
Copy link

I can see the integration tests only run on the master branch, were you able to run them manually as part of this work and if so presumably they were ok?

@evansims
Copy link
Member Author

evansims commented Mar 31, 2021

I can see the integration tests only run on the master branch, were you able to run them manually as part of this work and if so presumably they were ok?

@stevehobbsdev Yup! Just pushed a few small tweaks, but it's all green there

➜  auth0-php git:(feat-sdk-2435) ✗ php vendor/bin/phpunit --testsuite integration --group management
PHPUnit 9.5.4 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.3.27
Configuration: /Users/evan/Projects/auth0-PHP/phpunit.xml.dist

...........                                                       11 / 11 (100%)

Time: 00:47.012, Memory: 8.00 MB

OK (11 tests, 33 assertions)

Edit: I should note this is passing on my personal development tenant; the SDKs integration testing tenant will need to have the New Universal Login Page enabled so we can enable Organizations on clients over there.

@evansims
Copy link
Member Author

evansims commented Mar 31, 2021

Just noticed I had overlooked passing the new organization_id param on the job/ticket endpoints, and unrelatedly we were missing client_id on one. Fixed that. I've updated the original post above to outline those changes.

@evansims
Copy link
Member Author

Added integrations tests for invitations as well, since I figured out what was blocking me on those. That's everything I had on my todo list here.

Copy link

@stevehobbsdev stevehobbsdev left a comment

Choose a reason for hiding this comment

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

All looks good, but noticed that one of the doc comments looks to be incorrect.

src/API/Management/Organizations.php Outdated Show resolved Hide resolved
@evansims evansims merged commit ccdfa42 into master Apr 1, 2021
@evansims evansims deleted the feat-sdk-2374-management branch April 1, 2021 18:21
@evansims evansims added this to the 7.8.0 milestone Apr 1, 2021
@evansims evansims mentioned this pull request Apr 1, 2021
@github-actions
Copy link
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants