@@ -95,14 +95,14 @@ public IActionResult Index(
9595
9696            sortBy  ??=  DefaultSortByOptions . Name . PropertyName ; 
9797            sortDirection  ??=  GenericSortingHelper . Ascending ; 
98-                  existingFilterString  =  FilteringHelper . GetFilterString ( 
99-                  existingFilterString , 
100-                  newFilterToAdd , 
101-                  clearFilters , 
102-                  Request , 
103-                  filterCookieName , 
104-                  CourseDelegateAccountStatusFilterOptions . Active . FilterValue 
105-              ) ; 
98+             existingFilterString  =  FilteringHelper . GetFilterString ( 
99+             existingFilterString , 
100+             newFilterToAdd , 
101+             clearFilters , 
102+             Request , 
103+             filterCookieName , 
104+             CourseDelegateAccountStatusFilterOptions . Active . FilterValue 
105+         ) ; 
106106
107107            if  ( isCourseDelegate ) 
108108            { 
@@ -227,7 +227,7 @@ public IActionResult Index(
227227                        page  =  1 ;  offSet  =  0 ; 
228228                        ( selfAssessmentDelegatesData ,  resultCount )  =  selfAssessmentService . GetSelfAssessmentDelegatesPerPage ( searchString  ??  string . Empty ,  offSet ,  itemsPerPage  ??  0 ,  sortBy ,  sortDirection , 
229229                            selfAssessmentId ,  centreId ,  isDelegateActive ,  removed ,  submitted ,  signedOff ,  adminCategoryId ) ; 
230-                     }                      
230+                     } 
231231
232232                    var  adminId  =  User . GetCustomClaimAsRequiredInt ( CustomClaimTypes . UserAdminId ) ; 
233233
@@ -259,7 +259,7 @@ public IActionResult Index(
259259                    :  selfAssessmentService . GetSelfAssessmentNameById ( ( int ) selfAssessmentId ) ; 
260260                if  ( ! string . IsNullOrEmpty ( existingFilterString ) ) 
261261                { 
262-                     existingFilterString  =  FilteringHelper . GetValidFilters (   existingFilterString ,  newFilterToAdd ,  availableFilters ,  Request ,  filterCookieName ) ; 
262+                     existingFilterString  =  FilteringHelper . GetValidFilters ( existingFilterString ,  newFilterToAdd ,  availableFilters ,  Request ,  filterCookieName ) ; 
263263                } 
264264                if  ( isCourseDelegate ) 
265265                { 
@@ -375,7 +375,9 @@ public IActionResult DownloadCurrent(
375375                        fileName 
376376            ) ; 
377377        } 
378+ 
378379        [ Route ( "DownloadActivityDelegates/{selfAssessmentId:int}" ) ] 
380+         [ ServiceFilter ( typeof ( VerifyAdminUserCanAccessSelfAssessment ) ) ] 
379381        public  IActionResult  DownloadActivityDelegates ( 
380382            int  selfAssessmentId , 
381383             string ?  searchString  =  null , 
@@ -388,7 +390,6 @@ public IActionResult DownloadActivityDelegates(
388390            sortBy  ??=  DefaultSortByOptions . Name . PropertyName ; 
389391            sortDirection  ??=  GenericSortingHelper . Ascending ; 
390392
391- 
392393            bool ?  isDelegateActive ,  isProgressLocked ,  removed ,  hasCompleted ,  submitted ,  signedOff ; 
393394            isDelegateActive  =  isProgressLocked  =  removed  =  hasCompleted  =  submitted  =  signedOff  =  null ; 
394395
@@ -456,6 +457,7 @@ public IActionResult DownloadActivityDelegates(
456457                        fileName 
457458            ) ; 
458459        } 
460+ 
459461        [ Route ( "TrackingSystem/Delegates/ActivityDelegates/{candidateAssessmentsId}/Remove" ) ] 
460462        [ HttpGet ] 
461463        public  IActionResult  RemoveDelegateSelfAssessment ( int  candidateAssessmentsId ) 
@@ -466,12 +468,21 @@ public IActionResult RemoveDelegateSelfAssessment(int candidateAssessmentsId)
466468                return  RedirectToAction ( "StatusCode" ,  "LearningSolutions" ,  new  {  code  =  410  } ) ; 
467469            } 
468470            var  selfAssessmentDelegate  =  selfAssessmentService . GetDelegateSelfAssessmentByCandidateAssessmentsId ( candidateAssessmentsId ) ; 
469-             if  ( selfAssessmentDelegate  ==  null ) 
471+             if  ( selfAssessmentDelegate  !=  null ) 
472+             { 
473+                 var  adminCategoryId  =  User . GetAdminCategoryId ( ) ; 
474+                 var  selfAssessmentCategoryId  =  selfAssessmentService . GetSelfAssessmentCategoryId ( selfAssessmentDelegate . SelfAssessmentID ) ; 
475+                 if  ( adminCategoryId  >  0  &&  adminCategoryId  !=  selfAssessmentCategoryId ) 
476+                 { 
477+                     return  RedirectToAction ( "StatusCode" ,  "LearningSolutions" ,  new  {  code  =  403  } ) ; 
478+                 } 
479+                 var  model  =  new  DelegateSelfAssessmenteViewModel ( selfAssessmentDelegate ) ; 
480+                 return  View ( model ) ; 
481+             } 
482+             else 
470483            { 
471484                return  new  NotFoundResult ( ) ; 
472485            } 
473-             var  model  =  new  DelegateSelfAssessmenteViewModel ( selfAssessmentDelegate ) ; 
474-             return  View ( model ) ; 
475486        } 
476487
477488        [ Route ( "TrackingSystem/Delegates/ActivityDelegates/{candidateAssessmentsId}/Remove" ) ] 
@@ -502,6 +513,7 @@ public IActionResult RemoveDelegateSelfAssessment(DelegateSelfAssessmenteViewMod
502513
503514        [ HttpGet ] 
504515        [ ServiceFilter ( typeof ( IsCentreAuthorizedSelfAssessment ) ) ] 
516+         [ ServiceFilter ( typeof ( VerifyAdminUserCanAccessSelfAssessment ) ) ] 
505517        [ Route ( "{selfAssessmentId:int}/EditCompleteByDate" ) ] 
506518        public  IActionResult  EditCompleteByDate ( 
507519            int  delegateUserId , 
0 commit comments