Spaces:
Paused
Paused
dushyantsingh0 commited on
Commit ·
534ec62
1
Parent(s): c3378fc
fix: restore application stability with robust persona isolation
Browse filesFiles changed (3)
130 unmodified lines1311321331341351361371381 unmodified line140141142143144145146130 unmodified linesdetail="Access Denied: Customers cannot access internal operations endpoints.")elif portal == "customer":if role_str.startswith("3sc_") and role_str != "3sc_admin":# Direct Staff users to the Operations Console, but allow Super Admins (3sc_admin)raise HTTPException(status_code=status.HTTP_403_FORBIDDEN,detail="Access Denied: Staff must use the Operations Console."1 unmodified linefrom uuid import UUIDsetattr(user, "workspace_id", UUID(active_ws_id) if active_ws_id else None)setattr(user, "role", active_role)return user130 unmodified lines1311321331341351361371381 unmodified line140141142143144145146130 unmodified linesdetail="Access Denied: Customers cannot access internal operations endpoints.")elif portal == "customer":# Staff users who are NOT Super Admins (3sc_admin) should be redirected to the internal portalif role_str.startswith("3sc_") and role_str != "3sc_admin":raise HTTPException(status_code=status.HTTP_403_FORBIDDEN,detail="Access Denied: Staff must use the Operations Console."1 unmodified linefrom uuid import UUIDsetattr(user, "workspace_id", UUID(active_ws_id) if active_ws_id else None)setattr(user, "role", active_role or user.role) # Preserve injected role if availablereturn user
12 unmodified lines1314151617181912 unmodified linesDependency generator that checks if the current user has one of the allowed roles."""def role_checker(current_user: User = Depends(get_current_user)) -> User:if current_user.role not in allowed_roles:raise HTTPException(status_code=status.HTTP_403_FORBIDDEN,detail="You do not have permission to perform this action",12 unmodified lines131415161718192021222312 unmodified linesDependency generator that checks if the current user has one of the allowed roles."""def role_checker(current_user: User = Depends(get_current_user)) -> User:# Convert user's role and allowed_roles to strings/values for safe comparisonuser_role = str(current_user.role) if current_user.role else ""allowed_values = [str(r.value if hasattr(r, 'value') else r) for r in allowed_roles]if user_role not in allowed_values:raise HTTPException(status_code=status.HTTP_403_FORBIDDEN,detail="You do not have permission to perform this action",
117 unmodified lines118119120117 unmodified linesfrom { opacity: 0; transform: translateY(20px); }to { opacity: 1; transform: translateY(0); }}117 unmodified lines118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203117 unmodified linesfrom { opacity: 0; transform: translateY(20px); }to { opacity: 1; transform: translateY(0); }}/* Security & Redirection Overlay */.nexus-unauthorized-overlay {display: flex;align-items: center;justify-content: center;height: 100vh;background: radial-gradient(circle at 50% 50%, #F8FAFC 0%, #F1F5F9 100%);padding: 24px;}.nexus-unauthorized-box {background: rgba(255, 255, 255, 0.7);backdrop-filter: blur(20px);padding: 48px;border-radius: 28px;border: 1px solid rgba(255, 255, 255, 0.8);display: flex;flex-direction: column;align-items: center;gap: 16px;box-shadow: 0 40px 100px rgba(30, 58, 138, 0.1);max-width: 520px;text-align: center;animation: nexus-fade-in 0.8s ease-out;}.nexus-unauthorized-box h1 {font-size: 36px;font-weight: 800;color: #1E293B;margin: 12px 0 0;letter-spacing: -0.02em;}.nexus-unauthorized-box p {font-size: 16px;line-height: 1.6;color: #64748B;margin-bottom: 24px;}.nexus-unauthorized-actions {display: flex;flex-direction: column;gap: 12px;width: 100%;}.nexus-btn-primary {background: linear-gradient(90deg, #1E40AF, #3B82F6);color: white;border: none;padding: 16px 28px;border-radius: 14px;font-weight: 700;font-size: 15px;cursor: pointer;transition: all 0.2s;box-shadow: 0 4px 12px rgba(30, 64, 175, 0.2);}.nexus-btn-primary:hover {transform: translateY(-2px);box-shadow: 0 8px 20px rgba(30, 64, 175, 0.3);filter: brightness(1.1);}.nexus-btn-secondary {background: #F1F5F9;color: #475569;border: 1px solid #E2E8F0;padding: 16px 28px;border-radius: 14px;font-weight: 600;font-size: 15px;cursor: pointer;transition: all 0.2s;}.nexus-btn-secondary:hover {background: #E2E8F0;color: #1E293B;}
core/deps.py+2-2
core/permissions.py+5-1
frontend/apps/customer/src/App.css+83