emqx-docs icon indicating copy to clipboard operation
emqx-docs copied to clipboard

Invalid ACL SQL in document

Open lotuc opened this issue 4 years ago • 0 comments

File: /en_US/advanced/acl-mysql.md

-- All users cannot subscribe to system topics
INSERT INTO mqtt_acl (allow, ipaddr, username, clientid, access, topic) VALUES (0, NULL, '$all', NULL, 1, '$SYS/#');

For the rule to work, the acl_query in the given doc should be

auth.pgsql.acl_query = select allow, ipaddr,'%u', clientid, access, topic from mqtt_acl where ipaddr = '%a' or username = '%u' or username = '$all' or clientid = '%c'

Instead of (notice the change in the select field username)

auth.pgsql.acl_query = select allow, ipaddr, username, clientid, access, topic from mqtt_acl where ipaddr = '%a' or username = '%u' or username = '$all' or clientid = '%c'

lotuc avatar May 17 '21 09:05 lotuc