Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@c8o/nimbus-core

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@c8o/nimbus-core - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

45

dist/Auth/AccessHandler.js
const Roles = require('../Models/Roles')
const UserRoles = require('../Models/UsersRoles')
const JwtHandler = require('./JwtHandler')

@@ -18,11 +17,11 @@

try {
const tokenObject = await JwtHandler.validate(token)
const requiredRoleId = await this.getRoleIdFromRoleName(requiredRoleName)
const userRolesObject = await this.getAllUserRoles(tokenObject.user.id)
// const tokenObject = await JwtHandler.validate(token)
// const requiredRoleId = await this.getRoleIdFromRoleName(requiredRoleName)
// const userRolesObject = await this.getAllUserRoles(tokenObject.user.id)
for (let i in userRolesObject) {
if (userRolesObject[i].role_id === requiredRoleId._id) {
return true
}
}
// for (let i in userRolesObject) {
// if (userRolesObject[i].role_id === requiredRoleId._id) {
// return true
// }
// }
} catch (error) {

@@ -44,9 +43,9 @@ return error.type

*/
static async getAllUserRoles(id) {
try {
return await UserRoles.find({ user_id: id })
} catch (error) {
throw new Error(error)
}
}
// static async getAllUserRoles(id) {
// try {
// return await UserRoles.find({ user_id: id })
// } catch (error) {
// throw new Error(error)
// }
// }

@@ -62,11 +61,11 @@ /**

*/
static async getRoleIdFromRoleName(roleName) {
try {
return await Roles.findOne({ name: roleName })
} catch (error) {
throw new Error(error)
}
}
// static async getRoleIdFromRoleName(roleName) {
// try {
// return await Roles.findOne({ name: roleName })
// } catch (error) {
// throw new Error(error)
// }
// }
};
module.exports = AccessHandler
{
"name": "@c8o/nimbus-core",
"version": "0.0.2",
"version": "0.0.3",
"description": "Nimbus core package",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc