File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -355,7 +355,10 @@ def list_bellschedules(school_id):
355355
356356 schedules = BellScheduleDB .query .filter_by (school_id = school_id , soft_deleted = False )
357357
358- return respond (BellScheduleSchema (exclude = ('school_id' ,)).dump (schedules , many = True ))
358+ excluded_fields = exclude_unless_logged_in (['internal_description' ])
359+ excluded_fields .extend (('school_id' ,))
360+
361+ return respond (BellScheduleSchema (exclude = excluded_fields ).dump (schedules , many = True ))
359362
360363@blueprint .route ("/bellschedule/<string:bell_schedule_id>" , strict_slashes = False , methods = ['GET' ])
361364@check_headers
@@ -397,7 +400,10 @@ def get_bellschedule(bell_schedule_id):
397400 if schedule .last_modified == since :
398401 return respond (code = 304 ) #Not Modified
399402
400- return respond (BellScheduleSchema (exclude = ('soft_deleted' ,)).dump (schedule ))
403+ excluded_fields = exclude_unless_logged_in (['internal_description' ])
404+ excluded_fields .extend (('soft_deleted' ,))
405+
406+ return respond (BellScheduleSchema (exclude = excluded_fields ).dump (schedule ))
401407
402408
403409@blueprint .route ("/bellschedule" , strict_slashes = False , methods = ['POST' ])
Original file line number Diff line number Diff line change @@ -222,6 +222,13 @@ def get_api_user_id():
222222 return ""
223223
224224
225+ def exclude_unless_logged_in (fields : list ):
226+ is_admin = check_for_roles (["admin" , "school admin" ])
227+ if is_admin :
228+ return []
229+ else :
230+ return fields
231+
225232def get_token_auth_header ():
226233 return get_valid_auth_header_of_type (AuthType .TOKEN )
227234
You can’t perform that action at this time.
0 commit comments