Required role for widgets on the studio's home page

Anastasia Fedorovich 6 years ago in ADAM Core updated by anonymous 4 years ago 0

On this moment we have not possibility to limit widget access (visibility)  on the studio's home page. It would be nice to add this functionality.

security configurability central widgets

You can't set visibility via roles, but you can work around that using user group values for settings.

When you navigate to the setting definition of .{studio}Widgets, you will notice that in the access control section the "Allow user group setting" is checked. This means that you can set a different value for every user group. So by removing one widget from the value of one user group, you can remove a widget from the home page of a group of users.

But what if a user is in several user groups? Then the user can have several values for that setting. How does ADAM determine what value to take?

Well if you look at the default value of the .assetStudioWidgets setting, you will notice a "priority" attribute in the root node widgets. The value of the priority is an integer and is used to determine what setting value to use (the lower the priority, the more important it is).

So to make things a little bit more clear. A little example:

You have a user called Jane and John. John is in the group RegularUsers. Jane is in both the groups SuperUsers and RegularUsers.

To make sure users in RegularUsers don't see the LastRecords widget, we go to ConfigStudio and navigate to the RegularUsers usergroup. There we select settings and look for .AssetStudioWidgets. We change the value, removing the LastRecords widget.

Members of the SuperUsers group should be able to see the LastRecords widget. So we go to ConfigStudio and the SuperUsers group. We change the .AssetStudioWidgets and add the LastRecords widget.

Since Jane is a member of both SuperUsers and RegularUsers, she will get exceptions or at least an unpredictable result. To avoid that, we go to the setting value of .AssetStudioWidgets for the usergroup SuperUsers and set the priority attribute to 50. This way, the setting value for the SuperUsers outranks the value of the RegularUsers.