I have a feature class (SQL Server table) that contains data from multiple clients (organizations). I want to expose the data, but control access so an org can only view/update its own data. I've created a flow as shown below (this is done for each org)
This all works very nicely and I've scripted it so it is easy to onboard new orgs. But I have one problem I can't solve. I need to make sure that the ORG_ID is not altered for existing records (I think I can accomplish this by hiding the field in the layer definition) and I need to make sure that the ORG_ID is correct on added records. I've looked into SOE's and DB triggers. The trouble there is there isn't enough context to know what the value is supposed to be. I tried many other approaches but nothing has worked completely. Any suggestions?
Solved! Go to Solution.
Well I came up with a very dirty solution on this that seems to work and I'll go with it until something more elegant comes up. I create my REST service names such that I can derive the desired key field values from them. Then I wrote an SOI that:
string pattern = "\"Org_ID\":\"[^\"]*\","; operationInput = Regex.Replace(operationInput, pattern, "\"Org_ID\":\"" + orgID + "\",");
Well I came up with a very dirty solution on this that seems to work and I'll go with it until something more elegant comes up. I create my REST service names such that I can derive the desired key field values from them. Then I wrote an SOI that:
string pattern = "\"Org_ID\":\"[^\"]*\","; operationInput = Regex.Replace(operationInput, pattern, "\"Org_ID\":\"" + orgID + "\",");