-
Notifications
You must be signed in to change notification settings - Fork 146
Added support for additional labels (multi-tenancy via labels) #282
Conversation
Deleted pretest script since ava will precompile it out-of-the-box
…ypherParams interpolation)
I fixed the CI script myself since it was inside the source code :) |
I'm using this for the last week and it looks like everything works great. |
Hey @cmartin81 - thanks for the PR. This is really neat when combined with We may want to rethink how this is handled when Neo4j v4.0 is released, which will include new access control features, but since this is useful for your use case I think it will be useful for others as well. Would you mind adding another PR to the docs showing how to use this? Probably as an additional item in this file. Thanks! |
Codecov Report
@@ Coverage Diff @@
## master #282 +/- ##
=========================================
Coverage ? 86.45%
=========================================
Files ? 10
Lines ? 2348
Branches ? 0
=========================================
Hits ? 2030
Misses ? 318
Partials ? 0
Continue to review full report at Codecov.
|
Sorry about that, that was my fault :-\ I've fixed the integration tests and merged this in. Thanks for adding this feature! |
Great! Thanks! |
I've implemented ability to add additional labels inside the schema for objects. The implementation is inspired by issue #237 (Auth support for multi-tenant graphs implemented via node labels)
Example of usage:
Use directive @additionalLabels which has 1 parameter 'labels' .
Labels is an array of strings. It also supports string interpolation (See example under) using lodash.template lib. The varible $cypherPrams is also accessible within the string
When creating, updating or deleting it will add 2 new labels to the query. For this case it will be u_123 and newMovieLabel given that $cypherParams.userId = 123. This way it should be possible to add multi-tenant graph via labels.)
Labels are only applied on node (not edges)
Tests have been changed and all 110 are passing