GithubHelp home page GithubHelp logo

Comments (6)

katagen avatar katagen commented on June 12, 2024 2

Did you check the documentation here ?

https://docs.lizmap.com/3.7/en/publish/lizmap_plugin/filtered_layers_login.html

from lizmap-web-client.

BaBoWaGa avatar BaBoWaGa commented on June 12, 2024

Yes, thanks, I managed to do something by following those instructions, the only thing I didn't understand is how and if I can hide the display of some fields depending on the logged in user.

from lizmap-web-client.

Gustry avatar Gustry commented on June 12, 2024

if I can hide the display of some fields depending on the logged in user.

It's not possible with Lizmap.
Maybe with some Javascript, but I doubt and it wouldn't be secure/safety because all the data will still be in the webbrowser.

from lizmap-web-client.

BaBoWaGa avatar BaBoWaGa commented on June 12, 2024

Maybe with a script like this

layer = QgsProject.instance().mapLayersByName('Your_layer_name')[0]  # Make sure to replace 'Your_layer_name' with the actual name of your layer

# Check if the web user is in the lizmap_user and/or lizmap_user_groups list
web_user = 'web_username'  # Replace with the actual web user's name
user_group = 'user_group'  # Replace with the actual user's group name

# Check if the web user is in the lizmap_user list
if web_user in layer.customProperty("lizmap_user"):
    # If the web user is present, select the fields to display
    fields_to_display = ['field1', 'field2', 'field3']
else:
    # If the web user is not present, select a different set of fields to display
    fields_to_display = ['alternative_field1', 'alternative_field2']

# Update the display of fields in the layer
layer.setSubsetString('"field_name" IN {}'.format(tuple(fields_to_display)))

from lizmap-web-client.

Gustry avatar Gustry commented on June 12, 2024

This is Python, so it can only run as a Python plugin for QGIS server.

from lizmap-web-client.

BaBoWaGa avatar BaBoWaGa commented on June 12, 2024

Ok thanks

from lizmap-web-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.