Files
talk/perms/utils.js
T
Wyatt Johnson 3f7ddddba3 perms cleanup
2017-10-26 14:27:46 -06:00

16 lines
361 B
JavaScript

const intersection = require('lodash/intersection');
/**
* check will ensure that the user has the desired roles.
*
* @param {Object} user user being checked for roles
* @param {Array<String>} roles roles to check that the user has
*/
const check = (user, roles) => {
return intersection(roles, user.roles).length > 0;
};
module.exports = {
check
};