From 6cdec2b4b51c0b106503b29cd0d33a27b72eb49d Mon Sep 17 00:00:00 2001 From: fahed Date: Mon, 23 Feb 2026 15:36:48 +0300 Subject: [PATCH] Restrict team_role and brands to admin-only editing - Remove team_role and brands from profile completion wizard - Lock team_role and brands fields when user edits own profile - Remove team_role and brands from PATCH /users/me/profile endpoint - Profile completeness now checks name instead of team_role Co-Authored-By: Claude Opus 4.6 --- client/src/App.jsx | 29 +---------------------- client/src/components/TeamMemberPanel.jsx | 15 +++++++++++- client/src/pages/Team.jsx | 2 -- server/server.js | 4 +--- 4 files changed, 16 insertions(+), 34 deletions(-) diff --git a/client/src/App.jsx b/client/src/App.jsx index 6a9b8d6..1ee919a 100644 --- a/client/src/App.jsx +++ b/client/src/App.jsx @@ -200,17 +200,6 @@ function AppContent() { placeholder={t('team.fullName')} /> -
- - -
-
- - setProfileForm(f => ({ ...f, brands: e.target.value }))} - className="w-full px-3 py-2 text-sm border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-brand-primary/20 focus:border-brand-primary" - placeholder={t('team.brandsHelp')} - /> -
)} + } {/* Modules toggle */} diff --git a/client/src/pages/Team.jsx b/client/src/pages/Team.jsx index 13b66e5..ecbe338 100644 --- a/client/src/pages/Team.jsx +++ b/client/src/pages/Team.jsx @@ -43,8 +43,6 @@ export default function Team() { if (isEditingSelf) { await api.patch('/users/me/profile', { name: data.name, - team_role: data.role, - brands: data.brands, phone: data.phone, }) } else { diff --git a/server/server.js b/server/server.js index dac78c5..c87806e 100644 --- a/server/server.js +++ b/server/server.js @@ -663,7 +663,7 @@ app.post('/api/auth/login', async (req, res) => { avatar: user.avatar, team_role: user.team_role, tutorial_completed: user.tutorial_completed, - profileComplete: !!user.team_role, + profileComplete: !!user.name, modules, }, }); @@ -739,9 +739,7 @@ app.get('/api/users/me/profile', requireAuth, async (req, res) => { app.patch('/api/users/me/profile', requireAuth, async (req, res) => { const data = {}; if (req.body.name !== undefined) data.name = req.body.name; - if (req.body.team_role !== undefined) data.team_role = req.body.team_role; if (req.body.phone !== undefined) data.phone = req.body.phone; - if (req.body.brands !== undefined) data.brands = JSON.stringify(req.body.brands); if (Object.keys(data).length === 0) return res.status(400).json({ error: 'No fields to update' });