From: Andrea A. <and...@ge...> - 2011-11-28 15:36:40
|
Hi, in a project we're working on we are facing a intersting request: the ability to run arbitrary sql commands before a connection is used by the code, and right before the connection is returned to the pool. The intent of such request is to allow do some custom environmental setup in that connection before it is used, in particular to setup impersonation (the ability to run commands with the credentials of another user) using some in-house grant and account package (e.g., not the standard impersonation commands). These sql commands would be parametric, using the usual cql variable expansion we already see in dynamic symbolizers (that, is, ${cql_expression}). The code in GeoServer would stick the current user in the "env" map, using a reserved key that cannot be used in normal request parameters, so that the session setup code can run the impersonation. However, being open ended, the code could be used for other purposes, such as for example switching workspace in oracle workspace manager, or setting some variables that stored procedure calls could use later, etc etc. The two commands would be specified as factory parameters. We already have an hook to initialize a connection, in order to perform the cleanup part we could simply use a wrapper that runs the other script when "close" is called. What do you think? Cheers Andrea -- ------------------------------------------------------- Ing. Andrea Aime GeoSolutions S.A.S. Tech lead Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 962313 http://www.geo-solutions.it http://geo-solutions.blogspot.com/ http://www.youtube.com/user/GeoSolutionsIT http://www.linkedin.com/in/andreaaime http://twitter.com/geowolf ------------------------------------------------------- |