Spaces:
Sleeping
Sleeping
Download set_admin.py from hisham-cmd/VortexCommerceBackend: direct link, hf CLI and curl.
- Browser
- Download file 763 Bytes
-
https://huggingface.co/spaces/hisham-cmd/VortexCommerceBackend/resolve/5bf519cdfd82cc4e05fc313fdd730c717cc42a4e/set_admin.py
- Command line
-
hf download hf://spaces/hisham-cmd/VortexCommerceBackend@5bf519cdfd82cc4e05fc313fdd730c717cc42a4e/set_admin.py
-
curl -L -o set_admin.py https://huggingface.co/spaces/hisham-cmd/VortexCommerceBackend/resolve/5bf519cdfd82cc4e05fc313fdd730c717cc42a4e/set_admin.py
763 Bytes
| import sqlite3 | |
| import os | |
| # Database path | |
| DB_PATH = os.path.join(os.path.dirname(__file__), "vortex.db") | |
| def set_all_admins(): | |
| if not os.path.exists(DB_PATH): | |
| print(f"Error: Database not found at {DB_PATH}") | |
| return | |
| try: | |
| conn = sqlite3.connect(DB_PATH) | |
| cursor = conn.cursor() | |
| # Update all users to admin role for development | |
| cursor.execute("UPDATE users SET role = 'admin'") | |
| conn.commit() | |
| updated_count = cursor.rowcount | |
| print(f"Successfully updated {updated_count} users to ADMIN role.") | |
| conn.close() | |
| except Exception as e: | |
| print(f"An error occurred: {e}") | |
| if __name__ == "__main__": | |
| set_all_admins() | |