Documentation Index
Fetch the complete documentation index at: https://mintlify.com/emmanueljarquin-sys/GrupoMecsaCMS/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Employee Role API allows administrators to update employee information including their role, chat role, department, and system access status. This endpoint operates on thepublic.Empleados table.
Endpoint: /api/update_employee_role.php
Method: POST
Authentication
Session Requirements
Request
Content-Type:application/x-www-form-urlencoded or application/json
Parameters
Employee ID (UUID) to update
New role assignment for the employeeCommon values:
ventasproyectosadministradorrecepcionmercadeocontabilidad
Role designation for chat/messaging features
Department assignment for the employee
System access status
trueor"1": Grant CMS accessfalseor"0": Revoke CMS access
sistemas_acceso array:- Active: Adds “CMS” to the systems array
- Inactive: Removes “CMS” from the systems array
Request Examples
Form Data
JSON
PHP Example
Response
Success Response
Indicates if the update was successful
Error message (null if successful)
Debug information about the request
Error Responses
401 Unauthorized
403 Forbidden
400 Bad Request
Update Failed
System Access Management
Theactivo parameter has special behavior:
Granting CMS Access
Whenactivo=true:
- Fetches current
sistemas_accesoarray - Adds “CMS” if not already present
- Updates both
sistemas_accesoandactivofields
Revoking CMS Access
Whenactivo=false:
- Fetches current
sistemas_accesoarray - Removes “CMS” (case-insensitive)
- Updates both fields
The
sistemas_acceso array may contain other system identifiers (e.g., “ERP”, “Portal”). The API only modifies the “CMS” entry, preserving access to other systems.Partial Updates
You can update any combination of fields. Only provided fields are updated:Database Schema
The endpoint updates thepublic.Empleados table:
| Column | Type | Description |
|---|---|---|
id | UUID | Employee unique identifier |
rol | TEXT | Role assignment |
chat_role | TEXT | Chat/messaging role |
departamento | TEXT | Department assignment |
activo | BOOLEAN | Global active status |
sistemas_acceso | JSONB | Array of accessible systems |
Related Endpoints
- Admin Roles API - Manage role definitions and permissions
- Authentication - Learn about admin authorization