intersystems-community / intersystems-servermanager

VS Code helper extension defining connections to InterSystems servers

Home Page:https://marketplace.visualstudio.com/items?itemName=intersystems-community.servermanager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Access error

eduard93 opened this issue · comments

I'm getting an error trying to connect to a server with a user (without %ALL):

This server does not have specified namespace '%SYS'.
You must select one of the following: HSCUSTOM, HSLIB, USER.

But how do I specify a USER namespace as a default?

My settings.json looks like this:

{
    "intersystems.servers": {
        "myServer": {
            "webServer": {
                "scheme": "https",
                "host": "myaddress.com",
                "port": 443
            },
            "username": "eduard93",
        }
    }
}

In servers view I can view a list of namespaces but clicking on a Projects results in:

Cannot read properties of undefined (reading 'map')

I have validated that these queries work under eduard93 user (from the browser):

  • /api/atelier/
  • /api/atelier/v5/USER
  • /api/atelier/v5/USER/docnames
  • /api/atelier/v5/USER/doc/%25Api.Atelier.cls

Clicking on a Projects as a %ALL user I see the same error.

But in VSCode explorer everything works.

Caused by the assumption made here.

// Revalidate and extend existing token, or obtain a new one
const response = await makeRESTRequest("POST", spec, { apiVersion: 1, namespace: '%SYS', path:'/action/query' }, { query: 'select %Atelier_v1_Utils.General_GetCSPToken(?, ?) token', parameters: [PORTAL_HOME, token]});

To run any query we need to specify a namespace.

I guess we should get the list of namespaces the user has access to and use the first one.

Is it hard to implement this change? USER could be a better default as a quick workaround.

@gjsjohnmurray are there any news on this issue?

Here's a pull request with a temporary workaround, please consider merging it: #139

@eduard93 with Global Summit over I took a closer look at this issue. My previous response misdiagnosed the cause of the message you reported. The lines I pointed to are only used to try and pre-authenticate the Portal page when you use one of these command buttons in the Server Manager tree:

image

Based on my testing with a user who doesn't have the %DB_IRISSYS:R privilege, the only consequence is that they may have to enter credentials when launching Portal from Server Manager.

Your message actually comes from the vscode-objectscript extension here:

https://github.com/intersystems-community/vscode-objectscript/blob/14ded9b136f4f643990977a15ed0781c8f1137a0/src/api/index.ts#L445-L449

I'm guessing you're using the client-side editing paradigm, not server-side (isfs), right?

What does your objectscript.conn settings object contain? In particular, what is its ns property set to?

Please check this at the User level (i.e. your local settings.json file) and at the Workspace level (i.e. .vscode/settings.json in the folder you opened in VS Code).

@gjsjohnmurray Found it in the workspace. Looks like this:

{
    "objectscript.conn": {
        "server": "myServer",
        "ns": "USER",
        "active": true
    }
}

I see in console:

workbench.desktop.main.js:802 TypeError: Cannot read properties of undefined (reading 'map')
	at ProjectsTreeItem.<anonymous> (c:\Users\elebedyu\.vscode\extensions\intersystems-community.servermanager-2.0.9\out\ui\serverManagerView.js:429:46)
	at Generator.next (<anonymous>)
	at fulfilled (c:\Users\elebedyu\.vscode\extensions\intersystems-community.servermanager-2.0.9\out\ui\serverManagerView.js:5:58)
	at processTicksAndRejections (node:internal/process/task_queues:96:5)

That's here.

My user can execute SELECT Name, Description FROM %Studio.Project, but it returns no results.

I just need to browse the server.

@eduard93 please try the dev VSIX from the zip at https://github.com/intersystems-community/intersystems-servermanager/suites/7134425170/artifacts/283337062

With this, when you expand the Projects folder of a namespace and your user account doesn't have the %All role you should now see an error notification telling you the GRANT statement you need to run in that namespace (as a suitably privileged user).

Thank you @gjsjohnmurray !

@eduard93 we have now published 2.0.10