Overview
The User Management interface allows administrators to control access to the CEDIS Pedidos system. Admins can view all users, edit their details, activate/deactivate accounts, and manage user permissions across branch locations.Only users with
admin role can access the user management panel. Super admins have additional privileges including the ability to permanently delete users.User Roles
The system supports two primary user roles:Full administrative access. Can view all orders, approve requests, and manage users.
Branch-level access. Can create and edit orders for their assigned branch only.
Type Definition
src/lib/types.ts:30-39
Account States
Users can be in one of three account states:- Activo: User can log in and access the system
- Pendiente: Awaiting admin approval (cannot log in)
- Inactivo: Account disabled (cannot log in)
Accessing User Management
Filtering and Searching Users
The user management interface provides powerful filtering options:Search Bar
Search by name or email address in real-time.Role Filter
- Todos los roles
- Admin
- Sucursal
Status Filter
- Todos los estados
- Activo
- Pendiente
- Inactivo
src/components/admin/SolicitudesPanel.tsx:277-310
Editing User Details
Modify User Fields
Edit the inline form fields:
- Nombre: User’s full name
- Rol: Admin or Sucursal
- Estado: Activo, Pendiente, or Inactivo
- Sucursal: Assign to a branch location (or leave blank for admin-only users)
src/components/admin/SolicitudesPanel.tsx:14-19
Save Operation
The save function updates the database:src/components/admin/SolicitudesPanel.tsx:103-117
Quick Status Toggle
Admins can quickly activate or deactivate users:src/components/admin/SolicitudesPanel.tsx:119-126
Deleting Users
src/components/admin/SolicitudesPanel.tsx:128-135
Deleting a user cascades to related records due to
ON DELETE CASCADE constraints in the database schema.Database Schema
The users table structure:supabase/schema.sql:26-32 and supabase/add_auth_access_control.sql:8-11
Row-Level Security
Users table has RLS policies:supabase/schema.sql:116-119
Admins bypass these policies in practice because admin-level operations use the service role or appropriate elevated permissions.
Best Practices
- Assign Branch Locations: Always assign
sucursal_idfor users withsucursalrole - Review Regularly: Periodically audit user accounts and deactivate unused accounts
- Super Admin Protection: The system prevents modification of super admin accounts (
[email protected]and[email protected]) - Use Deactivation: Prefer deactivating over deleting users to maintain audit trails
Related Sections
Access Request Approvals
Learn how to approve new user access requests
Branch Management
Manage branch locations and assignments