Category Privileges PUT and DELETE APIs Results Not Reflected

Technical Support
  • #1

    Hi all,

    I am trying to use the API from the nodebb-plugin-write-api plugin that adds and deletes group privileges from a category. Whenever I make a call using that API, I get this as my response back:

    Although it suggests success, the privileges for the specified group in the admin control panel are unchanged. We are first trying to change the privileges for the registered users group for a specific category. Can we get some help and advice on this?

    This is the curl request I am using:
    curl -X DELETE myapp/api/v2/categories/9/privileges --data "privileges[]=groups:posts:downvote&groups[]='registered-users'" -H "Authorization: Bearer X"

    In node with the module 'superagent', I am using:
    .send({ privileges: ['group:posts:downvote'], groups: ['registered-users']})
    .set('Authorization', 'Bearer ' + token)
    .then(res => {
    console.log('privileges request went through ' + JSON.stringify(res.body));
    .catch(err =>{
    console.log('Error in privileges: ' + err);

  • NodeBB

    Looks OK to me did you put a console.log here to see if the groups and privileges are correct? Did you check the database directly to see if the change happened?

  • #3

    Hey Baris,

    In my Node.js code with superagent, the privilege should've been groups:posts:downvote rather than group:posts:downvote. I got privileges manipulation to work now!

Suggested Topics

| | | |