Logic Machine Forum
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: User Access (/showthread.php?tid=1461)



User Access - sjfp - 23.06.2018

Hi, trying to find a way of forcibly logging out all Users by using a script on a central controller when the central Admin runs a script.
We have 5 CBUS controllers and 1 Central Controller that uses Frames to look at individual Controllers.
But when we have an "Open Evening" event We want to stop any user from using the Local controllers until the "Open Evening" event has finished.

Any help and advice would be grateful.


RE: User Access - Erwin van der Zwart - 23.06.2018

Hi,

With custom JS you can add a listener to a object and force a redirect to /logout.

BR,

Erwin


RE: User Access - sjfp - 23.06.2018

(23.06.2018, 21:10)Erwin van der Zwart Wrote: Hi,

With custom JS you can add a listener to a object and force a redirect to /logout.

BR,

Erwin

Thank you for the info. Please could you point me in the right place to look at the coding to active what you have suggested.


RE: User Access - Erwin van der Zwart - 24.06.2018

Hi,

Try something like this:
Code:
$(function(){
  grp.listen('1/1/1', function(object, state) {
     if (state == 'value' && object.value == true) {
        $(location).attr('href', 'http://' + location.hostname + '/logout')
     }
  }, false); // set to true to respond on same value
});
BR,

Erwin


RE: User Access - admin - 25.06.2018

Another solution is to put a masking element above the whole visualization page when object value is true.
Custom JavaScript:
Code:
$(function() {
  if (typeof grp != 'object') {
    return;
  }

  var mask = $('<div>')
    .css({
      'position': 'absolute',
      'top': 0,
      'bottom': 0,
      'left': 0,
      'right': 0,
      'background-color': '#000',
      'z-index': 99999,
    })
    .addClass('hide')
    .appendTo('body');

  grp.listen('1/1/1', function(object) {
    mask.toggleClass('hide', object.value != true);
  });
});



RE: User Access - sjfp - 25.06.2018

(25.06.2018, 09:41)admin Wrote: Another solution is to put a masking element above the whole visualization page when object value is true.
Custom JavaScript:
Code:
$(function() {
 if (typeof grp != 'object') {
   return;
 }

 var mask = $('<div>')
   .css({
     'position': 'absolute',
     'top': 0,
     'bottom': 0,
     'left': 0,
     'right': 0,
     'background-color': '#000',
     'z-index': 99999,
   })
   .addClass('hide')
   .appendTo('body');

 grp.listen('1/1/1', function(object) {
   mask.toggleClass('hide', object.value != true);
 });
});
Thanks you. I will give it a try when i get a chance to log onto site again.