intersystems-community / vscode-objectscript

InterSystems ObjectScript extension for Visual Studio Code
https://docs.intersystems.com/components/csp/docbook/DocBook.UI.Page.cls?KEY=GVSCO
Other
108 stars 49 forks source link

SQL Privilege errors in V.1.12.0-beta.8 #1306

Closed S-Hahne closed 9 months ago

S-Hahne commented 9 months ago

Dear team,

I was just made aware that we're getting the following messages from the ObjectScript extension since the automatic update to 1.12.0 today: ERROR #5540: SQLCODE: -99 Message: User <username hidden> is not privileged for the operation

I tracked this behaviour to have changed between 2.12.0-beta.7 and -beta.8 Hopefully the changes are small enough to track the issue without much effort.

Does anyone know the SQL privileges that are now required to work with the extension? Our server is locked down, so we will most likely need to add some rights to the %Developer role again.

Best regards, Sebastian

isc-bsaviano commented 9 months ago

@S-Hahne Thanks for the version information. What operations are you doing when the error occurs?

S-Hahne commented 9 months ago

Hi @isc-bsaviano,

this just happens when opening a class definition from one of our namespaces.

Sorry, forgot to mention that in the issue description.

isc-bsaviano commented 9 months ago

The most important query to have permission on is StudioOpenDialog, but that's not new for this version. Are you using server-side editing or client-side editing? Also, Ii you upgrade to IRIS 2021.1.3+, 2022.1.1+ or 2022.2+ you shouldn't get SQL permissions errors due to a server-side bug fix.

S-Hahne commented 9 months ago

The permission on StudioOpenDialog is for sure granted. We've done that years ago and this issue just arises from the 0-beta.7 to 0-beta.8 and is gone if I roll back. So the answer to our issue must be somewhere in here.

I think I found the issue: In line 293 of src/commands/unitTest.ts "SELECT Name||'.cls' FROM %Dictionary.ClassDefinition_SubclassOf('%UnitTest.TestCase','@')"

As soon as I grant EXECUTE on this SQL procedure in the namespace, the error message vanishes.

Does this sound reasonable? And is this privilege included in the newer IRIS versions you mentioned?

isc-bsaviano commented 9 months ago

@S-Hahne What version of IRIS are you connected to? Yes, that query was added but I'm not sure why it's being run if you have a server version old enough to report these permissions errors. That unit test code should only be run if your server is 2023.3 or newer. If it's running for all servers then there's a bug that I need to fix.

S-Hahne commented 9 months ago

It's IRIS for Windows (x86-64) 2020.1.4 (Build 536U)

I have removed the privilege again from our %Developer role. Let me know once you have a fixed version for me to test :)

isc-bsaviano commented 9 months ago

@S-Hahne Can you please download and install the vsix found here? This should fix your issue.

S-Hahne commented 9 months ago

Hi Brett,

yes, it does. No more SQLCODE -99 messages when I open a class. Many thanks. Should I close the Issue here or will you do that?

Please let me know the version number (2.12.1-beta-which?) of the fix once that is published. Then I'll be able to spread the word to my fellow colleagues.

Best regards, Sebastian

isc-bsaviano commented 9 months ago

Thanks for testing! I'm glad the fix worked. This issue will close automatically when the pull request is merged. The version will almost certainly be 2.12.1-beta.2

isc-bsaviano commented 9 months ago

@S-Hahne 2.12.1-beta.2 has been built and can be found here