Skip to content
Browse files

Improved the 'list_vhost_permissions' and 'list_user_permissions' met…

…hods.
  • Loading branch information...
1 parent d6f655d commit 0dc9f5035196ec79f656b0d6d0e13ba156fc5cf3 @clemesha-ooi clemesha-ooi committed Sep 21, 2009
Showing with 14 additions and 13 deletions.
  1. +1 −0 .gitignore
  2. +8 −8 irabbitmqctl.py
  3. +2 −2 rabbitmqctl_service.py
  4. +3 −3 tests/test_service.py
View
1 .gitignore
@@ -1,2 +1,3 @@
*.pyc
twisted/plugins/dropin.cache
+TODO
View
16 irabbitmqctl.py
@@ -33,17 +33,17 @@ def delete_vhost(vhostpath):
def list_vhosts():
"""list all vhosts"""
- def map_user_vhost(username, vhostpath):
- """allow access of user to vhost"""
+ def set_permissions(username, config_regex, write_regex, read_regex, vhostpath=None):
+ """set permission of a user to broker resources"""
- def unmap_user_vhost(username, vhostpath):
- """deny access of user to vhost"""
+ def clear_permissions(username, vhostpath=None):
+ """clear user permissions"""
- def list_user_vhosts(username):
- """list all vhosts for user"""
+ def list_vhost_permissions(vhostpath=None):
+ """list all users permissions"""
- def list_vhost_users(vhostpath):
- """list all users in vhost"""
+ def list_user_permissions(username=None):
+ """list all users permissions"""
def list_queues(vhostpath=None, queueinfoitem=None):
"""list all queues"""
View
4 rabbitmqctl_service.py
@@ -128,7 +128,7 @@ def list_vhost_permissions(self, vhostpath=None):
config_regex = v[1].value
write_regex = v[2].value
read_regex = v[3].value
- result_all[(username, vhostpath.value)] = [config_regex, write_regex, read_regex]
+ result_all[username] = [vhostpath.value, config_regex, write_regex, read_regex]
response = {"command":"list_vhost_permissions", "vhostpath":vhostpath.value, "result":result_all}
returnValue(response)
@@ -145,7 +145,7 @@ def list_user_permissions(self, username=None):
config_regex = v[1].value
write_regex = v[2].value
read_regex = v[3].value
- result_all[(vhostpath, username.value)] = [config_regex, write_regex, read_regex]
+ result_all[vhostpath] = [username.value, config_regex, write_regex, read_regex]
response = {"command":"list_user_permissions", "vhostpath":username.value, "result":result_all}
returnValue(response)
View
6 tests/test_service.py
@@ -90,7 +90,7 @@ def test_set_clear_permission(self):
list_vhost_permissions = yield self.service.list_vhost_permissions()
permissions_result = list_vhost_permissions["result"]
- self.failUnless(permissions_result[(_test_username, '/')] == ['.*', '.*', '.*'])
+ self.failUnless(permissions_result[_test_username] == ['/', '.*', '.*', '.*'])
clear_permissions = yield self.service.clear_permissions(_test_username)
self.failUnless(clear_permissions["result"].text == "ok")
@@ -102,15 +102,15 @@ def test_list_vhost_permissions(self):
list_vhost_permissions = yield self.service.list_vhost_permissions()
self.failUnless(list_vhost_permissions["command"] == "list_vhost_permissions")
result = list_vhost_permissions["result"]
- self.failUnless(result[('guest', '/')] == ['.*', '.*', '.*'])
+ self.failUnless(result['guest'] == ['/', '.*', '.*', '.*'])
@inlineCallbacks
def test_list_user_permissions(self):
"""Test list all users permissions"""
list_user_permissions = yield self.service.list_user_permissions()
self.failUnless(list_user_permissions["command"] == "list_user_permissions")
result = list_user_permissions["result"]
- self.failUnless(result[('/', 'guest')] == ['.*', '.*', '.*'])
+ self.failUnless(result['/'] == ['guest', '.*', '.*', '.*'])
@inlineCallbacks
def test_list_queues(self):

0 comments on commit 0dc9f50

Please sign in to comment.
Something went wrong with that request. Please try again.