Make a chat room "read only" for certain users

Technical Support

Suggested Topics

  • 0 Votes
    6 Posts

    @razibal I've changed how this works on the develop branch, instead of checking the online status it will check if the user has already read the chat, this should cause an email to be sent to all users who haven't seen the chat message.

  • 0 Votes
    8 Posts

    I think the real issue is to figure out why they were empty in the first place. When a user is created user:136 object and the entry in users:joindate should be both created.

    In this case you will have to run a custom script to add the missing entries. Place the following code in a javascript file name custom_scripts.js in your nodebb folder and run it with node custom_script.js

    /* globals require, console, process */ 'use strict'; const nconf = require('nconf'); nconf.file({ file: 'config.json', }); nconf.defaults({ base_dir: __dirname, views_dir: './build/public/templates', upload_path: 'public/uploads', }); const db = require('./src/database'); db.init(async (err) => { if (err) { console.log(`NodeBB could not connect to your database. Error: ${err.message}`); process.exit(); } await addMissingJoinDates(); console.log('done'); process.exit(); }); async function addMissingJoinDates() { const batch = require('./src/batch'); const user = require('./src/user'); const total = await db.sortedSetCard('users:joindate'); let counter = 0; await batch.processSortedSet('users:joindate', async (uids) => { const userData = await user.getUsersFields(uids, ['uid', 'joindate']); counter += uids.length; await db.sortedSetAddBulk( => ['users:joindate', data.joindate, userData.uid]) ); console.log(`${counter} / ${total}`); }, { batch: 500, }); }
  • 0 Votes
    1 Posts

    Hi all,

    still continuing on my OAuth2 plugin implementation, I've a problem I can't actually solve and need you valuable advises.

    I've this fragment in my plugin

    OAuth.getStrategy = function (strategies, callback) { winston.verbose('[maxonID] --> OAuth.getStrategy'); if (configOk) { passportOAuth = require('passport-oauth2'); passportOAuth.Strategy.prototype.userProfile = function (accessToken, done) { if (!accessToken) { done(new Error('Missing token, cannot call the userinfo endpoint without it.')); } this._oauth2.useAuthorizationHeaderforGET(true); this._oauth2.get(constants.userRoute, accessToken, function (err, body, res) { if (err) { console.error(err); return done(new Error('Failed to get user info. Exception was previously logged.')); } if (res.statusCode < 200 || res.statusCode > 299) { return done(new Error('Unexpected response from userInfo. [' + res.statusCode + '] [' + body + ']')); } OAuth.validateEntitlement(accessToken, constants.allowedEntitlement, function (err, accessAllowed) { if (err) { return done(err); } if (!accessAllowed) { // Need to find a way to gracefully notify the user and point back to login page return done(new Error('Forum access is not granted. Please contact your representative.')); } try { var json = JSON.parse(body); OAuth.parseUserReturn(json, function (err, profile) { ...

    and I'd like to return the user to the forum login page and notify him about the issue, something like when the password is wrong. Is there a smart way to make it happen from such a plugin without rising an error?

    Thanks a lot for your valuable insights, R.

  • 0 Votes
    5 Posts

    Problem solved, for the record I have added all file on my GitHub:

  • 1 Votes
    2 Posts

    I am also facing the same issue.
    I am running NodeBB v1.13.x and whenever I am trying to hit http://localhost:4567/admin/manage/privileges, Access Denied(403) message is coming. I am using bearer token for authorization. Please let me know if anyone know the solution.