@@ -19,7 +19,7 @@ public interface IUploadDeliveryService
19
19
Task < Dictionary < string , List < string > > > UploadPlatformData ( string reportType , string reportPeriod , long orgId , Stream stream ) ;
20
20
Task < ( Dictionary < string , List < string > > , string header ) > ValidateAndParseUploadAsync ( string reportPeriod , long orgId , string reportType , string hashValue , string [ ] mandatoryFields , TextReader textReader , List < DssUploadLine > uploadLines ) ;
21
21
Task < PagedDto < UploadHistoryViewDto > > GetUploadHistory ( long ? orgId , int pageSize , int pageNumber , string orderBy , string direction , string [ ] reportTypes ) ;
22
- Task < byte [ ] ? > GetRentalListingErrorFile ( long uploadId ) ;
22
+ Task < ( byte [ ] ? , bool hasAccess ) > GetRentalListingErrorFile ( long uploadId ) ;
23
23
Task < DssUploadDelivery ? > GetNonTakedownUploadToProcessAsync ( ) ;
24
24
Task < DssUploadDelivery ? > GetUploadToProcessAsync ( string reportType ) ;
25
25
}
@@ -501,15 +501,25 @@ public async Task<PagedDto<UploadHistoryViewDto>> GetUploadHistory(long? orgId,
501
501
return await _uploadRepo . GetUploadHistory ( orgId , pageSize , pageNumber , orderBy , direction , reportTypes ) ;
502
502
}
503
503
504
- public async Task < byte [ ] ? > GetRentalListingErrorFile ( long uploadId )
504
+ public async Task < ( byte [ ] ? , bool hasAccess ) > GetRentalListingErrorFile ( long uploadId )
505
505
{
506
506
var upload = await _uploadRepo . GetRentalListingUploadWithErrors ( uploadId ) ;
507
507
508
- if ( upload == null ) return null ;
508
+ if ( upload == null ) return ( null , true ) ;
509
509
510
- var fullData = upload . UploadDeliveryType == UploadDeliveryTypes . LicenceData ;
510
+ // so far, there are two types of error files - ListingData and LicenceData
511
+ var licenceData = upload . UploadDeliveryType == UploadDeliveryTypes . LicenceData ;
511
512
512
- var linesWithError = await _uploadRepo . GetUploadLineIdsWithErrors ( uploadId , fullData ) ;
513
+ var hasPermission = licenceData
514
+ ? _currentUser . Permissions . Contains ( Permissions . LicenceFileUpload )
515
+ : _currentUser . Permissions . Contains ( Permissions . ListingFileUpload ) ;
516
+
517
+ if ( ! hasPermission )
518
+ {
519
+ return ( null , false ) ;
520
+ }
521
+
522
+ var linesWithError = await _uploadRepo . GetUploadLineIdsWithErrors ( uploadId , licenceData ) ;
513
523
514
524
var memoryStream = new MemoryStream ( upload . SourceBin ! ) ;
515
525
using TextReader textReader = new StreamReader ( memoryStream , Encoding . UTF8 ) ;
@@ -532,7 +542,7 @@ public async Task<PagedDto<UploadHistoryViewDto>> GetUploadHistory(long? orgId,
532
542
contents . AppendLine ( line . LineText . TrimEndNewLine ( ) + $ ",\" { line . ErrorText ?? "" } \" ") ;
533
543
}
534
544
535
- return Encoding . UTF8 . GetBytes ( contents . ToString ( ) ) ;
545
+ return ( Encoding . UTF8 . GetBytes ( contents . ToString ( ) ) , hasPermission ) ;
536
546
}
537
547
538
548
public async Task < DssUploadDelivery ? > GetNonTakedownUploadToProcessAsync ( )
0 commit comments