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 ;
@@ -717,12 +716,14 @@ public IActionResult EnrolDelegateOnProfileAssessment(int supervisorDelegateId)
717716 MultiPageFormDataFeature . EnrolDelegateOnProfileAssessment ,
718717 TempData
719718 ) ;
719+ var loggedInAdmin = userService . GetAdminById ( GetAdminId ( ) ) ;
720720
721721 var supervisorDelegate =
722722 supervisorService . GetSupervisorDelegateDetailsById ( supervisorDelegateId , GetAdminId ( ) , 0 ) ;
723723 var roleProfiles = supervisorService . GetAvailableRoleProfilesForDelegate (
724724 ( int ) supervisorDelegate . DelegateUserID ,
725- GetCentreId ( )
725+ GetCentreId ( ) ,
726+ loggedInAdmin . CategoryId
726727 ) ;
727728 var model = new EnrolDelegateOnProfileAssessmentViewModel ( )
728729 {
@@ -742,6 +743,8 @@ public IActionResult EnrolSetRoleProfile(int supervisorDelegateId, int selfAsses
742743 TempData
743744 ) . GetAwaiter ( ) . GetResult ( ) ;
744745
746+ var loggedInAdmin = userService . GetAdminById ( GetAdminId ( ) ) ;
747+
745748 if ( selfAssessmentID < 1 )
746749 {
747750 ModelState . AddModelError ( "selfAssessmentId" , "You must select a self assessment" ) ;
@@ -754,7 +757,8 @@ public IActionResult EnrolSetRoleProfile(int supervisorDelegateId, int selfAsses
754757 supervisorService . GetSupervisorDelegateDetailsById ( supervisorDelegateId , GetAdminId ( ) , 0 ) ;
755758 var roleProfiles = supervisorService . GetAvailableRoleProfilesForDelegate (
756759 ( int ) supervisorDelegate . DelegateUserID ,
757- GetCentreId ( )
760+ GetCentreId ( ) ,
761+ loggedInAdmin . CategoryId
758762 ) ;
759763 var model = new EnrolDelegateOnProfileAssessmentViewModel ( )
760764 {
@@ -1385,7 +1389,7 @@ public IActionResult CompetencySelfAssessmentCertificatesupervisor(int candidate
13851389 }
13861390 var supervisorDelegateDetails = supervisorService . GetSupervisorDelegateDetailsForAdminId ( adminId . Value ) ;
13871391 var checkSupervisorDelegate = supervisorDelegateDetails . Where ( x => x . DelegateUserID == competencymaindata . LearnerId ) . FirstOrDefault ( ) ;
1388- if ( ( checkSupervisorDelegate == null ) )
1392+ if ( ( checkSupervisorDelegate == null ) )
13891393 {
13901394 return RedirectToAction ( "StatusCode" , "LearningSolutions" , new { code = 403 } ) ;
13911395 }
@@ -1419,9 +1423,9 @@ public async Task<IActionResult> DownloadCertificate(int candidateAssessmentId)
14191423 {
14201424 return RedirectToAction ( "StatusCode" , "LearningSolutions" , new { code = 403 } ) ;
14211425 }
1422- var supervisorDelegateDetails = supervisorService . GetSupervisorDelegateDetailsForAdminId ( adminId . Value ) ;
1423- var checkSupervisorDelegate = supervisorDelegateDetails . Where ( x => x . DelegateUserID == competencymaindata . LearnerId ) . FirstOrDefault ( ) ;
1424- if ( checkSupervisorDelegate == null ) return RedirectToAction ( "StatusCode" , "LearningSolutions" , new { code = 403 } ) ;
1426+ var supervisorDelegateDetails = supervisorService . GetSupervisorDelegateDetailsForAdminId ( adminId . Value ) ;
1427+ var checkSupervisorDelegate = supervisorDelegateDetails . Where ( x => x . DelegateUserID == competencymaindata . LearnerId ) . FirstOrDefault ( ) ;
1428+ if ( checkSupervisorDelegate == null ) return RedirectToAction ( "StatusCode" , "LearningSolutions" , new { code = 403 } ) ;
14251429 var delegateUserId = competencymaindata . LearnerId ;
14261430 var competencycount = selfAssessmentService . GetCompetencyCountSelfAssessmentCertificate ( candidateAssessmentId ) ;
14271431 var accessors = selfAssessmentService . GetAccessor ( competencymaindata . SelfAssessmentID , competencymaindata . LearnerId ) ;
0 commit comments