1_general_forum/currency-ledger/scripts/update-profile.py

87 lines
3.1 KiB
Python
Raw Normal View History

2025-08-04 13:15:39 +00:00
#!/usr/bin/env python3
"""
Personal Profile Update Script
Update your own information safely
"""
import csv
import os
from datetime import datetime
def update_founder_profile():
"""Update founding entrepreneur profile"""
base_path = os.path.join(os.path.dirname(__file__), '..')
print("📝 UPDATE YOUR PROFILE")
print("=" * 30)
# Show current info
identity_file = os.path.join(base_path, 'ownership', 'identity-mapping.csv')
with open(identity_file, 'r') as f:
reader = csv.DictReader(f)
current_data = list(reader)[0] # Assuming you're owner 001
print("Current information:")
print(f" Real Name: {current_data['real_name']}")
print(f" Email: {current_data['email']}")
print(f" Display Name: {current_data['display_name']}")
print(f" Privacy Level: {current_data['privacy_level']}")
print()
# Get updates
print("Enter new values (press Enter to keep current):")
new_name = input(f"Real Name [{current_data['real_name']}]: ").strip()
if not new_name:
new_name = current_data['real_name']
new_email = input(f"Email [{current_data['email']}]: ").strip()
if not new_email:
new_email = current_data['email']
new_display = input(f"Display Name [{current_data['display_name']}]: ").strip()
if not new_display:
new_display = current_data['display_name']
new_privacy = input(f"Privacy Level [{current_data['privacy_level']}]: ").strip()
if not new_privacy:
new_privacy = current_data['privacy_level']
# Update identity mapping (private)
timestamp = datetime.now().isoformat() + 'Z'
with open(identity_file, 'w', newline='') as f:
writer = csv.writer(f)
writer.writerow(['owner_id', 'real_name', 'email', 'display_name', 'privacy_level', 'created_date'])
writer.writerow(['001', new_name, new_email, new_display, new_privacy, timestamp])
# Update book of owners if display name changed
if new_display != current_data['display_name']:
book_file = os.path.join(base_path, 'ownership', 'book-of-owners.csv')
# Read current book
with open(book_file, 'r') as f:
reader = csv.DictReader(f)
records = list(reader)
# Update display name for owner 001
for record in records:
if record['owner_id'] == '001':
record['display_name'] = new_display
record['last_updated'] = timestamp
# Write back
with open(book_file, 'w', newline='') as f:
fieldnames = ['owner_id', 'display_name', 'license_type', 'license_date', 'current_sk', 'voting_weight', 'status', 'last_updated']
writer = csv.DictWriter(f, fieldnames=fieldnames)
writer.writeheader()
writer.writerows(records)
print(f"✅ Display name updated to: {new_display}")
print("✅ Profile updated successfully!")
print("🔒 Private info stays private (not committed to git)")
if __name__ == "__main__":
update_founder_profile()