@ -829,15 +829,43 @@ public class Geoportal_JSON_Mapper {
private static boolean checkAccessPolicy ( String sectionDocumentJSON , String myLogin ) {
LOG . info ( "checkAccessPolicy called" ) ;
// CHECKING THE POLICY
String accessPolicyPath = JSON_$_POINTER + "._access._policy" ;
//see ticket #24390
//First reading the access policy from the fileset
String accessPolicyPath = JSON_$_POINTER + ".fileset._access._policy" ;
boolean isAccessible = true ;
try {
com . jayway . jsonpath . Configuration configuration = com . jayway . jsonpath . Configuration . builder ( )
. jsonProvider ( new JsonOrgJsonProvider ( ) ) . build ( ) ;
LOG . debug ( "Reading access policy at {} into section document {}" , accessPolicyPath , sectionDocumentJSON ) ;
JsonPath theSectionPolycJsonPath = JsonPath . compile ( accessPolicyPath ) ;
String _policy = theSectionPolycJsonPath . read ( sectionDocumentJSON , configuration ) . toString ( ) ;
String _policy = null ;
try {
JsonPath theSectionPolycJsonPath = JsonPath . compile ( accessPolicyPath ) ;
_policy = theSectionPolycJsonPath . read ( sectionDocumentJSON , configuration ) . toString ( ) ;
if ( _policy = = null )
throw new Exception ( "Policy is null" ) ;
} catch ( Exception e ) {
LOG . debug ( "Access policy not found in: " + accessPolicyPath ) ;
}
//If policy does not exist into fileset, reading from the parent section
if ( _policy = = null ) {
accessPolicyPath = JSON_$_POINTER + "._access._policy" ;
LOG . debug ( "Reading access policy at {} into section document {}" , accessPolicyPath , sectionDocumentJSON ) ;
try {
JsonPath theSectionPolycJsonPath = JsonPath . compile ( accessPolicyPath ) ;
_policy = theSectionPolycJsonPath . read ( sectionDocumentJSON , configuration ) . toString ( ) ;
if ( _policy = = null )
throw new Exception ( "Policy is null" ) ;
} catch ( Exception e ) {
LOG . debug ( "Access policy not found in: " + accessPolicyPath ) ;
}
}
LOG . debug ( "The section {} has policy {}" , accessPolicyPath , _policy ) ;
isAccessible = GeportalCheckAccessPolicy . isAccessible ( _policy , myLogin ) ;
} catch ( Exception e ) {