-
Notifications
You must be signed in to change notification settings - Fork 162
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
Provision user access to stores only when permitted #5596
base: refactor-store-fetch
Are you sure you want to change the base?
Provision user access to stores only when permitted #5596
Conversation
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Coverage report
Show new covered files 🐣
Show files with reduced coverage 🔻
Test suite run success2174 tests passing in 953 suites. Report generated by 🧪jest coverage report action from 716984f |
8fed2d9
to
5fded15
Compare
5fded15
to
13683ae
Compare
We detected some changes at packages/*/src and there are no updates in the .changeset. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving in that the code looks to do what is described in the description, and that it is well tested but I lack the FED context to know if the code is correct/ideomatic and/or if there is full test coverage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we would not be storing user-level information in a store object, but to avoid that, we'd need to
- Add yet another GraphQL call to the app dev flow, or
- Gather permission info more centrally for an authenticated user. This would require some refactoring and probably moving from destinations API to organizations API to gather some user info (beyond the scope of this PR)
Discussed this with @MitchDickinson earlier today. He suggested, as a "soft" preference that we have the underlying queries return the user and store data as separate objects rather than polluting OrganizationStore
.
This is my incomplete attempt to do that. It's not as simple as I was hoping, and it is starting to strain my JS/TS skillset. If someone feels strongly enough about this approach to pair for a while, I'd be happy to do it; otherwise, I think we should go with the current solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving but am not able to tophat right now due to my local dev being borked currently.
a2eab52
to
4b88cc9
Compare
13683ae
to
716984f
Compare
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationsWe found no new type declarations in this PR Existing type declarationspackages/cli-kit/dist/public/node/api/business-platform.d.ts@@ -40,6 +40,6 @@ export declare function businessPlatformOrganizationsRequest<T>(query: string, t
* @param variables - GraphQL variables to pass to the query.
* @returns The response of the query of generic type <T>.
*/
-export declare function businessPlatformOrganizationsRequestDoc<TResult>(query: TypedDocumentNode<TResult, GraphQLVariables> | TypedDocumentNode<TResult, Exact<{
+export declare function businessPlatformOrganizationsRequestDoc<TResult, TVariables extends Variables>(query: TypedDocumentNode<TResult, TVariables> | TypedDocumentNode<TResult, Exact<{
[key: string]: never;
-}>>, token: string, organizationId: string, variables?: GraphQLVariables): Promise<TResult>;
\ No newline at end of file
+}>>, token: string, organizationId: string, variables?: TVariables): Promise<TResult>;
\ No newline at end of file
|
WHY are these changes introduced?
Modifies the fix for https://github.com/Shopify/shopify/issues/563572 to limit calls the BP provisioning mutation to organization owners and administrators.
WHAT is this pull request doing?
The mutation is available only to holders of the
ondemand_access_to_stores
permission. Other users should always be provisioned for access to a store and do not need the mutation called.To avoid a separate GraphQL query to fetch user permissions, they are instead added to existing to store fetch calls by including
in the existing query.
The additional information is added to
OrganizationStore
class so that is available when needed.Ideally we would not be storing user-level information in a store object, but to avoid that, we'd need to
app dev
flow, orHow to test your changes?
Tophatting requires local dev and the following painful steps (sorry)
Add the user management scope to the CLI application.
https://api.shopify.com/auth/organization.user-management
)Run BP using the
rz-accessible-shops
branch, rebasing frommain
as necessary.Update
shop/world
extra_server_names
(details)Ensure that
dev@shopify.com
has created a development store as described in the local dev docLog in to the dev store and add an admin user for the store.
alice@example.com
).bin/rails c
from the BP repo)Create a store as the admin user
Exercise the alternative methods of listing/selecting stores from the CLI. Both stores should be visible and selectable, and
app dev
should start up and auto-install the app on the selected store if necessary.Post-release steps
Measuring impact
How do we know this change was effective? Please choose one:
Checklist