Complete reference for LoT rule syntax, conditions, operation scopes, and access control patterns
Deploying rules: In a LoT Notebook, just write the rule and run the cell—the extension handles the rest. For MQTT clients, use the -addRulebroker command.
This example restricts Action creation to administrators and the root user:
Copy
Ask AI
DEFINE RULE AllowActionAdd WITH PRIORITY 1 FOR ActionManagementCreation IF USER HAS AllowedSystemConfiguration OR USER IS "root" OR USER IS "admin" THEN ALLOW ELSE DENY
This example restricts configuration changes to authorized administrators:
Copy
Ask AI
DEFINE RULE AllowConfigurationChange WITH PRIORITY 1 FOR SystemConfiguration IF USER HAS AllowedSystemConfiguration OR USER IS "root" THEN ALLOW ELSE DENY
Use Publish and Subscribe with TO TOPIC to control access:
Copy
Ask AI
DEFINE RULE AllowPublishTopic WITH PRIORITY 1 FOR Publish TO TOPIC "#" ALLOWDEFINE RULE AllowSubscribeTopic WITH PRIORITY 1 FOR Subscribe TO TOPIC "#" ALLOW
Use PublishSys and SubscribeSys for system topic access:
Copy
Ask AI
DEFINE RULE AllowSubscribeSysClient WITH PRIORITY 1 FOR SubscribeSys TO TOPIC "$SYS/#" IF USER IS "root" THEN ALLOW ELSE DENYDEFINE RULE AllowPublishSysCommand WITH PRIORITY 1 FOR PublishSys TO TOPIC "$SYS/Coreflux/Command" IF USER HAS AllowedAssetManipulation OR USER HAS AllowedSystemConfiguration THEN ALLOW ELSE DENY
System topics ($SYS/#) contain sensitive broker information and command interfaces. Restrict access to administrative users only.
Rules are evaluated in priority order (lower number = higher priority). The first matching rule determines the outcome.
Copy
Ask AI
// This rule is evaluated first (priority 1)DEFINE RULE DenyGuestUsers WITH PRIORITY 1 FOR ActionManagementCreation IF USER IS "guest" THEN DENY// This rule is evaluated second (priority 2)DEFINE RULE AllowAdminUsers WITH PRIORITY 2 FOR ActionManagementCreation IF USER IS "admin" THEN ALLOW
Use lower priority numbers for more specific rules (like denying specific users) and higher numbers for general allow/deny rules.
A typical production setup with role-based access control:
Copy
Ask AI
// Only root can manage usersDEFINE RULE RestrictUserManagement WITH PRIORITY 1 FOR UserManagementCreation IF USER IS "root" THEN ALLOW ELSE DENY// Admins and root can deploy ActionsDEFINE RULE AllowActionDeployment WITH PRIORITY 1 FOR ActionManagementCreation IF USER IS "root" OR USER IS "admin" THEN ALLOW ELSE DENY// Users with permission can manage modelsDEFINE RULE AllowModelManagement WITH PRIORITY 1 FOR ModelManagementCreation IF USER HAS AllowedModelManagement OR USER IS "admin" THEN ALLOW ELSE DENY// Everyone can publish to non-system topicsDEFINE RULE OpenPublish WITH PRIORITY 1 FOR Publish TO TOPIC "#" ALLOW// Restrict $SYS subscriptions to rootDEFINE RULE ProtectSysTopics WITH PRIORITY 1 FOR SubscribeSys TO TOPIC "$SYS/#" IF USER IS "root" THEN ALLOW ELSE DENY
Limit IoT devices to their own topic namespace:
Copy
Ask AI
// Devices can only publish to their own topicsDEFINE RULE DevicePublishRestriction WITH PRIORITY 1 FOR Publish TO TOPIC "devices/#" IF USER HAS DevicePermission THEN ALLOW ELSE DENY// Devices cannot access command topicsDEFINE RULE DenyDeviceCommands WITH PRIORITY 1 FOR PublishSys TO TOPIC "$SYS/Coreflux/Command" IF USER HAS DevicePermission THEN DENY// Devices can subscribe to their config topicsDEFINE RULE DeviceConfigSubscription WITH PRIORITY 1 FOR Subscribe TO TOPIC "config/devices/#" IF USER HAS DevicePermission THEN ALLOW ELSE DENY
Separate access by organizational department:
Copy
Ask AI
// Engineering team accessDEFINE RULE EngineeringPublish WITH PRIORITY 1 FOR Publish TO TOPIC "engineering/#" IF USER HAS EngineeringAccess THEN ALLOW ELSE DENY// Operations team accessDEFINE RULE OperationsPublish WITH PRIORITY 1 FOR Publish TO TOPIC "operations/#" IF USER HAS OperationsAccess THEN ALLOW ELSE DENY// Shared topics for cross-team communicationDEFINE RULE SharedTopicAccess WITH PRIORITY 1 FOR Publish TO TOPIC "shared/#" IF USER HAS EngineeringAccess OR USER HAS OperationsAccess THEN ALLOW ELSE DENY