'How can i get windows login of user for dash app?

I am creating an app on the intranet of my company. I only want some people to access the app, depending on their windows login. Is this possible to get their windows login ? If yes how can i get it ?



Solution 1:[1]

Let's simply refer to Leaflet documentation:

You can use the methods the layerGroup/featureGroup provides to remove the last two layers from the group.

Leaflet's featureGroup is an extension of the layerGroup so all of these will work on featureGroup as well.

So, say that you have your layers set up like so:

// Layers:
var layers = L.layerGroup().addTo(map);

var marker = L.marker([51.5, -0.09]).addTo(layers);
var circle = L.circle([51.508, -0.11], {
  color: 'red',
  fillColor: '#f03',
  fillOpacity: 0.5,
  radius: 500,
}).addTo(layers);
var polygon = L.polygon([
  [51.509, -0.08],
  [51.503, -0.06],
  [51.51, -0.047],
]).addTo(layers);

You can use those layerGroup methods to remove the last two elements of the array:

// Pass the layerGroup to the function
function removeLastTwo(layerGroup) {
  // Use getLayers to get the array
  var layerArr = layerGroup.getLayers();
  var minusOne = layerArr.length - 1;
  var minusTwo = layerArr.length - 2;
  // Use eachLayer to iterate the layerGroup
  layerGroup.eachLayer((layer) => {
    // Grab the index of the layer
    var layerIndex = layerArr.indexOf(layer);
    // Remove the last two elements of the layerGroup array
    if (layerIndex === minusOne || layerIndex === minusTwo) {
      layerGroup.removeLayer(layer);
    }
  });
}

Here is a live example, with this function attached to the click event listener of a button.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ghybs