Re: [mapserver-users] Oracle Layer: how to set context prior to fetching the data
Martin, How I've done this in the past is use a plsql function that sets the context and call that function in the query (and just have the function return a dummy value that you don't use). Mike -- Michael Smith Remote Sensing/GIS Center US Army Corps of Engineers On 3/24/16, 5:59 AM, "mapserver-users on behalf of Martin Icking"wrote: >One of the Oracle based sources we are publishing is using Oracle context >variables to enable Oracle's fine grained access control. >So we are in the need to set these context variables (e.g. current >username) >prior to doing the select defined by MapServer's DATA statement. In other >applications we do that by calling a set_context (...) stored procedure >prior to any data requests. >Is there any possibility in MapServer to send a pre-request statement to >the >database? A current work-around is to set the context at logon time but >that >means that we need a new logon for every request that needs a different >user >context, not optimal for websites with many users. We'd prefer to have a >single logon that can be re-used for all requests. >If there is currently no way to handle this in MapServer we'd like to >extend >the Oracle layer's capabilities. Any suggestion by the MS developers on >where we should place the needed extension in the mapfile (e.g. adding an >additional keyword at the USING part of the data statement or using new >layer metadata)? >Any interest in generalizing this approach? > >Tx >Martin > > > >-- >View this message in context: >http://osgeo-org.1560.x6.nabble.com/Oracle-Layer-how-to-set-context-prior- >to-fetching-the-data-tp5258155.html >Sent from the Mapserver - User mailing list archive at Nabble.com. >___ >mapserver-users mailing list >mapserver-users@lists.osgeo.org >http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Oracle Layer: how to set context prior to fetching the data
The other option is to create yet-another stored procedure wrapper. In the Mapfile, you'd call the special wrapper stored procedure and it would return the rows to map. On Thu, Mar 24, 2016 at 8:16 AM, Jeff McKennawrote: > Hi Martin, > > Have you tried using a virtual spatial layer (.ovf) file to manage this? > You can include a "" tag to run your stored procedure. See > examples at http://mapserver.org/input/vector/VirtualSpatialData.html > More details of that driver at: http://www.gdal.org/drv_vrt.html > > Otherwise, I have seen others on this mailing list use stored procedures > in the DATA statement of the mapfile, such as: > > DATA "the_geom from (select the_geom, id, name, myprocedure() as style > from states) as foo using srid=4326 using unique id" > > Maybe the ovf is the way to go for your case, not sure. > > -jeff > > -- > Jeff McKenna > MapServer Consulting and Training Services > http://www.gatewaygeomatics.com/ > > > > > On 2016-03-24 6:59 AM, Martin Icking wrote: > >> One of the Oracle based sources we are publishing is using Oracle context >> variables to enable Oracle's fine grained access control. >> So we are in the need to set these context variables (e.g. current >> username) >> prior to doing the select defined by MapServer's DATA statement. In other >> applications we do that by calling a set_context (...) stored procedure >> prior to any data requests. >> Is there any possibility in MapServer to send a pre-request statement to >> the >> database? A current work-around is to set the context at logon time but >> that >> means that we need a new logon for every request that needs a different >> user >> context, not optimal for websites with many users. We'd prefer to have a >> single logon that can be re-used for all requests. >> If there is currently no way to handle this in MapServer we'd like to >> extend >> the Oracle layer's capabilities. Any suggestion by the MS developers on >> where we should place the needed extension in the mapfile (e.g. adding an >> additional keyword at the USING part of the data statement or using new >> layer metadata)? >> Any interest in generalizing this approach? >> >> Tx >> Martin >> >> > ___ > mapserver-users mailing list > mapserver-users@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Oracle Layer: how to set context prior to fetching the data
Hi Martin, Have you tried using a virtual spatial layer (.ovf) file to manage this? You can include a "" tag to run your stored procedure. See examples at http://mapserver.org/input/vector/VirtualSpatialData.html More details of that driver at: http://www.gdal.org/drv_vrt.html Otherwise, I have seen others on this mailing list use stored procedures in the DATA statement of the mapfile, such as: DATA "the_geom from (select the_geom, id, name, myprocedure() as style from states) as foo using srid=4326 using unique id" Maybe the ovf is the way to go for your case, not sure. -jeff -- Jeff McKenna MapServer Consulting and Training Services http://www.gatewaygeomatics.com/ On 2016-03-24 6:59 AM, Martin Icking wrote: One of the Oracle based sources we are publishing is using Oracle context variables to enable Oracle's fine grained access control. So we are in the need to set these context variables (e.g. current username) prior to doing the select defined by MapServer's DATA statement. In other applications we do that by calling a set_context (...) stored procedure prior to any data requests. Is there any possibility in MapServer to send a pre-request statement to the database? A current work-around is to set the context at logon time but that means that we need a new logon for every request that needs a different user context, not optimal for websites with many users. We'd prefer to have a single logon that can be re-used for all requests. If there is currently no way to handle this in MapServer we'd like to extend the Oracle layer's capabilities. Any suggestion by the MS developers on where we should place the needed extension in the mapfile (e.g. adding an additional keyword at the USING part of the data statement or using new layer metadata)? Any interest in generalizing this approach? Tx Martin ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Oracle Layer: how to set context prior to fetching the data
One of the Oracle based sources we are publishing is using Oracle context variables to enable Oracle's fine grained access control. So we are in the need to set these context variables (e.g. current username) prior to doing the select defined by MapServer's DATA statement. In other applications we do that by calling a set_context (...) stored procedure prior to any data requests. Is there any possibility in MapServer to send a pre-request statement to the database? A current work-around is to set the context at logon time but that means that we need a new logon for every request that needs a different user context, not optimal for websites with many users. We'd prefer to have a single logon that can be re-used for all requests. If there is currently no way to handle this in MapServer we'd like to extend the Oracle layer's capabilities. Any suggestion by the MS developers on where we should place the needed extension in the mapfile (e.g. adding an additional keyword at the USING part of the data statement or using new layer metadata)? Any interest in generalizing this approach? Tx Martin -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Oracle-Layer-how-to-set-context-prior-to-fetching-the-data-tp5258155.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users