New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

aws-user-service

Package Overview
Dependencies
Maintainers
2
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-user-service - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

29

index.js

@@ -0,3 +1,6 @@

const MongoRepository = require('senter-mongo-repository')
const AWS = require('aws-sdk')
AWS.config.update({ region: process.env.REGION })
var noOrganisationOptions = MongoRepository.BuildCallOptions(true, false)

@@ -33,24 +36,8 @@ module.exports = class AwsUserService {

async getOrganisationIdFromRequest(request) {
const realUserId = this.getActualUserIdFromRequest(request)
if (!request.query.impersonatingUserId) {
const user = await this.userRepository.getById(realUserId, realUserId)
if (!user) {
throw new Error('User not found')
}
return user.organisationId
const userId = getUserIdFromRequest(request)
const user = await this.userRepository.getById(userId, null, noOrganisationOptions)
if (!user) {
throw new Error('User not found')
}
// check if current user is Admin
const adminCheckSuccessful = await this.isAdmin(realUserId)
if (adminCheckSuccessful === true) {
// return impersonating user's organisation id
const user = await this.userRepository.getById(request.query.impersonatingUserId, request.query.impersonatingUserId)
if (!user) {
throw new Error('User not found')
}
return user.organisationId
}
console.log('No admin permission to impersonate user', request.query.impersonatingUserId)
throw new Error('Non admin attempt to impersonate');
return user.organisationId
}

@@ -57,0 +44,0 @@

{
"name": "aws-user-service",
"version": "1.2.0",
"version": "1.2.1",
"description": "Contain methods to work with asw user",

@@ -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