larxius commited on
Commit
fb8cca6
·
verified ·
1 Parent(s): 5dfe702

Update backend_structured/routes.py

Browse files
Files changed (1) hide show
  1. backend_structured/routes.py +10 -2
backend_structured/routes.py CHANGED
@@ -815,7 +815,11 @@ def upload_organization_logo(current_user):
815
  if current_user.role not in ('org_admin', 'super_admin'):
816
  return jsonify({'message': 'Permission denied'}), 403
817
 
818
- org = db.session.get(Organization, current_user.org_id)
 
 
 
 
819
  if not org:
820
  return jsonify({'message': 'Organization not found'}), 404
821
 
@@ -910,7 +914,11 @@ def manage_webhook(current_user):
910
  if current_user.role not in ('org_admin', 'super_admin'):
911
  return jsonify({'message': 'Permission denied'}), 403
912
 
913
- org = db.session.get(Organization, current_user.org_id)
 
 
 
 
914
  if not org:
915
  return jsonify({'message': 'Organization not found'}), 404
916
 
 
815
  if current_user.role not in ('org_admin', 'super_admin'):
816
  return jsonify({'message': 'Permission denied'}), 403
817
 
818
+ org = None
819
+ if current_user.org_id:
820
+ org = db.session.get(Organization, current_user.org_id)
821
+ if not org and current_user.role == 'super_admin':
822
+ org = db.session.query(Organization).first()
823
  if not org:
824
  return jsonify({'message': 'Organization not found'}), 404
825
 
 
914
  if current_user.role not in ('org_admin', 'super_admin'):
915
  return jsonify({'message': 'Permission denied'}), 403
916
 
917
+ org = None
918
+ if current_user.org_id:
919
+ org = db.session.get(Organization, current_user.org_id)
920
+ if not org and current_user.role == 'super_admin':
921
+ org = db.session.query(Organization).first()
922
  if not org:
923
  return jsonify({'message': 'Organization not found'}), 404
924