larxius commited on
Commit
11711fe
·
verified ·
1 Parent(s): b113d12

Update backend_structured/routes.py

Browse files
Files changed (1) hide show
  1. backend_structured/routes.py +2 -2
backend_structured/routes.py CHANGED
@@ -478,10 +478,10 @@ def update_password(current_user):
478
  @auth_bp.route('/organizations/<org_id>/users', methods=['GET'])
479
  @token_required
480
  def get_org_users(current_user, org_id):
481
- if current_user.role != 'super_admin' and current_user.org_id != org_id:
482
  return jsonify({'message': 'Unauthorized access to organization users.'}), 403
483
 
484
- org_users = User.query.filter_by(org_id=org_id).all()
485
 
486
  return jsonify({
487
  'users': [{
 
478
  @auth_bp.route('/organizations/<org_id>/users', methods=['GET'])
479
  @token_required
480
  def get_org_users(current_user, org_id):
481
+ if current_user.role not in ['super_admin', 'admin'] and current_user.org_id != org_id:
482
  return jsonify({'message': 'Unauthorized access to organization users.'}), 403
483
 
484
+ org_users = User.query.filter_by(org_id=org_id).filter(User.role != 'super_admin').all()
485
 
486
  return jsonify({
487
  'users': [{