Check role to open page

Good afternoon,

I would like to ask your help to understand which is the better way to check the actual role with a dataset of roles to open a page.

I create a dataset memory tag where I add the roles I want to be able to open the page.
Then I add this code to the mouseReleased event:


val = system.dataset.toPyDataSet(system.tag.read('myPath').value)
role = system.security.getRoles()


# Convert to a PyDataset
pyData = system.dataset.toPyDataSet(val)
 
# The for loop pulls out the whole row, so typically the variable row is used.
for row in pyData:
    # Now that we have a single row, we can loop through the columns just like a list.
    for value in row:

    	if value in role:

			window = system.nav.openWindow('myPage')

Is there a better way to do this with a view to having more page to manage ?

Thanks a lot

Why do you not use the built-in security settings?

I’m assuming you’re using Vision in which case you click on the view and hit Ctrl-E (or right-click on the Project Browser item and select Security).

I would like to have a tag to manage the roles so if I have to change it, so I change only in one place.

If there’s a way to use the built-in and set the roles dynamically it should be great.