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

@rss/common

Package Overview
Dependencies
Maintainers
1
Versions
895
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rss/common - npm Package Compare versions

Comparing version 0.0.30 to 0.0.31

yarn-error.log

10

dist/helper/permission.helper.js

@@ -41,7 +41,7 @@ 'use strict';

module.exports.hasManageAccessToInventory = function (inventory, user) {
return module.exports.isChemAdmin(user.campusCode, user) || module.exports.isManagerOfInventory(inventory, user) || module.exports.isGroupOwner(inventory, user) || module.exports.isGroupDelegate(inventory, user);
return user && module.exports.isChemAdmin(user.campusCode, user) || inventory && user && (module.exports.isManagerOfInventory(inventory, user) || module.exports.isGroupOwner(inventory, user) || module.exports.isGroupDelegate(inventory, user));
};
module.exports.isManagerOfInventory = function (inventory, user) {
return inventory.owner.userId === user.userId || (inventory.permissions || []).find(function (permission) {
return (inventory.owner || {}).userId === user.userId || (inventory.permissions || []).find(function (permission) {
return permission.type === 'MANAGE' && permission.userId === user.userId;

@@ -52,3 +52,3 @@ });

module.exports.isGroupOwner = function (inventory, user) {
return inventory.groups.some(function (group) {
return (inventory.groups || []).some(function (group) {
return group.owner.userId === user.userId;

@@ -59,4 +59,4 @@ });

module.exports.isGroupDelegate = function (inventory, user) {
return user.roles.filter(function (role) {
return inventory.groups.some(function (item) {
return (user.roles || []).filter(function (role) {
return (inventory.groups || []).some(function (item) {
return item.id === role.groupId;

@@ -63,0 +63,0 @@ });

{
"name": "@rss/common",
"version": "0.0.30",
"version": "0.0.31",
"description": "common constant, classes, & helper",

@@ -5,0 +5,0 @@ "author": "Risk & Safety Solution",

@@ -32,16 +32,19 @@ const ROLES = require('../constant/core/roles.constant');

module.exports.hasManageAccessToInventory = (inventory, user) =>
module.exports.isChemAdmin(user.campusCode, user) ||
module.exports.isManagerOfInventory(inventory, user) ||
module.exports.isGroupOwner(inventory, user) ||
module.exports.isGroupDelegate(inventory, user);
(user && module.exports.isChemAdmin(user.campusCode, user)) ||
(inventory &&
user &&
(module.exports.isManagerOfInventory(inventory, user) ||
module.exports.isGroupOwner(inventory, user) ||
module.exports.isGroupDelegate(inventory, user)));
module.exports.isManagerOfInventory = (inventory, user) =>
inventory.owner.userId === user.userId ||
(inventory.owner || {}).userId === user.userId ||
(inventory.permissions || []).find((permission) => permission.type === 'MANAGE' && permission.userId === user.userId);
module.exports.isGroupOwner = (inventory, user) => inventory.groups.some((group) => group.owner.userId === user.userId);
module.exports.isGroupOwner = (inventory, user) =>
(inventory.groups || []).some((group) => group.owner.userId === user.userId);
module.exports.isGroupDelegate = (inventory, user) =>
user.roles
.filter((role) => inventory.groups.some((item) => item.id === role.groupId))
(user.roles || [])
.filter((role) => (inventory.groups || []).some((item) => item.id === role.groupId))
.some((role) => role.role === ROLES.DELEGATE);

@@ -48,0 +51,0 @@

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