Logic Machine Forum
Change the visualization icons to read only (view) if viewer user access - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Change the visualization icons to read only (view) if viewer user access (/showthread.php?tid=3707)



Change the visualization icons to read only (view) if viewer user access - khalil - 25.11.2021

Hello 
Is it possible via script to change the whole visu. to read only, if viewer user access.
regards,


RE: Change the visualization icons to read only (view) if viewer user access - admin - 25.11.2021

Add this code to Custom JavaScript. Keep in mind that this will only block the visualization elements not the actual writing. By default Link elements and Widgets won't work with this solution. As a work-around you can add clickable class to the elements that the user should be able to click.
Code:
$(function() {
  if (Globals.user == 'viewer') {
    $('.layer > div').addClass('item-read-only');
    $('.clickable').removeClass('item-read-only');
  }
});



RE: Change the visualization icons to read only (view) if viewer user access - khalil - 25.11.2021

(25.11.2021, 09:12)admin Wrote: Add this code to Custom JavaScript. Keep in mind that this will only block the visualization elements not the actual writing. By default Link elements and Widgets won't work with this solution. As a work-around you can add clickable class to the elements that the user should be able to click.
Code:
$(function() {
  if (Globals.user == 'viewer') {
    $('.layer > div').addClass('item-read-only');
    $('.clickable').removeClass('item-read-only');
  }
});

thanks Admin,
Great, work perfect on visu. but could I add clickable class to Alarm link so viewer user can acknowledge alarms?
Also what did you mean by this statement:  "Keep in mind that this will only block the visualization elements not the actual writing."


RE: Change the visualization icons to read only (view) if viewer user access - admin - 25.11.2021

You can add this class to any visualization element that still needs to be clickable. But this solution will only block the UI. The user still can write to objects. For example by opening the browser console and executing grp.write() from there.
There's no solution to fully block writing at the moment. It's only possible to provide a list of objects that the user can read and write in Advanced tab of user properties in User access.


RE: Change the visualization icons to read only (view) if viewer user access - khalil - 25.11.2021

(25.11.2021, 09:31)admin Wrote: You can add this class to any visualization element that still needs to be clickable. But this solution will only block the UI. The user still can write to objects. For example by opening the browser console and executing grp.write() from there.
There's no solution to fully block writing at the moment. It's only possible to provide a list of objects that the user can read and write in Advanced tab of user properties in User access.

Thanks Allot.


RE: Change the visualization icons to read only (view) if viewer user access - khalil - 21.02.2022

Hello Admin
I have a customer that he want to create different users for the employee and each will have access to his office only.
So the JS will check the user name and make the total interface as read only except his office.


RE: Change the visualization icons to read only (view) if viewer user access - admin - 21.02.2022

I see no need for JS here. You can specify plan access rights for each user separately. For improved security you can also provide a group address list that each user has access to.


RE: Change the visualization icons to read only (view) if viewer user access - khalil - 21.02.2022

(21.02.2022, 08:37)admin Wrote: I see no need for JS here. You can specify plan access rights for each user separately. For improved security you can also provide a group address list that each user has access to.

Thanks Admin
I forgot this feature
BR,