[backend] Introduce @ff GraphQL directive to restrict access based on feature flag value (#15330)#15331
[backend] Introduce @ff GraphQL directive to restrict access based on feature flag value (#15330)#15331
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #15331 +/- ##
==========================================
+ Coverage 25.84% 33.13% +7.29%
==========================================
Files 3155 3156 +1
Lines 214056 214090 +34
Branches 35929 39123 +3194
==========================================
+ Hits 55314 70939 +15625
+ Misses 158742 143151 -15591
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
opencti-platform/opencti-graphql/src/graphql/featureFlagDirective.ts
Outdated
Show resolved
Hide resolved
opencti-platform/opencti-graphql/src/graphql/featureFlagDirective.ts
Outdated
Show resolved
Hide resolved
lndrtrbn
left a comment
There was a problem hiding this comment.
I think it would be preferable, for easy review and maintenance, to avoid refactoring stuff not related to a new feature in the same PR but make a dedicated one instead (referring to the authDirective).
Do you think it could be interesting to also add an option that allows to change the "all flags must be present" to "at least one"?
675294b to
b4e462a
Compare
I don't really see the case where you would want all flags to be present TBH 🤔. This can be added later if people have the need.
Removed the refactoring. |
a07d05f to
c5b2a8c
Compare
|
@SouadHadjiat you mentioned using |
36ef837 to
ba8cbc1
Compare
Proposed changes
Example:
This definition will make queries to
doSomethingthrow if neither one of the feature flags is set.softFailoption that will resolve tonullinstead of returning an error:This can be helpful for queries happening super early, even before (or while) retrieving the FFs in the frontend.
Is used for the custom views feature as the new
customViewsDisplayContextquery is used in theRootPrivateQuerythat itself fetches the FFs.authDirectiveDual Package Hazardissues happening when running vitest in the backend I had to add analiasto force using the CJS version.Related issues
Checklist
Further comments
TODO if/when merged: