Giter Site home page Giter Site logo

Comments (5)

eddyystop avatar eddyystop commented on June 18, 2024

@ekryski has suggested

favorites: {
  include:
    when: {
        permissions: [
          '*',
          'favourites',
          'favourites:*',
          'favourites:*:*'
        ]
      },
    posts: { ... }

from feathers-hooks-common.

ekryski avatar ekryski commented on June 18, 2024

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.

eddyystop avatar eddyystop commented on June 18, 2024

@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.

eddyystop avatar eddyystop commented on June 18, 2024

I'm thinking a decent permission structure for populate would be service:schemaName, and service.schemaName:role for serialize.

from feathers-hooks-common.

eddyystop avatar eddyystop commented on June 18, 2024

https://github.com/eddyystop/feathers-test-populate-etc is where this is being handled.

from feathers-hooks-common.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.