Search code examples
pythonapirabbitmqrabbitmqadmin

updating user in RMQ with specific role with rabbitmq python literary


I want to update the user in rmq with only permission of reading queue with python rabbitmq_admin package . What should I use in the fields of

api.create_user_permission('username', '/', configure='', write='', read='queue')
api.create_user_permission('user', '/', configure='$^', write='$^', read='queue')
api.create_user_permission('user', '/', configure='', write='', read='queue')

I have tried all the above mentioned thing but the user gets all the access, I want the user to have only :read='queue'

I want the permission as follows:

Virtual host    Configure regexp    Write regexp    Read regexp
/                                                          queue

Solution

  • There is the issue with the package it self . i just replaced the part of the package in which it was hard coding the default as '.*'.

    Open the package in site package folder (/usr/local/lib/python2.7/site-packages) in you computer and open the api.py file in edit mode. After that just replace the part of create_user_permission function from

    data = { 'configure': configure or ' .* ', 'write': write or ' .* ', 'read': read or ' .* ', }

    TO

    data = { 'configure': configure or '', 'write': write or '', 'read': read or '', }

    this will solve the problem