Skip to content

Commit

Permalink
Merge pull request #123 from bwyx/patch-1
Browse files Browse the repository at this point in the history
better roles config
  • Loading branch information
hagopj13 committed Jun 6, 2021
2 parents d2aec4f + 19cda9c commit ca23415
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/config/roles.js
@@ -1,8 +1,10 @@
const roles = ['user', 'admin'];
const allRoles = {
user: [],
admin: ['getUsers', 'manageUsers'],
};

const roleRights = new Map();
roleRights.set(roles[0], []);
roleRights.set(roles[1], ['getUsers', 'manageUsers']);
const roles = Object.keys(allRoles);
const roleRights = new Map(Object.entries(allRoles));

module.exports = {
roles,
Expand Down
1 change: 1 addition & 0 deletions src/services/token.service.js
Expand Up @@ -11,6 +11,7 @@ const { tokenTypes } = require('../config/tokens');
* Generate token
* @param {ObjectId} userId
* @param {Moment} expires
* @param {string} type
* @param {string} [secret]
* @returns {string}
*/
Expand Down

0 comments on commit ca23415

Please sign in to comment.