Hybrid Visibility System
obeliOmed implements a two-layer visibility model to control what each user role sees. The layers are independent and complementary.
Layer A — FacturaScripts level (field-level)
FS provides a native level attribute on XML view columns and tabs. Fields with a level higher
than the user's role level are hidden automatically by the framework.
<!-- EditAppointment.xml -->
<group name="patient_data">
<column name="id_patient" level="1" /> <!-- all roles see this -->
<column name="clinical_notes" level="3" /> <!-- only level 3+ roles -->
<column name="internal_comment" level="5" /> <!-- only level 5+ roles -->
</group>
Characteristics:
- Linear hierarchy (role has level N, sees everything up to N)
- Configured in XML view files — no admin UI to change
- Applied automatically by FacturaScripts core rendering
- Fast (zero extra queries)
Thresholds are configurable per company via obelio_core_settings (AdminObelioFieldLevels):
| Level | Default role |
|---|---|
| 1 | Reception |
| 2 | Nurse / Optometrist |
| 3 | Physician |
| 5 | Clinic manager |
| 10 | System admin |
Layer B — ObelioSectionVisibility (section-level)
For sections that do not map to a single FS level (e.g. "show the 'Surgical history' tab only to
physicians and clinic managers, not to reception regardless of level"), ObelioCore provides
ObelioSectionVisibility: a per-company, per-role, drag-and-drop configuration stored in DB.
obelio_core_section_visibility
id_company (idEmpresa)
section_key (e.g. "patient.surgical_history")
roles (JSON array: ["physician", "clinic_manager"])
is_visible (TINYINT)
sort_order (INT)
Characteristics:
- Multi-role (a section can be visible to multiple roles simultaneously)
- Configurable from
AdminObelioSectionVisibilityadmin panel — no code change needed - Values set in audits are defaults per installation, modified freely by each clinic admin
- Slightly more expensive (one extra query per page load, cached per session)
When to use which layer
| Use case | Layer |
|---|---|
| Hide a field from junior roles | Layer A (level in XML) |
| Show/hide a tab based on specialty | Layer B (SectionVisibility) |
| Configurable field access thresholds | Layer A + obelio_core_settings |
| Show different content to physician vs nurse for the same entity | Layer B |
| Performance-critical list views | Layer A only |
Audit documentation
Every audit (34b spec) must document explicit default visibility matrices:
Section x Role matrix (defaults, per ADR-031):
Reception Nurse Physician Manager Admin
patient.basic_info R R RW RW RW
patient.clinical - R RW R RW
patient.surgical - - RW R RW
patient.guardian R R RW RW RW
These defaults are loaded at plugin installation time and can be modified per clinic from the admin.