Skip to content

feat(core): Scope getStatus for environments for project admin role #15404

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

Merged
merged 14 commits into from
May 22, 2025

Conversation

afitzek
Copy link
Contributor

@afitzek afitzek commented May 15, 2025

Summary

Changes the behavior of the getStatus endpoint to scope available changes in environments to only resources
project admins have access to.

Related Linear tickets, Github issues, and Community forum posts

closes https://linear.app/n8n/issue/PAY-2822/adapt-getstatus-endpoint-to-support-scoping-to-project-admins

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

Copy link

codecov bot commented May 15, 2025

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels May 15, 2025
@afitzek afitzek force-pushed the pay-2822-adapt-get-status branch 4 times, most recently from 328652c to e45091b Compare May 20, 2025 09:46
@afitzek afitzek marked this pull request as ready for review May 20, 2025 10:35
@afitzek afitzek requested a review from guillaumejacquart May 20, 2025 10:35
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

cubic reviewed 10 files and found no issues. Review PR in cubic.dev.

Copy link
Contributor

@guillaumejacquart guillaumejacquart left a comment

Choose a reason for hiding this comment

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

Some comments

});
}

private getProjectFilter(context: SourceControlContext): FindOptionsWhere<Project> | undefined {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's a bit redundant to re-check context.accessToAllProjects() here, because getProjectFilter is called from functions which already do that check.
Since for now this method is not used elsewhere, what would you say if we called it something more explicit like getAdminProjectsByUserIdFilter(userId: string) ?
also I'm wondering if all those typeorm related method should maybe be put in a repository instead, what do you think ? (either entity repos or a dedicated source control repo 🤔 )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I moved these functions into a SourceControlScopedService class.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you will have a list issue that requires all files that import typeorm stuff to be inside the database folder or something

Copy link
Contributor

@guillaumejacquart guillaumejacquart left a comment

Choose a reason for hiding this comment

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

Some additional comments

});
}

private getProjectFilter(context: SourceControlContext): FindOptionsWhere<Project> | undefined {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you will have a list issue that requires all files that import typeorm stuff to be inside the database folder or something

@afitzek afitzek force-pushed the pay-2822-adapt-get-status branch from d917126 to e1d8690 Compare May 22, 2025 07:16
@afitzek afitzek requested a review from guillaumejacquart May 22, 2025 07:36
Copy link
Contributor

@guillaumejacquart guillaumejacquart left a comment

Choose a reason for hiding this comment

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

Looks good to me. Well done on the tests 👍
I think we should create a tech debt ticket to start splitting the souce-control service into multiple services though

@shortstacked
Copy link
Contributor

Workflow Test Results 📊 🔴 2 Failed, ⚠️ 3 Warnings, 👍 78 Successful out of 83 total workflows.

Detail: Workflows failing: 243: Workflow contains 2 deleted data. View full workflow run

Tested Ref: d3ea6d2949f099d01adba901c1d035cbbfd22d60 by @guillaumejacquart

❌ Failed Tests (2)

Workflow ID Workflow Name Reason
243 Agent:ReAct Workflow contains 2 deleted data.
258 Agent:auto-fix:openai Workflow contains 2 deleted data.

⚠️ Warnings (3)

Workflow ID Workflow Name Reason
237 BasicLLMChain:AzureChat Workflow contains new data that previously did not exist.
35 Slack:User:getPresence info:UserProfile:get update... Workflow contains new data that previously did not exist.
257 Agent:auto-fix:anthropic Workflow contains new data that previously did not exist.

Copy link
Contributor

⚠️ Some Cypress E2E specs are failing, please fix them before merging

2 similar comments
Copy link
Contributor

⚠️ Some Cypress E2E specs are failing, please fix them before merging

Copy link
Contributor

⚠️ Some Cypress E2E specs are failing, please fix them before merging

Copy link
Contributor

✅ All Cypress E2E specs passed

@afitzek afitzek merged commit f9f9597 into master May 22, 2025
42 checks passed
@afitzek afitzek deleted the pay-2822-adapt-get-status branch May 22, 2025 11:49
@github-actions github-actions bot mentioned this pull request May 26, 2025
@janober
Copy link
Member

janober commented May 26, 2025

Got released with [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team Released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants