[Lizmap] R: How to send current login User-ID to PostgreSQL
Roberto Marzocchi
roberto.marzocchi at gter.it
Mon Feb 24 02:55:08 PST 2020
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
http://P.IVA/CF 01998770992
ph: 010-0899150 - mob: 349-8786575
E-mail: mailto:roberto.marzocchi at gter.it http://www.gter.it
--
Gter social
http://www.twitter.com/Gteronline - http://www.facebook.com/Gteronline
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 <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 - http://www.faunalia.eu
QGIS.ORG Chair:
http://planet.qgis.org/planet/user/28/tag/qgis%20board/
_______________________________________________
Lizmap mailing list
mailto:Lizmap at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/lizmap
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/lizmap/attachments/20200224/73c6129d/attachment.html>
More information about the Lizmap
mailing list