@studyportals/client-internal-platform-authorization
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "@studyportals/client-internal-platform-authorization", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Typescript library containing resources that facilitate performing user privileges checks for operations exposed in client and internal facing products.", | ||
@@ -5,0 +5,0 @@ "main": "bin/index.js", |
@@ -25,2 +25,9 @@ /** | ||
/** | ||
* Checks whether the specified user can access the given study. | ||
* | ||
* @param username The username of the user whose privileges are to be checked. | ||
* @param studyId The ID of the targeted study. | ||
*/ | ||
canAccessStudy(username: string, studyId: string): Promise<boolean>; | ||
/** | ||
* Filters an array of organisation IDs, considering whether the given user has access to their data. | ||
@@ -27,0 +34,0 @@ * |
@@ -12,2 +12,3 @@ import { ISuperAgentRequestFactory } from "@studyportals/mb-platform-http-requests"; | ||
canAccessOrganisation(username: string, organisationId: string): Promise<boolean>; | ||
canAccessStudy(username: string, studyId: string): Promise<boolean>; | ||
filterOrganisationsByUserAccess(username: string, organisationIds: string[]): Promise<string[]>; | ||
@@ -14,0 +15,0 @@ filterCampaignsByUserAccess(username: string, campaignIds: string[]): Promise<string[]>; |
@@ -43,2 +43,9 @@ "use strict"; | ||
} | ||
canAccessStudy(username, studyId) { | ||
const request = this.requestsFactory.post(`${this.baseUrl}studies`); | ||
return new Promise((resolve) => { | ||
request.send({ username: username, studyId: studyId }); | ||
request.end((err, res) => this.handleAuthorizationRequest(err, res, resolve)); | ||
}); | ||
} | ||
filterOrganisationsByUserAccess(username, organisationIds) { | ||
@@ -45,0 +52,0 @@ const request = this.requestsFactory.post(`${this.baseUrl}organisations/multiple`); |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
15336
186
1