Comments (7)
Unfortunately at this point in time, no, although it may be added in the future.
from nodebb-plugin-write-api.
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.
@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.
@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.
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.
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.
@julianlam done :) Feel free to change / add stuff to the PR. :)
from nodebb-plugin-write-api.
Related Issues (20)
- Ban/Unban API v2 Endpoints not working
- Is there any api endpoint to send users an email to reset their password?
- Token generation api responses time out HOT 4
- 2FA HOT 11
- Timeout since upgrade with API v2 HOT 6
- This plugin doesn't appear in the list of the write plugins in my admin screen HOT 3
- Easier token revocation HOT 5
- error: Cannot set headers after they are sent to the client HOT 4
- Banned users cannot use write-api even after ban expires
- Create User from Node.js Failure. HOT 3
- Warn or prohibit creation of new user of same username HOT 2
- Follow logic is backwards HOT 1
- [Question] Create Topic as Current User HOT 2
- Access to admin pages with master token HOT 5
- Revoke Session via Write API HOT 1
- Upload functionality has been broken HOT 7
- How to delete user account + content? HOT 3
- Dependency Dashboard
- Please explain what does "Any other data passed in will be saved into the user hash" means HOT 1
- No bearer authentication for Read API HOT 5
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 nodebb-plugin-write-api.