@@ -247,6 +247,9 @@ def view_mkdir(auth_dict: Optional[Dict[str, Any]] = None):
247247@auth .oidc_auth ('default' )
248248@gallery_auth
249249def view_jumpdir (auth_dict : Optional [Dict [str , Any ]] = None ):
250+ gallery_lockdown = util .get_lockdown_status ()
251+ if gallery_lockdown and (not auth_dict ['is_eboard' ] and not auth_dict ['is_rtp' ]):
252+ abort (405 )
250253 return render_template ("jumpdir.html" ,
251254 auth_dict = auth_dict )
252255
@@ -733,7 +736,12 @@ def tag_file(file_id: int):
733736
734737@app .route ("/api/file/get/<int:file_id>" )
735738@auth .oidc_auth ('default' )
736- def display_file (file_id : int ):
739+ @gallery_auth
740+ def display_file (file_id : int , auth_dict : Optional [Dict [str , Any ]] = None ):
741+ gallery_lockdown = util .get_lockdown_status ()
742+ if gallery_lockdown and (not auth_dict ['is_eboard' ] and not auth_dict ['is_rtp' ]):
743+ abort (405 )
744+
737745 file_model = File .query .filter (File .id == file_id ).first ()
738746
739747 if file_model is None :
@@ -745,7 +753,12 @@ def display_file(file_id: int):
745753
746754@app .route ("/api/thumbnail/get/<int:file_id>" )
747755@auth .oidc_auth ('default' )
748- def display_thumbnail (file_id : int ):
756+ @gallery_auth
757+ def display_thumbnail (file_id : int , auth_dict : Optional [Dict [str , Any ]] = None ):
758+ gallery_lockdown = util .get_lockdown_status ()
759+ if gallery_lockdown and (not auth_dict ['is_eboard' ] and not auth_dict ['is_rtp' ]):
760+ abort (405 )
761+
749762 file_model = File .query .filter (File .id == file_id ).first ()
750763
751764 link = storage_interface .get_link ("thumbnails/{}" .format (file_model .s3_id ))
@@ -754,7 +767,12 @@ def display_thumbnail(file_id: int):
754767
755768@app .route ("/api/thumbnail/get/dir/<int:dir_id>" )
756769@auth .oidc_auth ('default' )
757- def display_dir_thumbnail (dir_id : int ):
770+ @gallery_auth
771+ def display_dir_thumbnail (dir_id : int , auth_dict : Optional [Dict [str , Any ]] = None ):
772+ gallery_lockdown = util .get_lockdown_status ()
773+ if gallery_lockdown and (not auth_dict ['is_eboard' ] and not auth_dict ['is_rtp' ]):
774+ abort (405 )
775+
758776 dir_model = Directory .query .filter (Directory .id == dir_id ).first ()
759777
760778 thumbnail_uuid = dir_model .thumbnail_uuid
@@ -810,7 +828,11 @@ def get_supported_mimetypes():
810828
811829@app .route ("/api/get_dir_tree" )
812830@auth .oidc_auth ('default' )
813- def get_dir_tree (internal : bool = False ):
831+ @gallery_auth
832+ def get_dir_tree (internal : bool = False , auth_dict : Optional [Dict [str , Any ]] = None ):
833+ gallery_lockdown = util .get_lockdown_status ()
834+ if gallery_lockdown and (not auth_dict ['is_eboard' ] and not auth_dict ['is_rtp' ]):
835+ abort (405 )
814836
815837 # TODO: Convert to iterative tree traversal using a queue to avoid
816838 # recursion issues with large directory structures
@@ -843,7 +865,12 @@ def get_dir_children(dir_id: int) -> Any:
843865
844866@app .route ("/api/directory/get/<int:dir_id>" )
845867@auth .oidc_auth ('default' )
846- def display_files (dir_id : int , internal : bool = False ):
868+ @gallery_auth
869+ def display_files (dir_id : int , internal : bool = False , auth_dict : Optional [Dict [str , Any ]] = None ):
870+ gallery_lockdown = util .get_lockdown_status ()
871+ if gallery_lockdown and (not auth_dict ['is_eboard' ] and not auth_dict ['is_rtp' ]):
872+ abort (405 )
873+
847874 file_list = [("File" , f ) for f in File .query .filter (File .parent == dir_id ).all ()]
848875 dir_list = [("Directory" , d ) for d in Directory .query .filter (Directory .parent == dir_id ).all ()]
849876
@@ -995,7 +1022,12 @@ def view_filtered(auth_dict: Optional[Dict[str, Any]] = None):
9951022
9961023@app .route ("/api/memberlist" )
9971024@auth .oidc_auth ('default' )
998- def get_member_list ():
1025+ @gallery_auth
1026+ def get_member_list (auth_dict : Optional [Dict [str , Any ]] = None ):
1027+ gallery_lockdown = util .get_lockdown_status ()
1028+ if gallery_lockdown and (not auth_dict ['is_eboard' ] and not auth_dict ['is_rtp' ]):
1029+ abort (405 )
1030+
9991031 return jsonify (ldap .get_members ())
10001032
10011033
@@ -1014,7 +1046,7 @@ def route_errors(error: Any, auth_dict: Optional[Dict[str, Any]] = None):
10141046 if code == 404 :
10151047 error_desc = "Page Not Found"
10161048 elif code == 405 :
1017- error_desc = "Page Not Available "
1049+ error_desc = "Gallery is currently unavailable "
10181050 else :
10191051 error_desc = type (error ).__name__
10201052
0 commit comments