Setting Perspective Custom Session Properties from Device Launcher

I am in the design phase of a project and we are currently using Perspective as our graphical platform. One of the key elements required by our client is proving to be difficult to find a solution for.
There are two sections of the plant that are near identical (Equipment Set A and Equipment Set B). They want to make sure certain view stations (field clients) are unable to control (but still see, view only) the matching equipment in the other area. For instance a field client (fixed position, can't move) that exists in Area A, should not be able to manipulate things in Area B, and vice versa. (aka Geofencing) Most of how we do this I've got answers for and have done in the past.
My stumbling block is this: our field clients are just thin clients that run a session on ThinManager (terminal services server), so from Perspective's view, every client/session has the same IP address. I need a way to differentiate sessions running on the same physical server. I am open to ways to do this, but mainly I was hoping there would be a way to set Custom Session Properties from the client when it launches (e.g. via command line add-ons, or other). I have tried the "-Djavaws" arguments to no avail, I know they are for Vision, but was hoping maybe they'd work for Perspective too. (Client Launcher Commands)
Any help or suggestions would be greatly appreciated!

A number of discussions about this and similar issues.

TL/DR: Don't use ThinManager.

If the gateway(s) are reached via any NAT from the clients in question, don't use Perspective, either. (IMNSHO.)

I had already searched for ThinManager in the forums and read half dozen of the threads. Nothing seemed to answer my question so I started this post. I'll always admit I could be blind so sorry if I missed something.

I voted for Vision but was overruled by those who wanted "latest and greatest". The NAT part is still up in the air, we are fighting with their in-house IT group. What other things would be a problem with Perspective if going through firewalls/NATs?

i dont really know what thinManagers are, but if you run in kiosk mode (user has no access to the urlbar) you could add in url params to all your pages with their location maybe? if thinmanager knows where they are.

if browser localstorage works with ThinManager you could do something there too, by injecting js to read the storage and by manual setting something in the storage on every device. This is not really 100% secure though, as users would be able change it if they knew how. But if you have bad intention users on your software, there are worse things that can happen then give them acces to an other part of the plant i guess.
easily to test
go to a perspective page, open the inspector and go to console
image
localStorage.setItem("myLocation","A")
localStorage.getItem("myLocation")
if you can still get the param after restarting the browser/client/thinmanager then this could work i guess. And be sure to test you can set another location for the other clients, and not that they all share the same setting xd
ill get you the js injection for in perspective if you know if this works

The IP address that gets used for location-based security rules is the address of the NAT router, not the actual client machine (which is already screwy with a ThinManager).

Only Vision has actual local code execution that can probe the local machine (since it is an app, not a browser) for definitive identification. (I generally extract the machine's MAC addresses.) Some of this might eventually show up in Perspective Workstation, but probably not soon.

Perspective is not a full replacement for on-machine HMIs. (Yet.)

1 Like

I tested with 2 users on the same server and they were both able to set a localStorage variable with different values that persisted through server reboot and closing the sessions on the Gateway. So it appears these values will stick around at least for a while.
Is the only way to set them manually through a browser console? Not via a Batch script or something upon startup/user login at the Windows level?
Interesting possibility, thank you for the help so far! I'm interested to see how to get that info up to Perspective for use in the graphics!

That was my understanding too. Who knows this might be the forcing factor to make them switch to Vision, but they want to see every pathway has been explored in making this work before changing direction. Thank you for your input and time!

Quite simple to access in a view, put it on one of your docks and you could pass it to a session prop from there too:

Summary
[
  {
    "type": "ia.display.markdown",
    "version": 0,
    "props": {
      "style": {
        "flex": "--neutral-40"
      },
      "markdown": {
        "escapeHtml": false
      }
    },
    "meta": {
      "name": "Markdown"
    },
    "position": {
      "x": 310,
      "y": 279,
      "height": 200,
      "width": 200
    },
    "custom": {},
    "propConfig": {
      "props.source": {
        "binding": {
          "type": "expr",
          "config": {
            "expression": "\"myLocation\""
          },
          "transforms": [
            {
              "code": "\n\tcode =  \"\"\"<img style='display:none' src='/favicon.ico' onload=\\\"\n\t\tconst view = [...window.__client.page.views._data.values()].find(view => view.value.mountPath == this.parentNode.parentNode.parentNode.getAttributeNode('data-component-path').value.split('.')[0]).value; \n\t\tview.custom.write('\"\"\"+value+\"\"\"',localStorage.getItem('\"\"\"+value+\"\"\"'));\t\t\t\n\t\\\"></img>\"\"\".replace(\"\\n\", \"\").replace(\"\\t\", \"\")\n\treturn code\n\t",
              "type": "script"
            }
          ]
        }
      }
    }
  }
]

localstorage.zip (5.1 KB)

Idk if you can acces the localstorage easily through the os, you probably could acces the file somewhere in %LocalAppData%/Google/Chrome/User Data. but idk if its encrypted or something. i dont seem to find the fie easily