How do we know if the current user is an adminstrator

NodeBB Development
  • Hi,

    I'm working on a enhancement found on your github : [](link url)

    I'm wondering which is the best way to know if the current user is an administrator. Actually I use the user.isAdminstrator() method with the req.user.uid parameter is that the best way to get the info?

    Thanks for the future answer and keep the good work your forum is awesome!

  • Take a look at /src/routes/user.js:500. That conditional filters out all users who are online, but actually have their status set to invisible (which returns "offline" when their user data is returned).

    Simply add a conditional that does not execute that filtering if an administrator is calling that api call. So, yes, .isAdministrator() with req.user.uid is the right way to go 😄

  • Ok, cool just wanted to make sure I was getting the adminstrator as I should.

    Speaking of that, the widget on the dashboard seems to count offline users as well as online user even if the current user isn't an admin.

Suggested Topics

  • 0 Votes
    3 Posts
  • 0 Votes
    2 Posts
  • requesting user reputation

    NodeBB Development
    0 Votes
    9 Posts
  • User Icons Testing

    NodeBB Development
    2 Votes
    59 Posts