Skip to main content

Permissions System

The system uses a flexible permissions model (RBAC) that allows precise definition of what each user (Gabbai/Administrator) can do. Permissions are enforced at the server level (Guards) and at the interface level (UI).

Permissions List (Permission Enum)

Source: src/common/enums/permission.enum.ts — 17 permissions total.

Permission IDValueDescription
MANAGE_USERSmanage_usersCreate, edit and delete users. Assign roles.
MANAGE_DEVICESmanage_devicesAdd devices, change settings, view status.
MANAGE_CONTENTmanage_contentEdit prayer times, messages, shiurim, Torah readings.
MANAGE_ALERTSmanage_alertsConfigure alert rules and smart alert thresholds.
MANAGE_REMOTE_CONTROLmanage_remote_controlSend commands to devices, reboot, screenshot, streaming.
MANAGE_REPORTSmanage_reportsAccess reports, statistics, and advanced analytics.
MANAGE_NOTIFICATIONSmanage_notificationsConfigure push notification channels.
MANAGE_WHATSAPPmanage_whatsappWhatsApp messaging, auto-response rules, contact aliases.
MANAGE_EMAIL_CONFIGmanage_email_configSMTP configuration for email notifications.
MANAGE_SMS_CONFIGmanage_sms_configSMS provider configuration (Twilio/AWS SNS).
MANAGE_SYSTEMmanage_systemSuper permission (Admin) for core settings and maintenance.
SYSTEM_CONFIG_READsystem_config_readRead-only access to system configuration.
SYSTEM_CONFIG_WRITEsystem_config_writeModify system configuration, backups, cleanup settings.
VIEW_DASHBOARDview_dashboardBasic access to home dashboard.
VIEW_ANALYTICSview_analyticsAccess to advanced charts, BI, and usage data.
VIEW_SYSTEM_HEALTHview_system_healthView system health checks, service status, incidents.
VIEW_SYSTEM_METRICSview_system_metricsView telemetry data, performance metrics, device stats.

Implementation in Code

Permissions are checked using the @Permissions decorator above the controller or function:

@Controller('users')
@Permissions(Permission.MANAGE_USERS) // Requires permission for all functions in controller
export class UsersController { ... }

Roles

The system supports built-in roles that aggregate multiple permissions:

  1. Admin (Super Administrator): Has all permissions. Can perform Impersonation (impersonate) other users.
  2. User (Gabbai): Manages only their synagogue. MANAGE_CONTENT, MANAGE_DEVICES permissions are limited to their Tenant.
  3. Viewer (Observer): View-only permissions (for example for audit committee).
Technical Note

In the database, the role is saved in the role field in the User model, and specific permissions in a linked table (if there's a deviation from the role).