Initial commit: SmoothSchedule multi-tenant scheduling platform
This commit includes: - Django backend with multi-tenancy (django-tenants) - React + TypeScript frontend with Vite - Platform administration API with role-based access control - Authentication system with token-based auth - Quick login dev tools for testing different user roles - CORS and CSRF configuration for local development - Docker development environment setup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
40
smoothschedule/create_admin.py
Normal file
40
smoothschedule/create_admin.py
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env python
|
||||
"""Create a platform admin user for testing."""
|
||||
import os
|
||||
import django
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
|
||||
django.setup()
|
||||
|
||||
from smoothschedule.users.models import User
|
||||
from rest_framework.authtoken.models import Token
|
||||
|
||||
# Create or get a superuser with platform admin role
|
||||
user, created = User.objects.get_or_create(
|
||||
username='admin',
|
||||
defaults={
|
||||
'email': 'admin@smoothschedule.com',
|
||||
'is_staff': True,
|
||||
'is_superuser': True,
|
||||
'role': User.Role.SUPERUSER,
|
||||
}
|
||||
)
|
||||
|
||||
if created:
|
||||
user.set_password('admin123')
|
||||
user.save()
|
||||
print(f"Created new superuser: {user.username}")
|
||||
else:
|
||||
user.role = User.Role.SUPERUSER
|
||||
user.is_staff = True
|
||||
user.is_superuser = True
|
||||
user.set_password('admin123')
|
||||
user.save()
|
||||
print(f"Updated existing user: {user.username}")
|
||||
|
||||
# Create or get auth token
|
||||
token, _ = Token.objects.get_or_create(user=user)
|
||||
print(f"\nAuth token: {token.key}")
|
||||
print(f"User role: {user.role}")
|
||||
print(f"\nYou can now use this token to test the API:")
|
||||
print(f'curl -H "Authorization: Token {token.key}" http://lvh.me:8000/api/platform/businesses/')
|
||||
Reference in New Issue
Block a user