aws-user-service
Advanced tools
Comparing version 1.1.0 to 1.1.1
40
index.js
@@ -10,4 +10,19 @@ const AWS = require('aws-sdk'); | ||
extractUserIdFromRequest(request) { | ||
return request.apiGateway.event.requestContext.identity.cognitoAuthenticationProvider.split(':').pop() | ||
} | ||
getUserIdFromRequest(request) { | ||
return request.apiGateway.event.requestContext.identity.cognitoAuthenticationProvider.split(':').pop(); | ||
const realUserId = extractUserIdFromRequest(request) | ||
if (!request.query.impersonatingUserId) { | ||
return realUserId | ||
} | ||
// check if current user is Admin | ||
if (await this.isAdmin(realUserId) === true) { | ||
// return impersonating user id | ||
return request.query.impersonatingUserId | ||
} | ||
throw new Error('Non admin attempt to impersonate'); | ||
} | ||
@@ -86,10 +101,2 @@ | ||
async impersonateUser(userId, user) { | ||
} | ||
async removeImpersonation(userId) { | ||
//await updateUserAttributes(userId, ) | ||
} | ||
async updateUserAttributes(userId, attributeName, attributeValue) { | ||
@@ -109,17 +116,2 @@ | ||
} | ||
async updateUserAttributes(userId, attributeName, attributeValue) { | ||
var params = { | ||
"UserAttributes": [ | ||
{ | ||
"Name": attributeName, | ||
"Value": attributeValue | ||
} | ||
], | ||
"Username": userId, | ||
"UserPoolId": this.authIntegrationUserPoolId | ||
} | ||
return await this.cognitoidentityserviceprovider.adminUpdateUserAttributes(params).promise() | ||
} | ||
} |
{ | ||
"name": "aws-user-service", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Contain methods to work with asw user", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3781
91