SEBSERV-574
This commit is contained in:
		
							parent
							
								
									a7aedc58dc
								
							
						
					
					
						commit
						9e70b39400
					
				
					 1 changed files with 17 additions and 6 deletions
				
			
		|  | @ -30,6 +30,7 @@ import org.springframework.context.annotation.Lazy; | ||||||
| import org.springframework.core.io.Resource; | import org.springframework.core.io.Resource; | ||||||
| import org.springframework.http.*; | import org.springframework.http.*; | ||||||
| import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||||
|  | import org.springframework.web.client.HttpClientErrorException; | ||||||
| import org.springframework.web.client.RestTemplate; | import org.springframework.web.client.RestTemplate; | ||||||
| 
 | 
 | ||||||
| import com.fasterxml.jackson.core.type.TypeReference; | import com.fasterxml.jackson.core.type.TypeReference; | ||||||
|  | @ -351,12 +352,7 @@ public class MonitoringProctoringService { | ||||||
| 
 | 
 | ||||||
|             if (tokenRequest.getStatusCode() == HttpStatus.UNAUTHORIZED && |             if (tokenRequest.getStatusCode() == HttpStatus.UNAUTHORIZED && | ||||||
|                     currentUser.get().hasAnyRole(UserRole.EXAM_SUPPORTER, UserRole.INSTITUTIONAL_ADMIN)) { |                     currentUser.get().hasAnyRole(UserRole.EXAM_SUPPORTER, UserRole.INSTITUTIONAL_ADMIN)) { | ||||||
|                 log.warn("No Access to Screen Proctoring for user: {}", currentUser.get().username); |                 notifyUnauthorized(_action, currentUser); | ||||||
|                 _action |  | ||||||
|                         .pageContext() |  | ||||||
|                         .notifyError( |  | ||||||
|                                 new LocTextKey("sebserver.monitoring.sps.noaccess"), |  | ||||||
|                                 new RuntimeException("Please make sure you are assigned as supporter for this Exam")); |  | ||||||
|                 return _action; |                 return _action; | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|  | @ -369,6 +365,12 @@ public class MonitoringProctoringService { | ||||||
| //                    .getService(JavaScriptExecutor.class) | //                    .getService(JavaScriptExecutor.class) | ||||||
| //                    .execute(script); | //                    .execute(script); | ||||||
|         } catch (final Exception e) { |         } catch (final Exception e) { | ||||||
|  |             if (e instanceof HttpClientErrorException) { | ||||||
|  |                 if (((HttpClientErrorException) e).getRawStatusCode() == HttpStatus.UNAUTHORIZED.value()) { | ||||||
|  |                     notifyUnauthorized(_action,  this.pageService.getCurrentUser()); | ||||||
|  |                     return _action; | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|             log.error("Failed to open screen proctoring service group gallery view: ", e); |             log.error("Failed to open screen proctoring service group gallery view: ", e); | ||||||
|             _action.pageContext() |             _action.pageContext() | ||||||
|                     .notifyError(new LocTextKey("sebserver.monitoring.sps.opengallery.fail"), e); |                     .notifyError(new LocTextKey("sebserver.monitoring.sps.opengallery.fail"), e); | ||||||
|  | @ -376,6 +378,15 @@ public class MonitoringProctoringService { | ||||||
|         return _action; |         return _action; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     private static void notifyUnauthorized(final PageAction _action, final CurrentUser currentUser) { | ||||||
|  |         log.warn("No Access to Screen Proctoring for user: {}", currentUser.get().username); | ||||||
|  |         _action | ||||||
|  |                 .pageContext() | ||||||
|  |                 .notifyError( | ||||||
|  |                         new LocTextKey("sebserver.monitoring.sps.noaccess"), | ||||||
|  |                         new RuntimeException("Please make sure you are assigned as supporter for this Exam")); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     private PageAction openExamProctoringRoom( |     private PageAction openExamProctoringRoom( | ||||||
|             final ProctoringGUIService proctoringGUIService, |             final ProctoringGUIService proctoringGUIService, | ||||||
|             final ProctoringServiceSettings proctoringSettings, |             final ProctoringServiceSettings proctoringSettings, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 anhefti
						anhefti