How to set a user on read-only or read/write mod using a script on perspective

Hello sommeone know wow to set a user on read-only or read/write setting using perspective using a script ?

I want put my perspective view on read-only to other user

for exemple:
if de user connected is “AAA”
set view on read-only
else
set view on read/write

The correct way is to create roles and assign roles to each user.

e.g.
User ‘AAA’ is assigned role ‘User’.
User ‘BBB’ is assigned roles ‘User’ and ‘Technician’.

https://docs.inductiveautomation.com/display/DOC81/Security+in+Perspective#SecurityinPerspective-PerspectiveViewsSecurity

Setting the view security is described in the manual.

Thank you. I will try it and read link doc

I have another problem. I can’t see my user roles

Did you create the users and roles?

  1. On the gateway go to Config | Security | Users, Roles, choose your user source.
  2. Create the roles you require. e.g. ‘User’, ‘Technician’, ‘Engineer’, etc.
  3. Create the users and assign roles to each user.

https://docs.inductiveautomation.com/display/DOC81/Managing+Users+and+Roles

yes, I create user and roles



On the Designer try File | Update Project to see if that refreshes the roles in the Edit Permissions for view dialog.

I did it but it is not working.

Are your Project | Project Properties Identity Provider and User Source correct?

They should be set to the user source that contains the users and roles you are trying to use.

If you are trying set security permissions for a project under the Perspective > Permissions section of the project properties, like OP showed a screenshot of, those are defined under the Config > Security > Security Levels section of the gateway. A security level contained within the “Roles” security level needs to be manually added for each role defined in the identity provider, which is not always immediately obvious.

https://docs.inductiveautomation.com/display/DOC81/Security+Levels

I never really understood why this is a manual process :thinking: @PGriffith?

Not my area, but my guess is we didn’t want to automatically bring in all the ‘legacy’ baggage that may not actually apply to an IdP/Perspective security context anyways. Better to give you the tools and make it your problem :slight_smile:

That said, it does seem like we could expose a manual “copy roles from user source” button, or something. Again, not my area. Maybe a good thing to put in an ideas post…

2 Likes