-
-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter[Question]: Filter temporal data by user #4268
Comments
Did you check the documentation here ? https://docs.lizmap.com/3.7/en/publish/lizmap_plugin/filtered_layers_login.html |
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. |
It's not possible with Lizmap. |
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))) |
This is Python, so it can only run as a Python plugin for QGIS server. |
Ok thanks |
What is the question? (in English)
Hi, I have a time manager on a postGIS layer with daily start and end date. Is there a way to limit data display based on logged in user?
Example:
alpha user can see data from 1 to 5 March 2024
beta user can see data from February 1 to March 5, 2024
gamma user can see the entirety of the data
Lizmap 7.5 QGIS 3.28.15
Versions, safeguards, check summary etc
Lizmap 7.5 QGIS 3.28.15
Check Lizmap plugin
Operating system
Windows 11
Browsers
Chrome
Browsers version
122.0.6261.95
Relevant log output
No response
The text was updated successfully, but these errors were encountered: