Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
Same OI account -> different clients - > different database attaches
Was wanting advise on best practice for the following situation:
Where we have the Same OI account -> different clients - > different database attaches
On Desktop we get around by passing /DPATH= to attach
At the moment we had clients with different OI accounts so just checked that and lookedup data location.
Now we have a situation where we have 2 clients(sub companies) same OI copy and same OI account.
So, how can I pass the location of the database folder to attach with each request. Initial logon then subsequent.
Hope I have explained enough to get the gist.
I am sure I am not unique in this environment setup.
I know could be passed in headers somewhere/somehow but, chicken/egg how get there in first place.
Where we have the Same OI account -> different clients - > different database attaches
On Desktop we get around by passing /DPATH= to attach
At the moment we had clients with different OI accounts so just checked that and lookedup data location.
Now we have a situation where we have 2 clients(sub companies) same OI copy and same OI account.
So, how can I pass the location of the database folder to attach with each request. Initial logon then subsequent.
Hope I have explained enough to get the gist.
I am sure I am not unique in this environment setup.
I know could be passed in headers somewhere/somehow but, chicken/egg how get there in first place.
Comments
I know that oicgi4 wont pass it to you for retrieval(I did test in the past, but, of cause, maybe missed something) , but, is there maybe a 'backdoor' way I can get it on each request.
Barring that, you should be able to add a custom HTTP header to the request. You indicated that you tried this but it didn't work. Perhaps if you expand on what you did we can help identify the problem.
Not sure what you mean by that. What do you refer to as the "Client"
>>custom HTTP header
My try was in the OI http program, I assume what you are refering to is having it setup in the copy of the web application that is used. (what the IIS virtual dir points to) - would prefer not to do that as done by a 3rd party, and yes, we do have a 'param'setup for passing the title and client web address pointer to the http application.
I see this in the log, how do I get that value in my OI http application?
<26> HTTPRegistrySettings + RegistryInfo : SOFTWARE\RevSoft\OECGI4\lan-oecgiapi
https://forum.srpcs.com/discussion/comment/7240/#Comment_7240
Not sure what you mean by that. What do you refer to as the "Client"
"Client" is the generic term for the entity making a request from the server. This could be an end user using the browser, a machine using a backend call, etc.
In your case, I meant client as in the end user, the individual who logged into the website and is triggering the HTTP request. I assume your requests are authenticated, correct? What does that authentication look like? Does it identify the end user in a way to distinguish them from another end user?
No
My try was in the OI http program, I assume what you are refering to is having it setup in the copy of the web application that is used. (what the IIS virtual dir points to) - would prefer not to do that as done by a 3rd party, and yes, we do have a 'param'setup for passing the title and client web address pointer to the http application.
I see this in the log, how do I get that value in my OI http application?
1
2
<26> HTTPRegistrySettings +
RegistryInfo : SOFTWARE\RevSoft\OECGI4\lan-oecgiapi
You are close. In <26> of the log, near the bottom you'll see a label called AdditionalValues. This is where your custom HTTP request header names appear. In <30> you'll see the label HTTPAdditionalValues. This is where the values associated to those custom headers appear.
If you find your header and its value in the log then you can bring it into your API using this service, like this:
Authorization = HTTP_Services('GetRequestHeaderField', 'Authorization')
Cant remember now how all this ties in with the registry and IIS.
I would have registry with aaa-oecgiapi and bbb-oecgiapi and also IIS virtual directory point to the web code folder (or one copy each) .
I will have to experiement and find the best solution, but if you could let me know where to get that RegistryInfo value, that would be great.
Thank you.
Sorry I am not up on all the terminology. I dont have the time to swat.
ecgiapiID =field(HTTP_Services('GetOECGIRequest')<18>,'/',2)
UserDBId =OecgiapiID[1,'-']
The gotcha for this environment setting is that I now see that the first thing that frameworks does is using the current OI Account (with the default tables that are attached) is to validate the user. Now, the users' are in the tables that I need to attach depending on the company(different users in the 2 companies), which I can establish from the XXX-oecgiapi in GetOECGIRequest')<18>, getting the XXX part.
So, my question now is: Is there any setting that I can set that will bypass frameworks validating the user so that it will pass thru to my api, where, I can then attach the relevant tables THEN call your service that validates the user/password, check if any error before continuing.?
I know the best work around(some might say establish procedure) is to create an inherited OI account for each of those companies - which I would like to avoid if possible. - not impossible to do of course.
Would not this same situation arise on a development system where you have multiple customers on the same OI account with different databases you would want to attach for live data tests etc.?
You can also get the same information using GetHTTPScriptName. There is a service to get every part of the OECGI Request array.
There is no setting to accomplish this and there never would be because there are probably numerous "custom" ways that different apps will need to handle authentication and access to user/account specific data. The normal way this is handled is to update the AuthenticateRequest service (HTTP_AUTHENTICATION_SERVICES module) to do what you want. This is what we have done with several systems.
Ok, I found this:
and, affter a bit of sluething, then did this in my code after attaching the dbtables , which appears to work!!
//validate the user if the EnableAuthenticationFlag on the FrameWorks setup is unset// KeyID = 'GetEnableAuthenticationFlag' ServiceKeyID ='GetFullEndpointURL' Memory_Services('GetValue', ServiceKeyID, '', '', CacheName$) EnableAuthenticationFlag = Memory_Services('GetValue', KeyID, '', '',CacheName$) if EnableAuthenticationFlag else Memory_Services('SetValue', KeyID, 1, CacheName$) IsValidUser =HTTP_Authentication_Services('AuthenticateRequest') if not(IsValidUser) then return '' end