Discourse_api gem help

Hello all!

We’re using discourse for our user community, and the discourse_api ruby gem to pull latest and top topics for our site (using the category_latest_topics and category_top_topics methods)

However, we are having topics shown that are from (sub?) categories that have their security set so that only admins may view them.

I would assume this is because our api key has admin privileges… is there any way for us to exclude topics based on this security setting?

Thanks!
Chris

I’m not familiar with the gem…

… but my understanding is that for the Discourse API generally an “API Key” is coupled with a “Username” - all the actions take place as that username…
… so if you specify “system” these actions take place as an admin as in the default setup “system” is an admin.

If you change the username to the name of a user with limited permissions the actions will take place with those limited permissions and return the restricted results you are after.

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.