Skip to content

Commit aed5da5

Browse files
Merge pull request #144 from gjsjohnmurray/pre-sync-2.0.10
Sync prerelease with 2.0.10
2 parents 1126946 + eb0a62c commit aed5da5

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 3.1.2022062901 (29-Jun-2022 pre-release)
2+
* Add 2.0.10 changes.
3+
14
## 3.1.2022042001 (20-Apr-2022 pre-release)
25
* Add 2.0.8 and 2.0.9 changes.
36

@@ -14,6 +17,11 @@
1417
## 3.0.0 (27-Nov-2021 pre-release)
1518
* Implement `intersystems-server-credentials` authentication provider.
1619
*
20+
## 2.0.10 (29-Jun-2022)
21+
* Accept self-signed certificates if `http.proxyStrictSSL` is set to `false` (#137).
22+
* Notify when SQL GRANT will be necessary in order to display list of server-side projects (#140).
23+
* Reuse session-cached username if server definition lacks one (#141).
24+
1725
## 2.0.9 (20-Apr-2022)
1826
* Add support for server-side projects (#131).
1927

src/api/getServerSpec.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ export async function getServerSpec(
5353
server.password = undefined;
5454
} else {
5555

56-
// Obtain a username (including blank to try connecting anonymously)
56+
// Use cached username if appropriate
57+
if (!server.username && !useOurAuthProvider && credentialCache[name]) {
58+
server.username = credentialCache[name].username;
59+
}
60+
61+
// Prompt for a username if necessary (including blank to try connecting anonymously)
5762
if (!server.username && !useOurAuthProvider) {
5863
await vscode.window
5964
.showInputBox({

src/makeRESTRequest.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import axios, { AxiosResponse } from "axios";
55
import axiosCookieJarSupport from "axios-cookiejar-support";
6+
import * as https from "https";
67
import tough = require("tough-cookie");
78
import * as vscode from "vscode";
89
import { AUTHENTICATION_PROVIDER } from "./authenticationProvider";
@@ -36,8 +37,11 @@ export async function makeRESTRequest(
3637
data?: any,
3738
): Promise<AxiosResponse | undefined> {
3839

39-
// Build the URL
40-
let url = server.webServer.scheme + "://" + server.webServer.host + ":" + String(server.webServer.port);
40+
// Create the HTTPS agent
41+
const httpsAgent = new https.Agent({ rejectUnauthorized: vscode.workspace.getConfiguration("http").get("proxyStrictSSL") });
42+
43+
// Build the URL
44+
let url = server.webServer.scheme + "://" + server.webServer.host + ":" + String(server.webServer.port);
4145
const pathPrefix = server.webServer.pathPrefix;
4246
if (pathPrefix && pathPrefix !== "") {
4347
url += pathPrefix;
@@ -54,6 +58,7 @@ export async function makeRESTRequest(
5458
// There is a data payload
5559
respdata = await axios.request(
5660
{
61+
httpsAgent,
5762
data,
5863
headers: {
5964
"Content-Type": "application/json",
@@ -74,6 +79,7 @@ export async function makeRESTRequest(
7479
// Either we had no cookies or they expired, so resend the request with basic auth
7580
respdata = await axios.request(
7681
{
82+
httpsAgent,
7783
auth: {
7884
password: server.password,
7985
username: server.username,
@@ -94,6 +100,7 @@ export async function makeRESTRequest(
94100
// No data payload
95101
respdata = await axios.request(
96102
{
103+
httpsAgent,
97104
jar: cookieJar,
98105
method,
99106
url: encodeURI(url),
@@ -110,6 +117,7 @@ export async function makeRESTRequest(
110117
// Either we had no cookies or they expired, so resend the request with basic auth
111118
respdata = await axios.request(
112119
{
120+
httpsAgent,
113121
auth: {
114122
password: server.password,
115123
username: server.username,

src/ui/serverManagerView.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,16 @@ async function namespaceProjects(element: ProjectsTreeItem, params?: any): Promi
545545
{ query: "SELECT Name, Description FROM %Studio.Project", parameters: [] }
546546
);
547547
if (response !== undefined) {
548+
if (response.data.result.content === undefined) {
549+
let message;
550+
if (response.data.status?.errors[0]?.code === 5540) {
551+
message = `To allow user '${serverSpec.username}' to list projects in namespace '${params.ns}', run this SQL statement there using an account with sufficient privilege: GRANT SELECT ON %Studio.Project TO ${serverSpec.username}`;
552+
} else {
553+
message = response.data.status.summary;
554+
}
555+
vscode.window.showErrorMessage(message);
556+
return undefined;
557+
}
548558
response.data.result.content.map((project) => {
549559
children.push(new ProjectTreeItem({ parent: element, label: name, id: name }, project.Name, project.Description));
550560
});

0 commit comments

Comments
 (0)