Hiding tabs depending on access level

Hello, everyone!

I am working on a work project in perspective and am struggling with the idea of how to make a tab container have less tabs when lower access level users are logged in. To be specific - I have session configuration and information tabs, which currently are set up in a way, that when a non-administrator user logs in, the tab just shows a view, that the person does not have access to this information, but it would be much more neat, if the tabs would just not show at all. I have an idea how to check authentication levels and when to check them, I just don't really understand how am I to write down tab quantity changes...

I hope I wrote down my issue clearly, but if I have missed something please let me know! And thank you in advance, any help is greatly appreciated.

I can't test it right now but maybe you can bind the tab property to whatever you use to evaluate access rights, and generate tabs in a transform ?

I have no idea what happens to the content of tabs when doing this, so it might not work. I guess you'll have to try and see.

If you Shift-right-click on the tab view in the Project Browser and use Copy JSON you can see the structure like this:

{
  "custom": {},
  "params": {},
  "props": {},
  "root": {
    "children": [
      {
        "meta": {
          "name": "EmbeddedView"
        },
        "position": {
          "tabIndex": 2
        },
        "type": "ia.display.view"
      },
      {
        "meta": {
          "name": "EmbeddedView_0"
        },
        "position": {
          "tabIndex": 1
        },
        "type": "ia.display.view"
      },
      {
        "meta": {
          "name": "EmbeddedView_1"
        },
        "type": "ia.display.view"
      }
    ],
    "meta": {
      "name": "root"
    },
    "props": {
      "currentTabIndex": 2,
      "tabs": [
        "Zero",
        "One",
        "Two"
      ]
    },
    "type": "ia.container.tab"
  }
}

You may be able to script the root and props sections to do what you want based on the user access level.

1 Like