• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

Accessing nodeBB functions via Cron Jobs

Scheduled Pinned Locked Moved Plugin Development
7 Posts 3 Posters 2.2k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alexschomb
    wrote on last edited by
    #1

    Hey,

    How can I access nodeBB's functions via crond? I'd like to automatically sync the nodebb database against another database (primarily users and groups) every 5 minutes or so. This would require me to access core functions like "User.getUidByUsername()" or "User.create()" from inside the cronjob. Is there any plugin that does this already?

    Thanks for your help!

    1 Reply Last reply
    0
  • julianJ Offline
    julianJ Offline
    julian GNU/Linux
    wrote on last edited by
    #2

    I don't think so... your best bet is to code a NodeBB plugin that pings the second service when a new user is created.

    1 Reply Last reply
    0
  • A Offline
    A Offline
    alexschomb
    wrote on last edited by alexschomb
    #3

    I already have my own plugin that does synchronize every time a user logs in. But, this means that logged in users won't be up to date as long as their session still exists ("stay logged in"). This can be annoying for changes of group memberships, but it can also be a security issue for changes in the ban status of an existing user.

    If I understood you right the service to service ping that happens if a new user is created wouldn't help the issue either.

    Any chance for an API that allows CRUD operations on users, settings and groups?

    1 Reply Last reply
    0
  • julianJ Offline
    julianJ Offline
    julian GNU/Linux
    wrote on last edited by
    #4

    @alexschomb Something like this? 😄

    1 Reply Last reply
    0
  • A Offline
    A Offline
    alexschomb
    wrote on last edited by
    #5

    Yes. That's great, thank you!

    I read through the documentation of the API and found out that I need to provide _uid for usage with a master token. Is there any way to find out about the UID of a certain username via the API? (similar to User.getUidByUsername())

    The API allows us to request membership to private groups. Is there an API call to accept this membership request with the _uid of an admin user? Or is it even possible to add/remove a certain user (different to the _uid) to a certain group using an admin _uid?

    pichaliteP 1 Reply Last reply
    0
  • pichaliteP Offline
    pichaliteP Offline
    pichalite Plugin & Theme Dev
    replied to alexschomb on last edited by
    #6

    @alexschomb may be you can use this?

    https://community.nodebb.org/api/user/alexschomb

    1 Reply Last reply
    0
  • A Offline
    A Offline
    alexschomb
    wrote on last edited by
    #7

    Thanks, that should do the trick! 🙂

    Gonna post my cronjob as soon as it's ready. Can take a few days, because of christmas.

    1 Reply Last reply
    1

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development