Page 1 of 1

aXes / Longreach - other folders than longreachdata

Posted: 29 Apr 2020, 02:15
by Joerg Hamacher
Hi again,

when displaying images or PDFs in aXes42 we have to use longreach.

This works fine as long as I am using IFS folders longreachdata or longreachdata_public.

Now I tried to use another IFS folder that contains special PDFs. Name of this folder is SMH_Inventurbogen, it is created directly under the root folder.


Then I changed httpd.xml like this:

LongReach
-->

<!--
Public users
-->

<parameter name="service.folder.public.get.allow" value="/longreachdata-public/other/"/>
<parameter name="service.folder.public.get.allow" value="/longreachdata-public/other/*"/>
<parameter name="service.folder.public.get.allow" value="/SMH-Inventurbogen/"/>
<parameter name="service.folder.public.get.allow" value="/SMH-Inventurbogen/*"/>

<!--
All non-public users
-->

<parameter name="service.folder.get.allow" value="/longreachdata-public/other/"/>
<parameter name="service.folder.get.allow" value="/longreachdata-public/other/*"/>
<parameter name="service.folder.public.get.allow" value="/SMH-Inventurbogen/"/>
<parameter name="service.folder.public.get.allow" value="/SMH-Inventurbogen/*"/>


Subsystems were restarted - user authorities of folder and files are completely the same as of longreachdata or longreachdata_public:

*PUBLIC *RWX X X X X
AXES *RWX X X X X
AXES_GROUP *RWX X X X X
QDIRSRV *R

But when putting this into a hyperlink or button onClick script like

var url = USERENV.createGETURL("http://192.168.0.4:8063/service/longreach.jsp" , "USER", "PASSWORD", "/SMH-Inventurbogen/", "Inventurbogen_MA1_FI00_2016-10-18_110520.PDF");
window.open(url);


the browser says:
response
type "error"
message "Path access denied: /SMH-Inventurbogen"
sversion "1.2.1"



Why? Did I forget anything?
Is it impossible to use folders other than longreachdata or longreachdata_public? How can I get access to folder SMH_Inventurbogen from inside aXes?


Many thanks in advance,
Joerg

Re: aXes / Longreach - other folders than longreachdata

Posted: 29 Apr 2020, 16:47
by jeanmichel
Hi Jorg,

You have 2x service.folder.public.get.allow where it should be service.folder.get.allow.
See red corrected below.

LongReach
-->

<!--
Public users
-->

<parameter name="service.folder.public.get.allow" value="/longreachdata-public/other/"/>
<parameter name="service.folder.public.get.allow" value="/longreachdata-public/other/*"/>

<!--
All non-public users
-->

<parameter name="service.folder.get.allow" value="/longreachdata-public/other/"/>
<parameter name="service.folder.get.allow" value="/longreachdata-public/other/*"/>
<parameter name="service.folder.get.allow" value="/SMH-Inventurbogen/"/>
<parameter name="service.folder.get.allow" value="/SMH-Inventurbogen/*"/>


I don't think you can use your own hand written function to get the file, as there is more than just a get happening. Also it's a POST.
I strongly recommend to use the lui-connector-min.js as in my example:
For example in a HTML page.

<script type="text/javascript" src="/ws/lui-encrypt-min.js"></script>
<script type="text/javascript" src="/ws/lui-connector-min.js"></script>

var m_host = { endpoint:"/service/longreach.jsp", profile:"jeanmichel", password:"xxx" } ;

function callback ( response, fileData )
{
blabla... }

LUICONNECTOR.getFile ( m_host, { path:"/smhbase/docs", name:"MyPDF.pdf" }, callback ) ;

Re: aXes / Longreach - other folders than longreachdata

Posted: 29 Apr 2020, 19:11
by Joerg Hamacher
Hi Jean-Michel,
thank you for this - 4 eyes see more than 2! Or I need new glasses ;-)

I use these scripts:

in Application onSignOn the lui-functions are defined:
if ( typeof LUICONNECTOR === "undefined" ) {
$.getScript ( USERENV.protocol + "//" + USERENV.ip + ":" + USERENV.jsmPort + "/ws/lui-connector-min.js" )
.done( console.log("lui-connector-min.js loaded.") );
}
if ( typeof LUIENCRYPT === "undefined" ) {
$.getScript ( USERENV.protocol + "//" + USERENV.ip + ":" + USERENV.jsmPort + "/ws/lui-encrypt-min.js" )
.done( console.log("lui-encrypt-min.js loaded.") );
}


... and in USERENV this is what createGETURL does:
createGETURL : function(endpoint, profile, password, path, name)
{
try
{
/*
1. Endpoint is needed to get the LongReach server nonce and RSA public key
*/


// Using synchronous mode to create the URL

var response = LUICONNECTOR.createGetFileRequest ( {profile:profile,password:password,endpoint:endpoint,cacheage:0},{path:path,name:name} ) ;

if ( response.type === "error" )
{

throw response.message ;
}

/*
2. Endpoint is needed to send the encrypted request to the LongReach server to get the file
*/

return endpoint + "?REQUEST=" + encodeURIComponent ( JSON.stringify ( response ) ) ;
}
catch ( e )
{
alert ( "createGETURL exception: " + e ) ;
}
},


This is a function we use since some years when this longreach request was integrated into aXes. Is it still okay to use this or should we change anything?

Best regards,
Joerg

Re: aXes / Longreach - other folders than longreachdata

Posted: 01 May 2020, 12:35
by jeanmichel
HI Jorg,

If it works then all good.
I think we have enhanced this since you implemented this and it's much more simple. All your createGETURL code can be replaced by 2 lines:


createGETURL : function(endpoint, profile, password, path, name)
{
try
{
var m_host = { endpoint:endpoint, profile:profile, password:password } ;
LUICONNECTOR.getFile ( m_host, { path:path, name:name }, callback ) ;
}
catch ( e )
{
alert ( "createGETURL exception: " + e ) ;
}

Re: aXes / Longreach - other folders than longreachdata

Posted: 04 May 2020, 18:50
by Joerg Hamacher
Thank you very much, Jean-Michel

I will try this and replace my old code with the new one.

Best regards,
Joerg