1212 using DigitalLearningSolutions . Web . Extensions ;
1313 using DigitalLearningSolutions . Web . Helpers ;
1414 using DigitalLearningSolutions . Web . ServiceFilter ;
15- using DigitalLearningSolutions . Web . Services ;
1615 using DigitalLearningSolutions . Web . ViewModels . Common . SearchablePage ;
1716 using DigitalLearningSolutions . Web . ViewModels . Supervisor ;
1817 using GDS . MultiPageFormData . Enums ;
@@ -722,12 +721,14 @@ public IActionResult EnrolDelegateOnProfileAssessment(int supervisorDelegateId)
722721 MultiPageFormDataFeature . EnrolDelegateOnProfileAssessment ,
723722 TempData
724723 ) ;
724+ var loggedInAdmin = userService . GetAdminById ( GetAdminId ( ) ) ;
725725
726726 var supervisorDelegate =
727727 supervisorService . GetSupervisorDelegateDetailsById ( supervisorDelegateId , GetAdminId ( ) , 0 ) ;
728728 var roleProfiles = supervisorService . GetAvailableRoleProfilesForDelegate (
729729 ( int ) supervisorDelegate . DelegateUserID ,
730- GetCentreId ( )
730+ GetCentreId ( ) ,
731+ loggedInAdmin . CategoryId
731732 ) ;
732733 var model = new EnrolDelegateOnProfileAssessmentViewModel ( )
733734 {
@@ -747,6 +748,8 @@ public IActionResult EnrolSetRoleProfile(int supervisorDelegateId, int selfAsses
747748 TempData
748749 ) . GetAwaiter ( ) . GetResult ( ) ;
749750
751+ var loggedInAdmin = userService . GetAdminById ( GetAdminId ( ) ) ;
752+
750753 if ( selfAssessmentID < 1 )
751754 {
752755 ModelState . AddModelError ( "selfAssessmentId" , "You must select a self assessment" ) ;
@@ -759,7 +762,8 @@ public IActionResult EnrolSetRoleProfile(int supervisorDelegateId, int selfAsses
759762 supervisorService . GetSupervisorDelegateDetailsById ( supervisorDelegateId , GetAdminId ( ) , 0 ) ;
760763 var roleProfiles = supervisorService . GetAvailableRoleProfilesForDelegate (
761764 ( int ) supervisorDelegate . DelegateUserID ,
762- GetCentreId ( )
765+ GetCentreId ( ) ,
766+ loggedInAdmin . CategoryId
763767 ) ;
764768 var model = new EnrolDelegateOnProfileAssessmentViewModel ( )
765769 {
@@ -1391,7 +1395,7 @@ public IActionResult CompetencySelfAssessmentCertificatesupervisor(int candidate
13911395 }
13921396 var supervisorDelegateDetails = supervisorService . GetSupervisorDelegateDetailsForAdminId ( adminId . Value , loggedInAdminUser . CategoryId ) ;
13931397 var checkSupervisorDelegate = supervisorDelegateDetails . Where ( x => x . DelegateUserID == competencymaindata . LearnerId ) . FirstOrDefault ( ) ;
1394- if ( ( checkSupervisorDelegate == null ) )
1398+ if ( ( checkSupervisorDelegate == null ) )
13951399 {
13961400 return RedirectToAction ( "StatusCode" , "LearningSolutions" , new { code = 403 } ) ;
13971401 }
@@ -1426,9 +1430,9 @@ public async Task<IActionResult> DownloadCertificate(int candidateAssessmentId)
14261430 {
14271431 return RedirectToAction ( "StatusCode" , "LearningSolutions" , new { code = 403 } ) ;
14281432 }
1429- var supervisorDelegateDetails = supervisorService . GetSupervisorDelegateDetailsForAdminId ( adminId . Value , loggedInAdminUser . CategoryId ) ;
1430- var checkSupervisorDelegate = supervisorDelegateDetails . Where ( x => x . DelegateUserID == competencymaindata . LearnerId ) . FirstOrDefault ( ) ;
1431- if ( checkSupervisorDelegate == null ) return RedirectToAction ( "StatusCode" , "LearningSolutions" , new { code = 403 } ) ;
1433+ var supervisorDelegateDetails = supervisorService . GetSupervisorDelegateDetailsForAdminId ( adminId . Value , loggedInAdminUser . CategoryId ) ;
1434+ var checkSupervisorDelegate = supervisorDelegateDetails . Where ( x => x . DelegateUserID == competencymaindata . LearnerId ) . FirstOrDefault ( ) ;
1435+ if ( checkSupervisorDelegate == null ) return RedirectToAction ( "StatusCode" , "LearningSolutions" , new { code = 403 } ) ;
14321436 var delegateUserId = competencymaindata . LearnerId ;
14331437 var competencycount = selfAssessmentService . GetCompetencyCountSelfAssessmentCertificate ( candidateAssessmentId ) ;
14341438 var accessors = selfAssessmentService . GetAccessor ( competencymaindata . SelfAssessmentID , competencymaindata . LearnerId ) ;
0 commit comments