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

Organizations: return organization roots for requests made by other accounts within the organization #8531

Merged

Conversation

k-a-il
Copy link
Contributor

@k-a-il k-a-il commented Jan 28, 2025

Default account is linked to the organization, whereas other accounts within the organization do not have this reference. This PR fixes this issue.

Once an organization is created and a member account is added, the member account can now retrieve the details of the root account by using the ListRoots API.

Plus, if a member account is not part of any organization, the AWSOrganizationsNotInUseException exception will be raised, as described in the AWS documentation.

This PR re-uses approach introduced in the #8260

Copy link
Collaborator

@bblommers bblommers left a comment

Choose a reason for hiding this comment

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

The change LGTM @k-a-il - looks like the linter is currently failing though:
https://github.com/getmoto/moto/actions/runs/13013182740/job/36300800416?pr=8531

Looks like this is a simple matter of running ruff format moto/organizations/models to fix it

@k-a-il
Copy link
Contributor Author

k-a-il commented Jan 28, 2025

The change LGTM @k-a-il - looks like the linter is currently failing though: https://github.com/getmoto/moto/actions/runs/13013182740/job/36300800416?pr=8531

Looks like this is a simple matter of running ruff format moto/organizations/models to fix it

I forgot to run the linter! I’ve resolved it by running make format and make lint. It should be fixed now!

@k-a-il k-a-il requested a review from bblommers January 28, 2025 19:53
Copy link

codecov bot commented Jan 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.63%. Comparing base (16abebb) to head (964600b).
Report is 4 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8531   +/-   ##
=======================================
  Coverage   92.63%   92.63%           
=======================================
  Files        1229     1229           
  Lines      106394   106420   +26     
=======================================
+ Hits        98553    98578   +25     
- Misses       7841     7842    +1     
Flag Coverage Δ
servertests 27.92% <0.00%> (+<0.01%) ⬆️
unittests 92.60% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@bblommers bblommers left a comment

Choose a reason for hiding this comment

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

Awesome, thank you @k-a-il. Welcome to Moto!

@bblommers bblommers added this to the 5.0.28 milestone Jan 28, 2025
@bblommers bblommers merged commit 8007aef into getmoto:master Jan 28, 2025
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants