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.

Comments

  • What I would really like to do is add DATAPATH to the registry entry and be able to retrieve the value.
    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.
  • I think the best practice is to use the authentication to identify which "client" the current user is associated with.

    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.
  • >>authentication to identify which "client"

    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 was thinking I could read the registry and get the DATAPATH.
    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
  • Thats right, cant read the registry as it reverts to the WOW one. Damnation.
    https://forum.srpcs.com/discussion/comment/7240/#Comment_7240
  • I'm going to split up my response into two posts.
    >>authentication to identify which "client"

    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?
  • I could still use the 'lan-oecgiapi' part of the RegistryInfo to identify as I would setup and separate registry entry for each.
  • >>Does it identify the end user in a way to distinguish them from another end user?
    No
  • >>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 was thinking I could read the registry and get the DATAPATH.
    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')
  • Now I am not sure if I am going to have an issuue with the API Url setting in the HTTP Frameworks settup as I can only have one copy as it is saved with the OIAccount suffix.
    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.
  • Thanks for the prior post
  • Ok, found it and maybe i can work with this.
    ecgiapiID =field(HTTP_Services('GetOECGIRequest')<18>,'/',2)
    UserDBId =OecgiapiID[1,'-']
  • If i have a url-rewrite that does not use the value in API Url in the frameworks setup, is there a ramification down the line, so that I can then point to the separate virtual dirs in IIS
  • edited August 2022
    Ok, Start this again.
    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.?
  • which I can establish from the XXX-oecgiapi in GetOECGIRequest')<18>, getting the XXX part.

    You can also get the same information using GetHTTPScriptName. There is a service to get every part of the OECGI Request array.
    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.?

    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.
  • Thanks.
    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
Sign In or Register to comment.