Overview
The RolUsuarios (User Roles) API provides endpoints for creating, reading, updating, and deleting user roles in the system. User roles define the permissions and access levels for users. Base URL:/Database/Database/rolusuarios/
RolUsuario Model
The RolUsuario model represents a user role with the following fields:Auto-generated primary key for the user role
Name of the role (max 15 characters)
Role status (typically 0 for inactive, 1 for active)
Registration date of the role
Common User Roles
Based on the system implementation, the following role IDs are commonly used:- 1: Administrator - Full system access
- 2: Publicista (Advertiser) - Access to associated companies
- 3: Empresa (Company) - Access to own company resources
Endpoints
List All User Roles
Retrieve a list of all user roles in the system.Get Single User Role
Retrieve details of a specific user role by ID.The unique identifier of the user role
Create User Role
Create a new user role in the system.Name of the role (max 15 characters)
Role status (0 for inactive, 1 for active)
Registration date in YYYY-MM-DD format
Update User Role
Update an existing user role’s information.The unique identifier of the user role to update
Name of the role
Role status
Registration date
Partial Update User Role
Partially update a user role’s information (only specified fields).The unique identifier of the user role to update
Delete User Role
Delete a user role from the system.The unique identifier of the user role to delete
Role-Based Access Control
User roles are used throughout the system to control access to resources. For example:Sectors Access
When retrieving sectors (via/sectores_por_usuario/{usuario_id}/), access is determined by role:
- Administrator (id_rol = 1): Access to all sectors
- Publicista (id_rol = 2): Access to sectors from associated companies
- Empresa (id_rol = 3): Access to own company’s sectors
Company Access
When retrieving companies (via/empresas_list/{usuario_id}/), access is determined by role:
- Administrator (id_rol = 1): Access to all administered companies
- Publicista (id_rol = 2): Access to associated companies through EmpresaXPublicista
Related Endpoints
- Usuarios API - Manage users with assigned roles
- PermisosXRol API - Manage role-based permissions
- DetallePermisos API - Manage detailed permissions
Notes
- All endpoints use standard REST conventions with JSON request/response bodies
- The API uses Django REST Framework’s ModelViewSet which provides full CRUD operations
- Role names are limited to 15 characters
- The
estadofield typically uses 0 for inactive and 1 for active status - User roles are referenced by
Usuariomodel via therol_usuarioforeign key - Roles are also used in permission models (
PermisosXRol) to control access to menus and views