Coder Social home page Coder Social logo

Comments (7)

julianlam avatar julianlam commented on August 22, 2024

Unfortunately at this point in time, no, although it may be added in the future.

from nodebb-plugin-write-api.

jkirkpatrick avatar jkirkpatrick commented on August 22, 2024

That doesn't sound like it's un-possible, but I'm fairly new to nodebb. Is it low-priority or are there some major blockers? Should be in it's own sub-plugin instead of write api?

Category permissions is a requirement for me... I would be more than happy to submit a PR.

from nodebb-plugin-write-api.

metalcamp avatar metalcamp commented on August 22, 2024

@julianlam I would like to help with this issue. Are you willing to provide some hints how to implement this feature?

from nodebb-plugin-write-api.

julianlam avatar julianlam commented on August 22, 2024

@mkranjec As privileges are assigned on a per-category basis, you'd want to create new PUT and DELETE routes in this file: https://github.com/NodeBB/nodebb-plugin-write-api/blob/master/routes/v1/categories.js

Perhaps you could pass in a query-string like so: ?privilege=groups:read&id=registered-users to allow registered users to read posts in cid 15. Likewise, DELETE to remove. Perhaps ?privilege[]= to add/remove multiple privileges.

You'll need checks to ensure the id passed in is a legitimate user or group. Privileges starting with group: only allow groups (obviously), so you can determine whether to call User.exists() or Groups.exists(); based on the privilege name.

For API completion, you'd probably want to also expose a GET route for each category (e.g. /api/v1/categories/:cid/privileges) that would list the privileges for each user/group with a Boolean value denoting whether they have it or not.

from nodebb-plugin-write-api.

leroydev avatar leroydev commented on August 22, 2024

Is there still interest in this?
For a hobby project, I've implemented this a while back here: https://github.com/leroydev/nodebb-plugin-write-api/commit/754974122c42f0df0b013be15e6fc5cbb94bdc1b.

I'm not sure if this code is good enough though.

from nodebb-plugin-write-api.

julianlam avatar julianlam commented on August 22, 2024

Yes, if you open a PR I can merge with some minor changes, like changing the route name to match existing nomenclature, and small stylistic suggestions. Thanks.

from nodebb-plugin-write-api.

leroydev avatar leroydev commented on August 22, 2024

@julianlam done :) Feel free to change / add stuff to the PR. :)

from nodebb-plugin-write-api.

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.