Configure view permissions through scripting

I was trying to grant user roles to the views through scripting. Is that possible?

I want to achieve this through scripting.

There is no way to configure View permissions through Scripting, because View permissions are not something that should change at runtime. If you need to change who can have access to a View, you should change that user’s permissions. Also, while you can perform logical checks against a user’s roles in Perspective, the screen you’re looking at is actually Security Levels. Security Levels are used very similarly to roles (which most Ignition users are familiar with), but they aren’t exactly the same.