nodebb-plugin-assign-newuser-to-group
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -1,10 +0,9 @@ | ||
var fs = require('fs'), | ||
groups = module.parent.require('./groups'), | ||
winston = module.parent.require('winston'), | ||
Meta = module.parent.require('./meta'), | ||
const winston = require.main.require('winston'); | ||
const groups = require.main.require('./src/groups'); | ||
const Meta = require.main.require('./src/meta'); | ||
AssignNewUser = {}, | ||
userGroup = null; | ||
const AssignNewUser = module.exports; | ||
let userGroup = null; | ||
AssignNewUser.init = function(params, callback) { | ||
AssignNewUser.init = async function(params) { | ||
function render(req, res, next) { | ||
@@ -14,19 +13,16 @@ res.render('admin/plugins/assign-newuser-to-group', {}); | ||
Meta.settings.get('assign-newuser-to-group', function(err, settings) { | ||
if (!err && settings && settings.userGroup) { | ||
userGroup = settings.userGroup; | ||
} else { | ||
winston.error('[plugins/assign-newuser-to-group] User group not set!'); | ||
} | ||
}); | ||
const settings = await Meta.settings.get('assign-newuser-to-group'); | ||
if (settings && settings.userGroup) { | ||
userGroup = settings.userGroup; | ||
} else { | ||
winston.error('[plugins/assign-newuser-to-group] User group not set!'); | ||
} | ||
params.router.get('/admin/plugins/assign-newuser-to-group', params.middleware.admin.buildHeader, render); | ||
params.router.get('/api/admin/plugins/assign-newuser-to-group', render); | ||
callback(); | ||
}; | ||
AssignNewUser.assignUserToGroup = function(userData) { | ||
if (userGroup != null) { | ||
groups.join(userGroup, userData.uid); | ||
AssignNewUser.assignUserToGroup = async function (hookData) { | ||
if (userGroup != null && hookData && hookData.user) { | ||
await groups.join(userGroup, hookData.user.uid); | ||
} | ||
@@ -36,4 +32,4 @@ }; | ||
AssignNewUser.admin = { | ||
menu: function(custom_header, callback) { | ||
custom_header.plugins.push({ | ||
menu: async function(header) { | ||
header.plugins.push({ | ||
"route": '/plugins/assign-newuser-to-group', | ||
@@ -43,7 +39,4 @@ "icon": 'fa-check', | ||
}); | ||
callback(null, custom_header); | ||
return header; | ||
} | ||
}; | ||
module.exports = AssignNewUser; |
{ | ||
"name": "nodebb-plugin-assign-newuser-to-group", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A plugin for NodeBB to assign new users to a specified group.", | ||
@@ -25,4 +25,4 @@ "main": "library.js", | ||
"nbbpm": { | ||
"compatibility": "^0.7.0 || ^1.0.0" | ||
"compatibility": "^1.16.0" | ||
} | ||
} |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ # NodeBB assign new user to group |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
4634
0
48
1