Comments (5)
@ekryski has suggested
favorites: {
include:
when: {
permissions: [
'*',
'favourites',
'favourites:*',
'favourites:*:*'
]
},
posts: { ... }
from feathers-hooks-common.
Nice work putting this all together @eddyystop. I'm not entirely sure on population but I'm liking where serializing is headed. This is exactly what I was thinking really:
const serializerPermissions = {
employee : [
{ permissions: ['payroll-mgr'], serializer: serializers.employee_manager },
{ permissions: 'payroll-clerk', serializer: serializers.employee_clerk },
]
}
I'm thinking population really good be the same. In an medium to large app you might have a bunch of serialization and population "policies" but this is still already so much more scalable than having to create one-off hooks for each entity permission role, group, etc.
I'm publishing feathers-permissions later today with some updated docs.
We are allowing only ors on the permissions.
I think that is ok in almost most cases. You must have at least 1 of the required permissions. If you require you can create and
conditions by chaining multiple checkPermissions
hooks with different configurations.
from feathers-hooks-common.
@ekryski I'm setting things up so the client can pass params: { query: { populate: 'a.b.c', serialize: 'd.e.f' }}
for populate(/*populations.a.b.c*/)
and serializeWithPermissions(/*serializerPermissions.d.e.f*/)
The client can now specify the view it wants to get back, which removes boilerplate on the server.
However some control is needed on the server and this is where permissions
on populations
comes in.
from feathers-hooks-common.
I'm thinking a decent permission structure for populate would be service:schemaName
, and service.schemaName:role
for serialize.
from feathers-hooks-common.
https://github.com/eddyystop/feathers-test-populate-etc is where this is being handled.
from feathers-hooks-common.
Related Issues (20)
- IDE (VSCode) confused? HOT 1
- Link in docs for batch loaders explanation is broken HOT 1
- New Hooks: variableMulti and variableWhitelist HOT 5
- iff() hooks are skipped when there's a .else() HOT 3
- paramsForServer Hook HOT 2
- import pkg from '@feathersjs/errors'; const { BadRequest } = pkg; HOT 1
- Modules import HOT 1
- Update in imports errors HOT 5
- Wrong lodash imports HOT 3
- Export Error "hrtime" in typescript Vite Application HOT 2
- isProvider() not working as expected HOT 2
- [Bug] PreventChanges hook prevents only last defined field HOT 1
- Compatibility with future v5 (aka Dove) HOT 3
- [dove] TypeScript issue when using hooks (iff, isProvider, ...) HOT 1
- Support batch remove when using softDelete() hook HOT 1
- fails hooks wrong return with around HOT 3
- [FR] New Hook: next
- preventChanges hook should support dot notation HOT 2
- paramsFromClient pollutes context by default
- Doc for `iff` is wrong
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from feathers-hooks-common.