Programmatic access to CSP Server Access

Caché

Is there a way to modify the CSP Server Access settings programmatically, instead of through the management portal?

  • 0
  • 0
  • 142
  • 2
  • 1

Answers

Yes.

USER>set reg = $system.CSP.GetGatewayRegistry()

USER>set managers = reg.GetGatewayMgrs("a")

USER>write managers.Size // you can have many CSP Gateways connected to this Caché instance
1
USER>set mgr = managers.GetAt(1) // I only have one

USER>write mgr.GetThisServerName(.names)
1
USER>zwrite names // this server is listed in CSP Gateway Configuration as 'LOCAL'.
names(0)="LOCAL"
USER>kill params

USER>set params("Username")="CSPSystem"

USER>set params("Password")="very strong password"

USER>write mgr.SetServerParams("LOCAL",.params)
1

USER>write mgr.CloseConnections("LOCAL") // close connections, forcing to reconnect with new credentials.
1

Please be careful, if username/password are not valid for connection to Caché, then CSP Gateway will not be able to reconnect, and you'll loose connection with CSP Gateway and ability to modify settings using this API.

For more details see
1. https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY...
2. Class reference for classes in package %CSP.Mgr

Hi, Alex!

Didn’t know that it is possible. Just a question: how username/password can be not valid if they are being set new with this API?

These are credentials for CSP Gateway to use for connecting to Caché. If there is no such username/password pair in Caché or if corresponding user does not have enough privileges, then this username/password pair is not valid.

Comments

Connection Security Level, User name, and password.