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.1.17 to 1.2.0

28

index.js

@@ -5,4 +5,5 @@ const AWS = require('aws-sdk')

module.exports = class AwsUserService {
constructor(authIntegrationUserPoolId) {
constructor(authIntegrationUserPoolId, userRepository) {
this.authIntegrationUserPoolId = authIntegrationUserPoolId
this.userRepository = userRepository
this.cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider()

@@ -32,2 +33,27 @@ }

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
}
// 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');
}
async getUser(userId) {

@@ -34,0 +60,0 @@ return await this.getUserById(userId)

6

package.json
{
"name": "aws-user-service",
"version": "1.1.17",
"version": "1.2.0",
"description": "Contain methods to work with asw user",

@@ -11,3 +11,5 @@ "main": "index.js",

"license": "ISC",
"dependencies": {}
"dependencies": {
"senter-mongo-repository": "^3.2.1"
}
}
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