1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-20 02:20:05 +00:00

feat(create-context): add list of authorized users

This commit is contained in:
Krishna Acondy
2020-09-06 21:32:48 +01:00
parent fc1d54d105
commit 26c8946fd5
2 changed files with 24 additions and 14 deletions

View File

@@ -201,6 +201,7 @@ export class SASViyaApiClient {
launchContextName: string, launchContextName: string,
sharedAccountId: string, sharedAccountId: string,
autoExecLines: string, autoExecLines: string,
authorizedUsers: string[],
accessToken?: string accessToken?: string
) { ) {
if (!contextName) { if (!contextName) {
@@ -223,10 +224,7 @@ export class SASViyaApiClient {
headers.Authorization = `Bearer ${accessToken}` headers.Authorization = `Bearer ${accessToken}`
} }
const createContextRequest: RequestInit = { const requestBody: any = {
method: 'POST',
headers,
body: JSON.stringify({
name: contextName, name: contextName,
environment: { environment: {
autoExecLines: autoExecLines || '' autoExecLines: autoExecLines || ''
@@ -234,12 +232,22 @@ export class SASViyaApiClient {
launchContext: { launchContext: {
contextName: launchContextName contextName: launchContextName
}, },
authorizeAllAuthenticatedUsers: true,
attributes: { attributes: {
reuseServerProcesses: true, reuseServerProcesses: true,
runServerAs: sharedAccountId runServerAs: sharedAccountId
} }
}) }
if (authorizedUsers && authorizedUsers.length) {
requestBody['authorizedUsers'] = authorizedUsers
} else {
requestBody['authorizeAllAuthenticatedUsers'] = true
}
const createContextRequest: RequestInit = {
method: 'POST',
headers,
body: JSON.stringify(requestBody)
} }
const { result: context } = await this.request<Context>( const { result: context } = await this.request<Context>(

View File

@@ -112,6 +112,7 @@ export default class SASjs {
launchContextName: string, launchContextName: string,
sharedAccountId: string, sharedAccountId: string,
autoExecLines: string, autoExecLines: string,
authorizedUsers: string[],
accessToken: string accessToken: string
) { ) {
if (this.sasjsConfig.serverType !== ServerType.SASViya) { if (this.sasjsConfig.serverType !== ServerType.SASViya) {
@@ -122,6 +123,7 @@ export default class SASjs {
launchContextName, launchContextName,
sharedAccountId, sharedAccountId,
autoExecLines, autoExecLines,
authorizedUsers,
accessToken accessToken
) )
} }