@@ -849,6 +849,7 @@ mod tests {
849849 pro:: {
850850 contexts:: ProPostgresContext ,
851851 ge_context,
852+ permissions:: PermissionDb ,
852853 users:: { UserAuth , UserSession } ,
853854 } ,
854855 } ;
@@ -908,7 +909,31 @@ mod tests {
908909 . is_empty( ) ) ;
909910 }
910911
911- async fn add_single_dataset ( db : & ProPostgresDb < NoTls > , session : & UserSession ) {
912+ #[ ge_context:: test]
913+ async fn it_loads_own_datasets ( app_ctx : ProPostgresContext < NoTls > ) {
914+ let session_a = app_ctx. create_anonymous_session ( ) . await . unwrap ( ) ;
915+
916+ let db_a = app_ctx. session_context ( session_a. clone ( ) ) . db ( ) ;
917+
918+ let DatasetIdAndName {
919+ id : dataset_id,
920+ name : _,
921+ } = add_single_dataset ( & db_a, & session_a) . await ;
922+
923+ // we are already owner, but we give the permission again to test the permission check
924+ db_a. add_permission ( session_a. user . id . into ( ) , dataset_id, Permission :: Read )
925+ . await
926+ . unwrap ( ) ;
927+
928+ db_a. load_loading_info ( & dataset_id) . await . unwrap ( ) ;
929+ let _: Box < dyn MetaData < OgrSourceDataset , VectorResultDescriptor , VectorQueryRectangle > > =
930+ db_a. meta_data ( & DataId :: from ( dataset_id) ) . await . unwrap ( ) ;
931+ }
932+
933+ async fn add_single_dataset (
934+ db : & ProPostgresDb < NoTls > ,
935+ session : & UserSession ,
936+ ) -> DatasetIdAndName {
912937 let loading_info = OgrSourceDataset {
913938 file_name : PathBuf :: from ( "test.csv" ) ,
914939 layer_name : "test.csv" . to_owned ( ) ,
@@ -979,6 +1004,6 @@ mod tests {
9791004 meta_data,
9801005 )
9811006 . await
982- . unwrap ( ) ;
1007+ . unwrap ( )
9831008 }
9841009}
0 commit comments