ALLOW / DENY Functional Keywords
| Feature | Since Version | Notes | 
|---|---|---|
| ALLOW | >v1.4.4 | Grants permission in Rules | 
| DENY | >v1.4.4 | Revokes permission in Rules | 
Overview
- Description:
    These keywords are used exclusively within the THENorELSEblock of aDEFINE RULEstatement. They specify the outcome of the permission check:ALLOWgrants the permission for the operation defined in the rule's scope, whileDENYrevokes it.
Signature
- Syntax:
Parameters
- These keywords do not take parameters themselves but act as the consequence within an IFstatement inside aDEFINE RULE.
Usage Examples
Used within DEFINE RULE blocks.
Basic Example
Allow a specific user to publish to any topic.
DEFINE RULE AllowAdminPublish WITH PRIORITY 1 FOR Publish
    IF USER IS "admin" THEN
        ALLOW
    ELSE
        DENY // Deny for everyone else by default in this rule
Intermediate Example
Allow users with a specific role to subscribe to system topics.
DEFINE RULE AllowMonitorSubscribeSystem WITH PRIORITY 5 FOR Subscribe TO TOPIC "$SYS/#"
    IF USER HAS MonitorRole THEN
        ALLOW
    ELSE
        DENY
Advanced Example (Default Deny)
Rules often work with a default deny policy. This rule explicitly denies publishing to config topics unless the user is an admin.
DEFINE RULE DenyConfigPublishForNonAdmins WITH PRIORITY 10 FOR Publish TO TOPIC "config/#"
    IF USER IS "admin" THEN
        ALLOW // Explicitly allow admin
    ELSE
        DENY  // Explicitly deny others
Notes & Additional Information
- ALLOWand- DENYare the terminal actions within a- DEFINE RULE's- IFblock.
- The final permission depends on the evaluation of all matching rules based on their PRIORITY.
- A common pattern is to have a low-priority rule that denies an operation by default, and higher-priority rules that grant ALLOWbased on specific conditions.