#!/usr/bin/env python3 import requests import json # Test zhangsan user menu access login_data = { 'username': 'zhangsan', 'password': 'zhangsan123' # Try common password } # Try different passwords for zhangsan passwords = ['zhangsan123', 'Zhangsan123', '123456', 'password', 'zhangsan'] for password in passwords: try: login_data['password'] = password login_response = requests.post('http://localhost:8000/api/v1/auth/login', json=login_data) if login_response.status_code == 200: login_result = login_response.json() if login_result.get('code') == 0: token = login_result['data']['access_token'] print(f'✅ Zhangsan login successful with password: {password}') # Get user menus headers = {'Authorization': f'Bearer {token}'} menus_response = requests.get('http://localhost:8000/api/v1/user/menus', headers=headers) if menus_response.status_code == 200: menus_result = menus_response.json() if menus_result.get('code') == 0: menus = menus_result['data'] print(f'✅ Zhangsan has access to {len(menus)} menu items') # Check for admin-dashboard menu has_admin_dashboard = False for menu in menus: if menu.get('menu_type') == 'menu': print(f'📁 {menu["title"]} ({menu["name"]}) - Path: {menu.get("path", "N/A")}') if menu.get('children'): for child in menu['children']: if child.get('menu_type') == 'menu': print(f' 📄 {child["title"]} ({child["name"]}) - Path: {child.get("path", "N/A")}') if child.get('name') == 'admin-dashboard': has_admin_dashboard = True print(' ✅ Found įŽĄį†æĻ‚č§ˆ (admin-dashboard) menu!') if has_admin_dashboard: print('\n🎉 Zhangsan can now see the įŽĄį†æĻ‚č§ˆ menu!') else: print('\n❌ Zhangsan still cannot see the įŽĄį†æĻ‚č§ˆ menu!') else: print(f'❌ Menus API error: {menus_result.get("message")}') else: print(f'❌ Menus API HTTP error: {menus_response.status_code}') break except Exception as e: continue else: print('❌ Could not find correct password for zhangsan user')