Giter VIP home page Giter VIP logo

Comments (2)

josecelano avatar josecelano commented on September 10, 2024

I've created the summary below with the current state. I think it's useful to define first what we have before proposing new changes.

I called the "UNVERIFIED" user "AUTHENTICATED" and there is no "MODERATOR".

For the first implementation I would:

  • Create a permissions service only for commands and queries: service.is_authorized(user, action).
  • Call the service in the handlers before performing the action.
  • We can add a wrapper to return the right HTTP response.
  • Can add unit tests for the service and integration tests for the API endpoints.

IMPLEMENTATION NOTES:

  • Roles could be hardcoded.
  • Rules could also be hardcoded for the time being inside the service.

NOTES:

  • Regarding settings I would split them into two groups: the ones you only set while installing the application (they could be injected as env vars in the future), and the ones you can change dynamically like the "site name". I would move the second group to a database table. If you need to restart the service after changing the value it does not make sense to allow you to change it from the web app.
  • API resources do not contain any sensitive data except for "username" and "settings" so I do not think it worth creating specific resources depending on the role. It seems the general rule is either you can see the full resource or you cannot see the resource.

QUESTIONS:

  • The "username" is not considered private data.

image

from torrust-index-archive.

da2ce7 avatar da2ce7 commented on September 10, 2024

from torrust-index-archive.

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.