如何在RBMQ中使用definitions.json添加额外的主题权限。

huangapple go评论52阅读模式
英文:

How to add additional topic permissions in RBMQ with definitions.json

问题

有人知道如何通过definitions.json配置文件为用户提供额外的主题权限(例如amq.topic)吗?(我知道可以通过管理控制台设置,但我不想手动设置。)

我已经尝试了以下方法,但没有提供额外的主题权限:

{
  "user": "guest",
  "vhost": "/",
  "configure": ".*",
  "write": ".*",
  "read": ".*"
},
{
  "user": "guest",
  "vhost": "/",
  "configure": "amq.topic",
  "write": ".*",
  "read": ".*"
}
英文:

Does anybody know how to give a user additional topic permissions (e.g. amq.topic) through the definitions.json config file? (I know it's possible through the management console, but I don't want to set it up manually.)

I already tried following which is not giving any additional topic permissions:

{
  "user": "guest",
  "vhost": "/",
  "configure": ".*",
  "write": ".*",
  "read": ".*"
},
{
  "user": "guest",
  "vhost": "/",
  "configure": "amq.topic",
  "write": ".*",
  "read": ".*"
},

答案1

得分: 2

你需要添加一个"topic_permissions"部分,其中包含你想要的配置:

"topic_permissions": [
    {
        "user": "guest",
        "vhost": "/",
        "exchange": "amq.topic",
        "write": "[^.]+\\.sample\\.[^.]+",
        "read": ""
    }
]

通常,我会手动在管理界面中创建这些内容,然后导出定义以查看它们是如何被“翻译”的。

英文:

You need to add a topic_permissions section, with the config you want:

"topic_permissions": [
	{
		"user": "guest",
		"vhost": "/",
		"exchange": "amq.topic",
		"write": "[^.]+\\.sample\\.[^.]+",
		"read": ""
	}
]

To figure out those things, I usually create them manually in the admin interface, then export the definition to see how it is "translated".

答案2

得分: 0

查看来自(填写用户名/密码)的topic_permissions部分:

curl --silent --user yourusername:yourpass --header "Content-type: application/json" http://127.0.0.1:15672/api/definitions | jq . | tee config.json

或者不包含交换机的示例:

"topic_permissions": [
  {
    "user": "yourusername",
    "vhost": "/",
    "exchange": "",
    "write": ".*",
    "read": ".*"
  }
]
英文:

See topic_permissions section from (fill user/pass):

curl --silent --user yourusername:yourpass --header "Content-type: application/json" http://127.0.0.1:15672/api/definitions | jq . | tee config.json

Or example without exchange:

"topic_permissions": [
  {
    "user": "yourusername",
    "vhost": "/",
    "exchange": "",
    "write": ".*",
    "read": ".*"
  }
]

huangapple
  • 本文由 发表于 2023年5月31日 23:46:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/76375265.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定