Programmatic access to CSP Server Access
Is there a way to modify the CSP Server Access settings programmatically, instead of through the management portal?
Comments
Probably. What setting do you need to modify?
Connection Security Level, User name, and password.
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?
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
- https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GCGI_registry
- Class reference for classes in package %CSP.Mgr
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.