@@ -17,6 +17,7 @@ import { StudyClass } from "src/app/shared/models/study-class.model";
17
17
import { CoursesRestService } from "src/app/shared/services/courses-rest.service" ;
18
18
import { EventsRestService } from "src/app/shared/services/events-rest.service" ;
19
19
import { LoadingService } from "src/app/shared/services/loading-service" ;
20
+ import { StorageService } from "src/app/shared/services/storage.service" ;
20
21
import { StudyClassesRestService } from "src/app/shared/services/study-classes-rest.service" ;
21
22
import { spread } from "src/app/shared/utils/function" ;
22
23
import { hasRole } from "src/app/shared/utils/roles" ;
@@ -26,6 +27,7 @@ import {
26
27
getCourseDesignation ,
27
28
getEventState ,
28
29
isRated ,
30
+ isStudyCourseLeader ,
29
31
} from "../utils/events" ;
30
32
31
33
export enum EventState {
@@ -96,6 +98,7 @@ export class EventsStateService {
96
98
private eventsRestService : EventsRestService ,
97
99
private studyClassRestService : StudyClassesRestService ,
98
100
private loadingService : LoadingService ,
101
+ private storageService : StorageService ,
99
102
private translate : TranslateService ,
100
103
@Inject ( SETTINGS ) private settings : Settings ,
101
104
) { }
@@ -209,13 +212,16 @@ export class EventsStateService {
209
212
private createFromStudyCourses (
210
213
studyCourses : ReadonlyArray < Event > ,
211
214
) : ReadonlyArray < EventEntry > {
212
- return studyCourses . map ( ( studyCourse ) => ( {
213
- id : studyCourse . Id ,
214
- designation : studyCourse . Designation ,
215
- detailLink : this . buildLink ( studyCourse . Id , "eventdetail" ) ,
216
- studentCount : studyCourse . StudentCount ,
217
- state : null ,
218
- } ) ) ;
215
+ const tokenPayload = this . storageService . getPayload ( ) ;
216
+ return studyCourses
217
+ . filter ( ( studyCourse ) => isStudyCourseLeader ( tokenPayload , studyCourse ) ) // The user sees only the study courses he/she is leader of
218
+ . map ( ( studyCourse ) => ( {
219
+ id : studyCourse . Id ,
220
+ designation : studyCourse . Designation ,
221
+ detailLink : this . buildLink ( studyCourse . Id , "eventdetail" ) ,
222
+ studentCount : studyCourse . StudentCount ,
223
+ state : null ,
224
+ } ) ) ;
219
225
}
220
226
221
227
private createFromAssessments (
0 commit comments