{"id":20576607,"url":"https://github.com/hobbyquaker/mosquitto-acl-parser","last_synced_at":"2025-04-14T18:22:29.252Z","repository":{"id":57303010,"uuid":"91123905","full_name":"hobbyquaker/mosquitto-acl-parser","owner":"hobbyquaker","description":"Parse and Stringify Mosquitto ACLs","archived":false,"fork":false,"pushed_at":"2017-05-12T19:50:50.000Z","size":5,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T06:51:10.423Z","etag":null,"topics":["acl","mosquitto","mqtt","parse","stringify"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hobbyquaker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-12T19:35:47.000Z","updated_at":"2023-04-04T09:38:33.000Z","dependencies_parsed_at":"2022-09-21T03:01:48.162Z","dependency_job_id":null,"html_url":"https://github.com/hobbyquaker/mosquitto-acl-parser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hobbyquaker%2Fmosquitto-acl-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hobbyquaker%2Fmosquitto-acl-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hobbyquaker%2Fmosquitto-acl-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hobbyquaker%2Fmosquitto-acl-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hobbyquaker","download_url":"https://codeload.github.com/hobbyquaker/mosquitto-acl-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248262043,"owners_count":21074236,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["acl","mosquitto","mqtt","parse","stringify"],"created_at":"2024-11-16T05:46:20.905Z","updated_at":"2025-04-14T18:22:29.223Z","avatar_url":"https://github.com/hobbyquaker.png","language":"JavaScript","readme":"# mosquitto-acl-parser\n\n[![NPM version](https://badge.fury.io/js/mosquitto-acl-parser.svg)](http://badge.fury.io/js/mosquitto-acl-parser)\n[![Dependency Status](https://img.shields.io/gemnasium/hobbyquaker/mosquitto-acl-parser.svg?maxAge=2592000)](https://gemnasium.com/github.com/hobbyquaker/mosquitto-acl-parser)\n[![Build Status](https://travis-ci.org/hobbyquaker/mosquitto-acl-parser.svg?branch=master)](https://travis-ci.org/hobbyquaker/mosquitto-acl-parser)\n[![Coverage Status](https://coveralls.io/repos/github/hobbyquaker/mosquitto-acl-parser/badge.svg?branch=master)](https://coveralls.io/github/hobbyquaker/mosquitto-acl-parser?branch=master)\n[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)\n[![License][mit-badge]][mit-url]\n\n\u003e Parse and Stringify Mosquitto ACLs\n\nThis tiny module parses [Mosquitto](https://mosquitto.org/) ACLs into a Javascript object and stringifies objects back \ninto a ACL string.\n\n## Usage\n\n`npm install mosquitto-acl-parser`\n\n### .parse(string)\n\n```Javascript\nconst macl = require('mosquitto-acl-parser');\n\nconst acl = macl.parse(`# This affects access control for clients with no username.\ntopic read $SYS/#\n\n# This only affects clients with username \"roger\".\nuser roger\ntopic foo/bar\n\n# This affects all clients.\npattern write $SYS/broker/connection/%c/state`);\n```\n\n`acl` contains then...\n```JSON\n{\n  \"topics\": [\n    {\n      \"perm\": \"read\",\n      \"topic\": \"$SYS/#\"\n    }\n  ],\n  \"users\": {\n    \"roger\": [\n      {\n        \"perm\": \"readwrite\",\n        \"topic\": \"foo/bar\"\n      }\n    ]\n  },\n  \"patterns\": [\n    {\n      \"perm\": \"write\",\n      \"topic\": \"$SYS/broker/connection/%c/state\"\n    }\n  ]\n}\n```\n\n### .stringify(acl)\n\n```Javascript\nconst macl = require('mosquitto-acl-parser');\n\nconsole.log(macl.stringify({\n    topics: [\n        {\n            perm: 'read',\n            topic: 'everyone/can/read  '\n        },\n        {\n            perm: 'readwrite',\n            topic: 'everyone/can/readwrite'\n        }\n    ],\n    users: {\n        user1: [\n            {\n                perm: 'read',\n                topic: 'user1/can/read'\n            },\n            {\n                perm: 'readwrite',\n                topic: 'user1/can/readwrite'\n            }\n        ],\n        user2: [\n            {\n                perm: 'read',\n                topic: 'user2/can/read'\n            },\n            {\n                perm: 'readwrite',\n                topic: 'user2/can/readwrite'\n            }\n        ]\n    },\n    patterns: [\n        {\n            perm: 'read',\n            topic: 'pattern/%u/can/read'\n        },\n        {\n            perm: 'readwrite',\n            topic: 'pattern/%u/can/readwrite'\n        }\n    ]\n}));\n```\n\nOutputs...\n```\n# created by mosquitto-acl-parser\n\ntopic read everyone/can/read  \ntopic readwrite everyone/can/readwrite\n\nuser user1\ntopic read user1/can/read\ntopic readwrite user1/can/readwrite\n\nuser user2\ntopic read user2/can/read\ntopic readwrite user2/can/readwrite\n\npattern read pattern/%u/can/read\npattern readwrite pattern/%u/can/readwrite\n```\n\n## License\n\nMIT (c) 2017 [Sebastian Raff](https://github.com/hobbyquaker)\n\n[mit-badge]: https://img.shields.io/badge/License-MIT-blue.svg?style=flat\n[mit-url]: LICENSE\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhobbyquaker%2Fmosquitto-acl-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhobbyquaker%2Fmosquitto-acl-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhobbyquaker%2Fmosquitto-acl-parser/lists"}