go to post Robert Hurst · Sep 13, 2023 Please consider returning the error code as shown below for when you are NOT providing a delegated set of credentials. We use this to allow for "break the glass" access by an authorized Systems Administrator using sudo irisdb without having them required to enter another password: GetCredentials(ServiceName,Namespace,Username,Password,Credentials) Public { s $zt="Error" // The following example sets the processes Username/Password without prompting them // to _SYSTEM/SYS if a console,and Admin/SYS if a telnet user. // If a Bindings service, then we will go through the normal login screen. ; i ServiceName="%Service_Console" { ; s Username="_SYSTEM" ; s Password="SYS" ; q $SYSTEM.Status.OK() ; } ;do ##class(%SYS.System).WriteToConsoleLog("GetCredentials("_$g(ServiceName)_","_$g(Namespace)_","_$g(Username)_","_$g(Password)_","_$g(Credentials)_")",0,0) if (ServiceName = "%Service_Terminal") && ($username = "root") { set Username = "root" set Password = "should match whatever is set for local user" quit $SYSTEM.Status.OK() } // For Bindings applications, force them to normally enter a username ; i ServiceName="%Service_Bindings" q $SYSTEM.Status.Error($$$GetCredentialsFailed) // If a CSP application, we can test for a specific application by looking at // the request object. If it exists, then the request is from a CSP application. ;If $isobject($get(%request)) { ; if %request.Application="/csp/samples/" { ; set Username="_SYSTEM" ; set Password="SYS" ; quit $System.Status.OK() ; } ;} // Here is an example where I get the username and password out of a http request where the password // was set the following way: // d httpreq.InsertParam("username","TESTDEL") // d httpreq.InsertParam("password","SYS") ;If $isobject($get(%request)) { ; if %request.Application="/csp/samples/" { ; s Username=$get(%request.Data("username",1)) ; s Password=$get(%request.Data("password",1)) ; quit $System.Status.OK() ; } ;} // For any other service, deny them access ;q $SYSTEM.Status.Error($$$AccessDenied) // By default, we allow the system to do its normal Username/Password prompting. q $SYSTEM.Status.Error(1419 /*$$$GetCredentialsFailed*/) Error //Handle any COS errors here //Reset error trap to avoid infinite loop s $zt="" //Return the generalized COS error message #5002 q $SYSTEM.Status.Error(5002 /*$$$CacheError*/,$ze) }
go to post Robert Hurst · Jan 12, 2023 I won't repeat the excellent definitions already provided, but can share some examples of class parameters where we use them: Parameter FILES = "/files"; Parameter INSTANCE As COSEXPRESSION = "$p($SYSTEM, "":"", 2)"; Parameter RUNLEVEL As COSEXPRESSION = "$li($lb(""dev"",""Test"",""LIVE""), $lf($lb(""HCDEV"",""HCTEST"",""HCLIVE""), ..#INSTANCE))"; We use ..#FILES to prefix or normalize a directory off the top-level filesystem on the server. We use ..#INSTANCE if we need to identify which IRIS instance, like in an email message, it came from. We use ..#RUNLEVEL in conditionals or pass as a parameter, where we might want code only to run on "Test" or "LIVE".
go to post Robert Hurst · Feb 3, 2021 lol, reading is fundamental. Thank you for pointing out what should have been obvious. I missed the "User" in your example as a custom implementation. I just reviewed these provided adapters, very nice! What continues to puzzle me is why the product does not provide a Business Operation off them (and others). I know, support issues, right? I just completed a custom "adaptation" using their provided Util.Pipe adapter, because the code was a bit crusty. It did serve as nice reference source, just not as nice as these SQL adapters.
go to post Robert Hurst · Feb 3, 2021 ... because we're running 2018 and that SQL operation does not exist to use in our operations: Cache for UNIX (Red Hat Enterprise Linux for x86-64) 2018.1.4 (Build 505_1U) Thu May 28 2020 10:11:16 EDT [HealthShare Modules:Core:15.032.9035 + Linkage Engine:15.032.9035]
go to post Robert Hurst · Feb 3, 2021 Can you expand upon your question a little more? I just posted an article for sending message data to an external SQL database -- but by invoking a Stored Procedure (not SQL inserts or transactions), which I find eminently better to keep that business logic out of the messaging bus. https://community.intersystems.com/post/ensemble-operation-calling-sql-s...
go to post Robert Hurst · Feb 3, 2021 @Oliver Wilms: What version ($ZV) are you referencing that SQL operation / adapter please? Thanks in advance.
go to post Robert Hurst · Jan 28, 2021 There's a plethora of ways to get license information, as Marcel pointed out, through $SYSTEM.License. The online class reference show the methods and queries, with sample code, available to invoke: https://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?... From a command-line (list instance name(s) running, i.e., CACHE) that can be setup to run as a secure remote procedure call; or what we do is have scripts that feed back this data to our Nagios monitor for hosts/instances: $ ccontrol all$ ccontrol stat CACHE -a0 -L1 Hope this helps.