Saltar al contenido principal

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):

LevelDefault role
1Reception
2Nurse / Optometrist
3Physician
5Clinic manager
10System 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 AdminObelioSectionVisibility admin 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 caseLayer
Hide a field from junior rolesLayer A (level in XML)
Show/hide a tab based on specialtyLayer B (SectionVisibility)
Configurable field access thresholdsLayer A + obelio_core_settings
Show different content to physician vs nurse for the same entityLayer B
Performance-critical list viewsLayer 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.