[Lizmap] How to send current login User-ID to PostgreSQL
Paolo Cavallini
cavallini at faunalia.it
Mon Feb 24 03:08:42 PST 2020
Thanks Roberto for the reply.
So the variable is not lizmap_user_login, as per the manualk, but simply
login?
It is enough to define:
fieldname: 'login'
for each fieldname in any table to be filled with the login variable?
it is not necessary to define which table should get it, nor a default
variable for the table?
Cheers.
Il 24/02/20 11:55, Roberto Marzocchi ha scritto:
> Hi Paolo,
>
> We are using the following script and it works. Actually we do not use
> firstname, lastname and organization but only login field.
>
>
> var formPrefix = 'jforms_view_edition';
>
> // Name of the QGIS vector layer fields which must containt the user info
> var userFields = {
> login: 'login',
> firstname: 'lizmap_user_firstname',
> lastname: 'lizmap_user_lastname',
> organization: 'lizmap_user_organization'
> };
>
>
> lizMap.events.on({
>
> 'lizmapeditionformdisplayed': function(e){
>
> // If user is logged in
> if( $('#info-user-login').length ){
> // Loop through the needed fields
> for( var f in userFields ){
> // If the user has some data for this property
> if( $('#info-user-' + f).text() ){
> // If the field exists in the form
> var fi = $('#' + formPrefix + '_' + userFields[f]);
> if( fi.length ){
> // Set val from lizmap user data
> fi.val( $('#info-user-' + f).text() )
> // Set disabled
> // fi.attr('disabled', 'disabled');
> fi.hide();
> }
> }
> }
> }
>
> }
>
> });
>
>
>
>
>
> /Eng. Roberto Marzocchi, PhD/
> /CTO - Chief Technology Officer/
> /Gter srl (Unige spin-off)/
> /Via Ruffini 9R - 16128 Genova /
> /P.IVA/CF/ <http://P.IVA/CF>/01998770992 /
> /ph: 010-//0899150//- mob: 349-8786575 /
> /E-mail: //roberto.marzocchi at gter.it/
> <mailto:roberto.marzocchi at gter.it>///www.gter.it/ <http://www.gter.it>//
>
> /-- /
> /Gter social /
> /www.twitter.com/Gteronline/ <http://www.twitter.com/Gteronline>/-
> //www.facebook.com/Gteronline/ <http://www.facebook.com/Gteronline>//
> /www.linkedin.com/company/gter-srl-innovazione-in-geomatica-gnss-e-gis/
> <http://www.linkedin.com/company/gter-srl-innovazione-in-geomatica-gnss-e-gis>//
>
> /----------------------------------------------------------------- /
> /Please consider the environment before printing this email!/
>
>
>
> ---- Attivato lun, 24 feb 2020 11:04:57 +0100 *Paolo Cavallini
> <cavallini at faunalia.it <mailto:cavallini at faunalia.it>>* ha scritto ----
>
> Hi all,
> I've unclear how to send current Lizmap user to PostgreSQL. I followed:
> https://docs.lizmap.com/current/en/publish/advanced_lizmap_config.html#examples
> adding form_variables.js to media/js/default
> however, I do not know how to activate this for a specific table/field.
> Simply adding
> rilevatore: 'lizmap_user_login'
> where rilevatore is the name of the field of one table does not work.
> Can I have a more detailed example?
> Thanks in advance.
> --
> Paolo Cavallini - www.faunalia.eu <http://www.faunalia.eu>
> QGIS.ORG Chair:
> http://planet.qgis.org/planet/user/28/tag/qgis%20board/
> _______________________________________________
> Lizmap mailing list
> Lizmap at lists.osgeo.org <mailto:Lizmap at lists.osgeo.org>
> https://lists.osgeo.org/mailman/listinfo/lizmap
>
>
>
--
Paolo Cavallini - www.faunalia.eu
QGIS.ORG Chair:
http://planet.qgis.org/planet/user/28/tag/qgis%20board/
More information about the Lizmap
mailing list